link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,145 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.auth.BHostCnxHandler
* com.tridium.workbench.ord.BHostOrdFE
* javax.baja.data.BIDataValue
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.BFacets
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platform.ui;
import com.tridium.platform.daemon.BDaemonScheme;
import com.tridium.platform.ui.BDaemonSessionOrdFE;
import com.tridium.workbench.auth.BHostCnxHandler;
import com.tridium.workbench.ord.BHostOrdFE;
import javax.baja.data.BIDataValue;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.BFacets;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
public class BDaemonCnxHandler
extends BHostCnxHandler {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BDaemonCnxHandler == null ? (class$com$tridium$platform$ui$BDaemonCnxHandler = BDaemonCnxHandler.class$("com.tridium.platform.ui.BDaemonCnxHandler")) : class$com$tridium$platform$ui$BDaemonCnxHandler));
private static final String KEY = "open.daemon";
static /* synthetic */ Class class$com$tridium$platform$ui$BDaemonCnxHandler;
public Type getType() {
return TYPE;
}
public BDaemonCnxHandler() {
this(TYPE.getModule().getLexicon(), KEY);
}
public BDaemonCnxHandler(Lexicon lexicon, String string) {
this(BDaemonScheme.INSTANCE.getId(), 3011, new BDaemonSessionOrdFE(), (BICredentials)new BUsernameAndPassword(), lexicon, string);
}
public BDaemonCnxHandler(String string, int n, BHostOrdFE bHostOrdFE, BICredentials bICredentials, Lexicon lexicon, String string2) {
super(string, n, bHostOrdFE, bICredentials, lexicon, string2);
BFacets bFacets = BFacets.make((String)"wbMenu", (BIDataValue)BString.make((String)"true"));
BasicContext basicContext = new BasicContext((Context)bFacets);
this.hostOrd = BOrd.make((String)"ip:");
this.ordFE.loadValue((BObject)this.hostOrd, (Context)basicContext);
}
public BOrd toHyperlink() {
try {
this.saveHostAddress();
}
catch (Exception exception) {
throw new BajaRuntimeException(exception.getMessage());
}
return super.toHyperlink();
}
public String toAuthenticationRealm() {
try {
this.saveHostAddress();
}
catch (Exception exception) {
throw new BajaRuntimeException(exception.getMessage());
}
return super.toAuthenticationRealm();
}
public int getPort() {
return this.port;
}
public String getSessionScheme() {
return this.sessionScheme;
}
protected void saveHostAddress() throws Exception {
this.ordFE.setModified();
this.ordFE.setAutoSaveHistory(false);
BOrd bOrd = (BOrd)this.ordFE.saveValue();
OrdQuery[] ordQueryArray = bOrd.parse();
this.hostOrd = BOrd.make((OrdQuery)ordQueryArray[0]);
this.port = this.defaultPort;
if (!bOrd.isNull()) {
for (int i = 1; i < ordQueryArray.length; ++i) {
if (!(ordQueryArray[i] instanceof BDaemonScheme.DaemonQuery)) continue;
BDaemonScheme.DaemonQuery daemonQuery = (BDaemonScheme.DaemonQuery)ordQueryArray[i];
this.port = daemonQuery.getPort();
this.tunnelAuthorities = daemonQuery.getTunnelAuthorities();
break;
}
}
}
public void doSaveCnx() {
try {
this.ordFE.setAutoSaveHistory(true);
this.ordFE.setModified();
this.ordFE.saveValue();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public void doClearCnx() {
BFacets bFacets = BFacets.make((String)"wbMenu", (BIDataValue)BString.make((String)"true"));
BasicContext basicContext = new BasicContext((Context)bFacets);
this.hostOrd = BOrd.make((String)"ip:");
this.ordFE.loadValue((BObject)this.hostOrd, (Context)basicContext);
this.port = this.defaultPort;
this.tunnelAuthorities = null;
this.setCredentials((BICredentials)new BUsernameAndPassword());
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,51 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.nav.BSessionAgent
* javax.baja.naming.BHost
* javax.baja.naming.BISession
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platform.ui;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.workbench.nav.BSessionAgent;
import javax.baja.naming.BHost;
import javax.baja.naming.BISession;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
public class BDaemonSessionAgent
extends BSessionAgent {
public static final BDaemonSessionAgent INSTANCE = new BDaemonSessionAgent();
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BDaemonSessionAgent == null ? (class$com$tridium$platform$ui$BDaemonSessionAgent = BDaemonSessionAgent.class$("com.tridium.platform.ui.BDaemonSessionAgent")) : class$com$tridium$platform$ui$BDaemonSessionAgent));
static /* synthetic */ Class class$com$tridium$platform$ui$BDaemonSessionAgent;
public Type getType() {
return TYPE;
}
public void pickle(BISession bISession, XElem xElem) {
BDaemonSession bDaemonSession = (BDaemonSession)bISession;
xElem.addAttr("port", "" + bDaemonSession.getPort());
}
public BISession unpickle(BHost bHost, XElem xElem) {
int n = xElem.geti("port", 3011);
return BDaemonSession.make(bHost, n);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,202 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.IPAddressUtil
* com.tridium.workbench.ord.BHostOrdFE
* com.tridium.workbench.ord.BHostOrdFE$PlatformTunnelScheme
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.nre.util.TextUtil
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BAbstractButton$MenuController
* javax.baja.ui.BLabel
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BConstrainedPane
* javax.baja.ui.pane.BGridPane
*/
package com.tridium.platform.ui;
import com.tridium.nre.util.IPAddressUtil;
import com.tridium.platform.daemon.BDaemonScheme;
import com.tridium.workbench.ord.BHostOrdFE;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.nre.util.TextUtil;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BAbstractButton;
import javax.baja.ui.BLabel;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BConstrainedPane;
import javax.baja.ui.pane.BGridPane;
public class BDaemonSessionOrdFE
extends BHostOrdFE {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BDaemonSessionOrdFE == null ? (class$com$tridium$platform$ui$BDaemonSessionOrdFE = BDaemonSessionOrdFE.class$("com.tridium.platform.ui.BDaemonSessionOrdFE")) : class$com$tridium$platform$ui$BDaemonSessionOrdFE));
private static final int HTTP_TUNNEL_PORT = 80;
static /* synthetic */ Class class$com$tridium$platform$ui$BDaemonSessionOrdFE;
public Type getType() {
return TYPE;
}
public BDaemonSessionOrdFE() {
this(false);
}
public BDaemonSessionOrdFE(boolean bl) {
this.portEditableOnReadonly = bl;
}
protected BWidget buildContent() {
BWidget bWidget = super.buildContent();
this.port = new BTextField(Integer.toString(this.getDefaultPort()), 6);
this.linkTo((BComponent)this.port, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.port, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
BGridPane bGridPane = new BGridPane(2);
bGridPane.setHalign(BHalign.fill);
bGridPane.add(null, (BValue)new BLabel(" " + bajaUiLex.getText("auth.host")));
bGridPane.add(null, (BValue)bWidget);
bGridPane.add(null, (BValue)new BLabel(" " + bajaUiLex.getText("auth.port")));
BGridPane bGridPane2 = new BGridPane(3);
bGridPane.add(null, (BValue)bGridPane2);
bGridPane2.add(null, (BValue)this.port);
this.tunnelLabel = new BLabel(" " + bajaUiLex.getText("auth.tunnel"));
bGridPane2.add(null, (BValue)this.tunnelLabel);
this.cnxTunnelPath = new BTextField("");
this.linkTo((BComponent)this.cnxTunnelPath, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.cnxTunnelPath, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
bGridPane2.add(null, (BValue)this.cnxTunnelPath);
bGridPane.relayout();
bGridPane.computePreferredSize();
double d = bGridPane.getPreferredWidth();
this.cnxTunnelPath.setVisible(this.isTunnelScheme());
this.tunnelLabel.setVisible(this.isTunnelScheme());
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)bGridPane);
bConstrainedPane.setMinWidth(d);
return bConstrainedPane;
}
protected BAbstractButton.MenuController getHistoryMenuController() {
return null;
}
protected void doLoadValue(BObject bObject, Context context) {
boolean bl;
super.doLoadValue(bObject, context);
BOrd bOrd = (BOrd)bObject;
String string = Integer.toString(this.getDefaultPort());
String string2 = "";
if (null != bOrd && !bOrd.isNull()) {
OrdQuery[] ordQueryArray = bOrd.parse();
for (int i = 1; i < ordQueryArray.length; ++i) {
if (!(ordQueryArray[i] instanceof BDaemonScheme.DaemonQuery)) continue;
BDaemonScheme.DaemonQuery daemonQuery = (BDaemonScheme.DaemonQuery)ordQueryArray[i];
string = Integer.toString(daemonQuery.getPort());
String[] stringArray = daemonQuery.getTunnelAuthorities();
if (stringArray == null) break;
string2 = TextUtil.join((String[])stringArray, (char)'/');
break;
}
}
this.port.setText(string);
this.cnxTunnelPath.setText(string2);
boolean bl2 = bl = string2.length() > 0;
if (bl) {
this.dropDown.setSelectedIndex(this.tunnelSchemeIndex);
}
this.tunnelLabel.setVisible(bl);
this.cnxTunnelPath.setVisible(bl);
this.tunnelLabel.relayout();
this.cnxTunnelPath.relayout();
if (context.getFacet("MruControllerSelect") == null && this.bodyField != null && this.bodyField.getText() != null && this.bodyField.getText().length() != 0) {
this.portEditableOnReadonly = true;
this.setReadonly(true);
}
}
protected BObject doSaveValue(BObject bObject, Context context) {
String string;
StringBuffer stringBuffer = new StringBuffer();
String string2 = this.bodyField.getText();
if (null != string2 && !string2.equals("")) {
stringBuffer.append(string2);
}
boolean bl = false;
String string3 = this.port.getText();
int n = Integer.parseInt(string3);
if (n != this.getDefaultPort()) {
stringBuffer.append('|').append(this.getDefaultOrdScheme()).append(':').append(string3);
bl = true;
}
if ((string = this.cnxTunnelPath.getText()) != null && string.length() > 0) {
if (IPAddressUtil.isIpv6Address((String)string)) {
string = "[" + string + "]";
}
if (!string.startsWith("/")) {
string = "/" + string;
}
if (!bl) {
stringBuffer.append('|').append(this.getDefaultOrdScheme()).append(":");
}
stringBuffer.append(string);
}
BOrd bOrd = BOrd.make((String)(this.hostScheme + ":" + stringBuffer.toString()));
if (this.autoSaveHistory) {
this.saveHistory(bOrd);
}
return bOrd;
}
public void doDropDownModified() {
super.doDropDownModified();
boolean bl = this.dropDown.getSelectedItem() instanceof BHostOrdFE.PlatformTunnelScheme;
if (bl) {
this.port.setText(String.valueOf(this.getDefaultTunnelPort()));
} else {
this.port.setText(Integer.toString(this.getDefaultPort()));
}
this.tunnelLabel.setVisible(bl);
this.cnxTunnelPath.setVisible(bl);
this.tunnelLabel.relayout();
this.cnxTunnelPath.relayout();
}
protected int getDefaultPort() {
return 3011;
}
protected int getDefaultTunnelPort() {
return 80;
}
protected String getDefaultOrdScheme() {
return "platform";
}
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:
* com.tridium.workbench.nav.BSessionAgent
* javax.baja.naming.BHost
* javax.baja.naming.BISession
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.util.UiLexicon
* javax.baja.xml.XElem
*/
package com.tridium.platform.ui;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.workbench.nav.BSessionAgent;
import javax.baja.naming.BHost;
import javax.baja.naming.BISession;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.util.UiLexicon;
import javax.baja.xml.XElem;
public class BDaemonTunnelSessionAgent
extends BSessionAgent {
public static final BDaemonTunnelSessionAgent INSTANCE = new BDaemonTunnelSessionAgent();
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BDaemonTunnelSessionAgent == null ? (class$com$tridium$platform$ui$BDaemonTunnelSessionAgent = BDaemonTunnelSessionAgent.class$("com.tridium.platform.ui.BDaemonTunnelSessionAgent")) : class$com$tridium$platform$ui$BDaemonTunnelSessionAgent));
static UiLexicon lex = new UiLexicon(TYPE.getModule());
static String[] defaultTunnelAuthorities = null;
static /* synthetic */ Class class$com$tridium$platform$ui$BDaemonTunnelSessionAgent;
public Type getType() {
return TYPE;
}
public void pickle(BISession bISession, XElem xElem) {
BDaemonSession bDaemonSession = (BDaemonSession)bISession;
xElem.addAttr("port", "" + bDaemonSession.getPort());
String[] stringArray = bDaemonSession.getTunnelAuthorities();
int n = 0;
if (stringArray != null) {
n = stringArray.length;
}
xElem.addAttr("tunnelLen", "" + n);
for (int i = 0; i < n && stringArray != null; ++i) {
xElem.addAttr("tunnelAuthority" + i, stringArray[i]);
}
}
public BISession unpickle(BHost bHost, XElem xElem) {
int n = xElem.geti("port", 3011);
int n2 = xElem.geti("tunnelLen", 0);
String[] stringArray = null;
if (n2 > 0) {
stringArray = new String[n2];
for (int i = 0; i < n2; ++i) {
stringArray[i] = xElem.get("tunnelAuthority" + i, null);
}
}
return BDaemonSession.make(bHost, n, stringArray);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,100 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.AgentFilter
* javax.baja.agent.AgentList
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.workbench.view.BWbComponentView
* javax.baja.workbench.view.BWbView
*/
package com.tridium.platform.ui;
import com.tridium.platform.BPlatformServiceContainer;
import com.tridium.platform.BSystemPlatformService;
import javax.baja.agent.AgentFilter;
import javax.baja.agent.AgentList;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
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.BWidget;
import javax.baja.workbench.view.BWbComponentView;
import javax.baja.workbench.view.BWbView;
public class BPlatformServiceContainerPlugin
extends BWbComponentView {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BPlatformServiceContainerPlugin == null ? (class$com$tridium$platform$ui$BPlatformServiceContainerPlugin = BPlatformServiceContainerPlugin.class$("com.tridium.platform.ui.BPlatformServiceContainerPlugin")) : class$com$tridium$platform$ui$BPlatformServiceContainerPlugin));
private BWbView view = null;
static /* synthetic */ Class class$com$tridium$platform$ui$BPlatformServiceContainerPlugin;
static /* synthetic */ Class class$com$tridium$platform$BSystemPlatformService;
public Type getType() {
return TYPE;
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BPlatformServiceContainer bPlatformServiceContainer = (BPlatformServiceContainer)bObject;
this.registerForComponentEvents(bPlatformServiceContainer, 5);
BSystemPlatformService[] bSystemPlatformServiceArray = (BSystemPlatformService[])bPlatformServiceContainer.getChildren(class$com$tridium$platform$BSystemPlatformService == null ? (class$com$tridium$platform$BSystemPlatformService = BPlatformServiceContainerPlugin.class$("com.tridium.platform.BSystemPlatformService")) : class$com$tridium$platform$BSystemPlatformService);
if (bSystemPlatformServiceArray.length == 0) {
AgentList agentList = bObject.getAgents(context).filter(AgentFilter.is((Type)BWbView.TYPE));
agentList.remove(this.getType().getTypeInfo().getAgentInfo());
this.view = (BWbView)agentList.getDefault().getInstance();
this.setContent((BWidget)this.view);
this.view.loadValue(bObject, context);
this.view.activated();
} else {
this.view = (BWbView)bSystemPlatformServiceArray[0].getAgents(context).filter(AgentFilter.is((Type)BWbView.TYPE)).getDefault().getInstance();
this.setContent((BWidget)this.view);
this.view.loadValue((BObject)bSystemPlatformServiceArray[0], context);
this.view.activated();
this.linkTo((BComponent)this.view, (Slot)BWbView.pluginModified, (Slot)setModified);
}
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
this.view.saveValue(context);
return bObject;
}
public final void activated() {
super.activated();
if (this.view != null) {
this.view.activated();
}
}
public final void deactivated() {
super.deactivated();
if (this.view != null) {
this.view.deactivated();
}
}
public void handleComponentEvent(BComponentEvent bComponentEvent) {
if (this.view != null && this.view instanceof BWbComponentView) {
((BWbComponentView)this.view).handleComponentEvent(bComponentEvent);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,45 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.propsheet.BPropertySheet
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.ui;
import com.tridium.platform.BPlatformService;
import com.tridium.workbench.propsheet.BPropertySheet;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public class BPlatformServiceProperties
extends BPropertySheet {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BPlatformServiceProperties == null ? (class$com$tridium$platform$ui$BPlatformServiceProperties = BPlatformServiceProperties.class$("com.tridium.platform.ui.BPlatformServiceProperties")) : class$com$tridium$platform$ui$BPlatformServiceProperties));
static /* synthetic */ Class class$com$tridium$platform$ui$BPlatformServiceProperties;
public Type getType() {
return TYPE;
}
public BObject doSaveValue(BObject bObject, Context context) throws Exception {
BPlatformService bPlatformService = (BPlatformService)bObject;
super.doSaveValue((BObject)bPlatformService, context);
bPlatformService.savePlatformServiceProperties();
return bPlatformService;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,67 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.AgentFilter
* javax.baja.agent.AgentInfo
* javax.baja.agent.AgentList
* javax.baja.naming.BISession
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BMenu
* javax.baja.ui.BWidget
* javax.baja.workbench.nav.menu.BNavMenuAgent
*/
package com.tridium.platform.ui;
import com.tridium.platform.BSessionNavNode;
import javax.baja.agent.AgentFilter;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.AgentList;
import javax.baja.naming.BISession;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BMenu;
import javax.baja.ui.BWidget;
import javax.baja.workbench.nav.menu.BNavMenuAgent;
public class BSessionNavNodeMenuAgent
extends BNavMenuAgent {
public static final BSessionNavNodeMenuAgent INSTANCE = new BSessionNavNodeMenuAgent();
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BSessionNavNodeMenuAgent == null ? (class$com$tridium$platform$ui$BSessionNavNodeMenuAgent = BSessionNavNodeMenuAgent.class$("com.tridium.platform.ui.BSessionNavNodeMenuAgent")) : class$com$tridium$platform$ui$BSessionNavNodeMenuAgent));
private static AgentFilter agentFilter = AgentFilter.is((Type)TYPE);
static /* synthetic */ Class class$com$tridium$platform$ui$BSessionNavNodeMenuAgent;
public Type getType() {
return TYPE;
}
protected final BMenu doMakeMenu(BWidget bWidget, BObject bObject, Context context) {
BSessionNavNode bSessionNavNode = (BSessionNavNode)bObject;
AgentList agentList = Sys.getRegistry().getAgents(bSessionNavNode.getViewType().getTypeInfo()).filter(agentFilter);
if (agentList.size() == 0) {
return null;
}
AgentInfo agentInfo = agentList.getDefault();
BSessionNavNodeMenuAgent bSessionNavNodeMenuAgent = (BSessionNavNodeMenuAgent)agentInfo.getInstance();
return bSessionNavNodeMenuAgent.makeSessionMenu(bWidget, bSessionNavNode.getNavSession());
}
protected BMenu makeSessionMenu(BWidget bWidget, BISession bISession) {
return null;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,307 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* com.tridium.workbench.fieldeditors.BDateFE
* javax.baja.data.BIDataValue
* javax.baja.gx.BBrush
* javax.baja.gx.BInsets
* javax.baja.sys.Action
* javax.baja.sys.BAbsTime
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BFacets
* javax.baja.sys.BMonth
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.timezone.BTimeZone
* javax.baja.ui.BBorder
* javax.baja.ui.BDialog
* javax.baja.ui.BListDropDown
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.enums.BValign
* javax.baja.ui.list.ListModel
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BScrollPane
* javax.baja.util.LexiconText
* javax.baja.workbench.BWbPlugin
* javax.baja.workbench.fieldeditor.BWbFieldEditor
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui;
import com.tridium.platform.BPlatformServiceContainer;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.platform.win32.BSystemPlatformServiceNxs;
import com.tridium.platform.win32.BSystemPlatformServiceNxtFlash;
import com.tridium.ui.theme.Theme;
import com.tridium.workbench.fieldeditors.BDateFE;
import javax.baja.data.BIDataValue;
import javax.baja.gx.BBrush;
import javax.baja.gx.BInsets;
import javax.baja.sys.Action;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BMonth;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.timezone.BTimeZone;
import javax.baja.ui.BBorder;
import javax.baja.ui.BDialog;
import javax.baja.ui.BListDropDown;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.enums.BValign;
import javax.baja.ui.list.ListModel;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.util.LexiconText;
import javax.baja.workbench.BWbPlugin;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
import javax.baja.workbench.view.BWbComponentView;
public class BSystemDateTimeEditor
extends BWbComponentView {
public static final Action timeModified = BSystemDateTimeEditor.newAction((int)4, null);
public static final Action timeZoneModified = BSystemDateTimeEditor.newAction((int)4, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BSystemDateTimeEditor == null ? (class$com$tridium$platform$ui$BSystemDateTimeEditor = BSystemDateTimeEditor.class$("com.tridium.platform.ui.BSystemDateTimeEditor")) : class$com$tridium$platform$ui$BSystemDateTimeEditor));
protected BGridPane ledgerPane;
private BButtonPane buttonPane;
private BListDropDown timeZoneDropDown;
private BWbFieldEditor timeEditor;
private BDateFE dateEditor;
private boolean isTimeModified = false;
private boolean isTimeZoneModified = false;
protected boolean saving = false;
protected boolean loading = false;
protected boolean tzRequiresReboot = false;
protected boolean restartEnabled = false;
private boolean restartFieldDirty = false;
private boolean rebootFieldDirty = false;
private BSystemPlatformService systemPlatformService = null;
private static final BFacets HOUR_MINUTE = BFacets.make((String[])new String[]{"timeFormat", "showDate", "showTime", "showSeconds"}, (BIDataValue[])new BIDataValue[]{BString.make((String)"HH:mm"), BBoolean.FALSE, BBoolean.TRUE, BBoolean.FALSE});
static /* synthetic */ Class class$com$tridium$platform$ui$BSystemDateTimeEditor;
static /* synthetic */ Class class$com$tridium$platform$BSystemPlatformService;
static /* synthetic */ Class class$javax$baja$timezone$BTimeZone;
public void timeModified() {
this.invoke(timeModified, null, null);
}
public void timeZoneModified() {
this.invoke(timeZoneModified, null, null);
}
public Type getType() {
return TYPE;
}
public BSystemDateTimeEditor() {
this.autoRegisterForComponentEvents = false;
this.ledgerPane = new BGridPane(2);
this.ledgerPane.setHalign(BHalign.left);
this.ledgerPane.setValign(BValign.top);
this.ledgerPane.setColumnGap(10.0);
this.ledgerPane.setRowGap(6.0);
this.ledgerPane.setColorRows(true);
this.timeEditor = BWbFieldEditor.makeFor((BObject)BAbsTime.DEFAULT, (Context)HOUR_MINUTE);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.systemTime"), (BWidget)this.timeEditor);
this.dateEditor = new BDateFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.systemDate"), (BWidget)this.dateEditor);
this.timeZoneDropDown = new BListDropDown();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.systemTimeZone"), (BWidget)this.timeZoneDropDown);
this.timeZoneDropDown.getList().setMultipleSelection(false);
this.buttonPane = new BButtonPane();
BBrush bBrush = Theme.scrollPane().getControlBackground();
BScrollPane bScrollPane = new BScrollPane((BWidget)new BBorderPane((BWidget)this.ledgerPane));
bScrollPane.setViewportBackground(bBrush);
this.linkTo(null, (BComponent)this.timeZoneDropDown, (Slot)BListDropDown.valueModified, (Slot)timeZoneModified);
this.linkTo(null, (BComponent)this.timeEditor, (Slot)BWbPlugin.pluginModified, (Slot)timeModified);
this.linkTo(null, (BComponent)this.dateEditor, (Slot)BWbPlugin.pluginModified, (Slot)timeModified);
this.setContent((BWidget)new BEdgePane(null, (BWidget)new BBorderPane((BWidget)this.buttonPane, 5.0, 5.0, 0.0, 5.0), null, null, (BWidget)new BBorderPane((BWidget)bScrollPane, BBorder.inset, BInsets.DEFAULT)));
}
public BSystemPlatformService getSystemPlatformService() {
return this.systemPlatformService;
}
protected void loadTimeEditors(long l, BTimeZone bTimeZone, Context context) {
Context context2 = context == null ? new BasicContext() : context;
BAbsTime bAbsTime = BAbsTime.make((long)l, (BTimeZone)bTimeZone);
BasicContext basicContext = new BasicContext(context2, BFacets.make((BFacets)HOUR_MINUTE, (String)"TimeZone", (BIDataValue)bTimeZone));
this.timeEditor.loadValue((BObject)bAbsTime, (Context)basicContext);
basicContext = new BasicContext(context2, BFacets.make((String)"TimeZone", (BIDataValue)bTimeZone));
this.dateEditor.loadValue((BObject)bAbsTime, (Context)basicContext);
this.timeEditor.setReadonly(this.systemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
this.dateEditor.setReadonly(this.systemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
}
protected void doLoadValue(BObject bObject, Context context) {
Context context2 = context == null ? new BasicContext() : context;
boolean bl = this.loading;
this.loading = true;
if (bObject instanceof BSystemPlatformService) {
this.systemPlatformService = (BSystemPlatformService)bObject;
} else if (bObject instanceof BPlatformServiceContainer) {
this.systemPlatformService = (BSystemPlatformService)((BPlatformServiceContainer)bObject).getChildren(class$com$tridium$platform$BSystemPlatformService == null ? (class$com$tridium$platform$BSystemPlatformService = BSystemDateTimeEditor.class$("com.tridium.platform.BSystemPlatformService")) : class$com$tridium$platform$BSystemPlatformService)[0];
} else {
throw new ClassCastException();
}
this.systemPlatformService.poll();
this.registerForComponentEvents(this.systemPlatformService, 4);
this.loadTimeEditors(this.systemPlatformService.getSystemTime().getMillis(), this.systemPlatformService.getTimeZone(), context2);
ZoneListModel zoneListModel = new ZoneListModel(this.systemPlatformService.getAllTimeZones());
this.timeZoneDropDown.getList().setModel((ListModel)zoneListModel);
this.timeZoneDropDown.setSelectedItem((Object)this.systemPlatformService.getTimeZone());
this.isTimeModified = false;
this.isTimeZoneModified = false;
this.restartEnabled = this.systemPlatformService.getAllowStationRestart();
this.tzRequiresReboot = this.systemPlatformService instanceof BSystemPlatformServiceQnx || this.systemPlatformService instanceof BSystemPlatformServiceNxs || this.systemPlatformService instanceof BSystemPlatformServiceNxtFlash;
this.buttonPane.removeAll();
this.buttonPane.addWorkbenchButtons((BWidget)this);
this.getContent().relayout();
this.loading = bl;
}
protected final BObject doSaveValue(BObject bObject, Context context) throws Exception {
this.saving = true;
if (bObject instanceof BSystemPlatformService) {
this.systemPlatformService = (BSystemPlatformService)bObject;
} else if (bObject instanceof BPlatformServiceContainer) {
this.systemPlatformService = (BSystemPlatformService)((BPlatformServiceContainer)bObject).getChildren(class$com$tridium$platform$BSystemPlatformService == null ? (class$com$tridium$platform$BSystemPlatformService = BSystemDateTimeEditor.class$("com.tridium.platform.BSystemPlatformService")) : class$com$tridium$platform$BSystemPlatformService)[0];
} else {
throw new ClassCastException();
}
if (this.isTimeModified || this.isTimeZoneModified) {
BAbsTime bAbsTime = (BAbsTime)this.dateEditor.saveValue();
BAbsTime bAbsTime2 = (BAbsTime)this.timeEditor.saveValue();
BAbsTime bAbsTime3 = BAbsTime.make((int)bAbsTime.getYear(), (BMonth)bAbsTime.getMonth(), (int)bAbsTime.getDay(), (int)bAbsTime2.getHour(), (int)bAbsTime2.getMinute(), (int)0, (int)0, (BTimeZone)((BTimeZone)this.timeZoneDropDown.getSelectedItem()));
this.systemPlatformService.set(BSystemPlatformService.systemTime, (BValue)bAbsTime3, context);
this.isTimeModified = false;
}
if (this.isTimeZoneModified) {
this.systemPlatformService.setTimeZone((BTimeZone)this.timeZoneDropDown.getSelectedItem());
this.isTimeZoneModified = false;
}
this.systemPlatformService.savePlatformServiceProperties();
if (this.rebootFieldDirty) {
if (this.systemPlatformService.getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
if (4 == BDialog.confirm((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.rebootNow.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.rebootNow.message"))) {
this.systemPlatformService.reboot();
}
} else {
BDialog.message((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.rebootRequired.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.rebootRequired.message"));
}
} else if (this.restartFieldDirty) {
if (this.systemPlatformService.getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
if (4 == BDialog.confirm((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.restartNow.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.restartNow.message"))) {
this.systemPlatformService.restartStation();
}
} else {
BDialog.message((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.restartRequired.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.restartRequired.message"));
}
}
this.rebootFieldDirty = false;
this.restartFieldDirty = false;
this.saving = false;
return bObject;
}
public void handleComponentEvent(BComponentEvent bComponentEvent) {
if (this.saving || !bComponentEvent.getSlot().isProperty()) {
return;
}
if (bComponentEvent.getSourceComponent() instanceof BSystemPlatformService) {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
BValue bValue = bSystemPlatformService.get(property);
if (property == BSystemPlatformService.systemTime) {
if (!this.isTimeModified) {
this.loadTimeEditors(((BAbsTime)bValue).getMillis(), bSystemPlatformService.getTimeZone(), this.getCurrentContext());
}
} else if (property == BSystemPlatformService.timeZone && !this.isTimeZoneModified) {
this.timeZoneDropDown.setSelectedItem((Object)bSystemPlatformService.getTimeZone());
}
}
}
public void doTimeModified() {
if (!this.isModifiedStateLocked()) {
this.isTimeModified = true;
this.invoke(setModified, null, null);
}
}
public void doTimeZoneModified() {
if (!this.isModifiedStateLocked()) {
this.isTimeZoneModified = true;
if (this.tzRequiresReboot || !this.restartEnabled) {
this.rebootFieldDirty = true;
} else {
this.restartFieldDirty = true;
}
this.invoke(setModified, null, null);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private static class ZoneListModel
extends ListModel {
BTimeZone[] items;
public ZoneListModel(BVector bVector) {
this.items = (BTimeZone[])bVector.getChildren(class$javax$baja$timezone$BTimeZone == null ? (class$javax$baja$timezone$BTimeZone = BSystemDateTimeEditor.class$("javax.baja.timezone.BTimeZone")) : class$javax$baja$timezone$BTimeZone);
}
public int getItemCount() {
return this.items.length;
}
public BTimeZone getTimeZone(int n) {
return this.items[n];
}
public Object getItem(int n) {
return this.getTimeZone(n);
}
}
}
@@ -0,0 +1,168 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BDouble
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BLabel
* javax.baja.ui.BListDropDown
* javax.baja.ui.BNullWidget
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BGridPane
* javax.baja.util.Lexicon
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui;
import com.tridium.platform.ewf.BEwfOverlayAttributes;
import com.tridium.platform.ui.BSystemPlatformServicePlugin;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.platform.win32.BSystemPlatformServiceEwfFlash;
import com.tridium.platform.win32.BSystemPlatformServiceNxs;
import com.tridium.platform.win32.BSystemPlatformServiceNxtFlash;
import java.text.DecimalFormat;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BDouble;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BLabel;
import javax.baja.ui.BListDropDown;
import javax.baja.ui.BNullWidget;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BGridPane;
import javax.baja.util.Lexicon;
import javax.baja.util.LexiconText;
public class BSystemPlatformServiceNxsPlugin
extends BSystemPlatformServicePlugin {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BSystemPlatformServiceNxsPlugin == null ? (class$com$tridium$platform$ui$BSystemPlatformServiceNxsPlugin = BSystemPlatformServiceNxsPlugin.class$("com.tridium.platform.ui.BSystemPlatformServiceNxsPlugin")) : class$com$tridium$platform$ui$BSystemPlatformServiceNxsPlugin));
private BLabel osOverlayStateLabel;
private BLabel osOverlayCommandLabel;
private BLabel osOverlayRamUsageLabel;
private BLabel historyOverlayStateLabel;
private BLabel historyOverlayCommandLabel;
private BLabel historyOverlayRamUsageLabel;
public static Lexicon lex = Lexicon.make((String)"platform");
public static DecimalFormat mbFormat = new DecimalFormat(lex.getText("Formats.mb"));
static /* synthetic */ Class class$com$tridium$platform$ui$BSystemPlatformServiceNxsPlugin;
public Type getType() {
return TYPE;
}
public BSystemPlatformServiceNxsPlugin() {
BGridPane bGridPane = new BGridPane(4);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.add(null, (BValue)new BNullWidget());
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.nxs.overlayState"), true));
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.nxs.overlayCommand"), true));
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.nxs.overlayRamUsage"), true));
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.nxs.osOverlay"), false));
this.osOverlayStateLabel = new BLabel();
bGridPane.add(null, (BValue)this.osOverlayStateLabel);
this.osOverlayCommandLabel = new BLabel();
bGridPane.add(null, (BValue)this.osOverlayCommandLabel);
this.osOverlayRamUsageLabel = new BLabel();
bGridPane.add(null, (BValue)this.osOverlayRamUsageLabel);
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.nxs.historyOverlay"), false));
this.historyOverlayStateLabel = new BLabel();
bGridPane.add(null, (BValue)this.historyOverlayStateLabel);
this.historyOverlayCommandLabel = new BLabel();
bGridPane.add(null, (BValue)this.historyOverlayCommandLabel);
this.historyOverlayRamUsageLabel = new BLabel();
bGridPane.add(null, (BValue)this.historyOverlayRamUsageLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.nxs.overlays"), (BWidget)bGridPane);
this.linkTo(null, (BComponent)this.timeZoneDropDown, (Slot)BListDropDown.valueModified, (Slot)markRebootFieldDirty);
}
protected final void doLoadValue(BObject bObject, Context context) {
Context context2 = context == null ? new BasicContext() : context;
this.loading = true;
BSystemPlatformServiceNxs bSystemPlatformServiceNxs = (BSystemPlatformServiceNxs)bObject;
if (bObject instanceof BSystemPlatformServiceNxtFlash) {
bSystemPlatformServiceNxs = (BSystemPlatformServiceNxtFlash)bObject;
}
if (bObject instanceof BSystemPlatformServiceEwfFlash) {
bSystemPlatformServiceNxs = (BSystemPlatformServiceEwfFlash)bObject;
}
bSystemPlatformServiceNxs.lease(4);
this.osOverlayStateLabel.setText(bSystemPlatformServiceNxs.getOsOverlayState().toString(context2));
this.osOverlayCommandLabel.setText(bSystemPlatformServiceNxs.getOsOverlayCommand().toString(context2));
this.osOverlayRamUsageLabel.setText(mbFormat.format(bSystemPlatformServiceNxs.getOsOverlayRamUsage()));
this.historyOverlayStateLabel.setText(bSystemPlatformServiceNxs.getHistoryOverlayState().toString(context2));
this.historyOverlayCommandLabel.setText(bSystemPlatformServiceNxs.getHistoryOverlayCommand().toString(context2));
this.historyOverlayRamUsageLabel.setText(mbFormat.format(bSystemPlatformServiceNxs.getHistoryOverlayRamUsage()));
super.doLoadValue(bObject, context2);
this.loading = false;
}
public final void handleComponentEvent(BComponentEvent bComponentEvent) {
if (this.loading || !bComponentEvent.getSlot().isProperty()) {
return;
}
boolean bl = false;
if (bComponentEvent.getSourceComponent() instanceof BEwfOverlayAttributes) {
BEwfOverlayAttributes bEwfOverlayAttributes = (BEwfOverlayAttributes)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
BValue bValue = bEwfOverlayAttributes.get(property);
Property property2 = bEwfOverlayAttributes.getPropertyInParent();
if (property2 == BSystemPlatformServiceNxs.osOverlayAttributes || property2 == BSystemPlatformServiceNxtFlash.osOverlayAttributes || property2 == BSystemPlatformServiceEwfFlash.osOverlayAttributes) {
if (property == BEwfOverlayAttributes.bootCommand) {
this.osOverlayCommandLabel.setText(bValue.toString());
bl = true;
} else if (property == BEwfOverlayAttributes.enableState) {
this.osOverlayStateLabel.setText(bValue.toString());
bl = true;
} else if (property == BEwfOverlayAttributes.ramUsage) {
this.osOverlayRamUsageLabel.setText(mbFormat.format(((BDouble)bValue).getDouble()));
bl = true;
}
} else if (property2 == BSystemPlatformServiceNxs.historyOverlayAttributes || property2 == BSystemPlatformServiceNxtFlash.historyOverlayAttributes || property2 == BSystemPlatformServiceEwfFlash.historyOverlayAttributes) {
if (property == BEwfOverlayAttributes.bootCommand) {
this.historyOverlayCommandLabel.setText(bValue.toString());
bl = true;
} else if (property == BEwfOverlayAttributes.enableState) {
this.historyOverlayStateLabel.setText(bValue.toString());
bl = true;
} else if (property == BEwfOverlayAttributes.ramUsage) {
this.historyOverlayRamUsageLabel.setText(mbFormat.format(((BDouble)bValue).getDouble()));
bl = true;
}
}
if (bl) {
this.getContent().relayout();
}
}
if (!bl) {
super.handleComponentEvent(bComponentEvent);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,656 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* com.tridium.workbench.fieldeditors.BDateFE
* com.tridium.workbench.fieldeditors.BIntegerFE
* javax.baja.data.BIDataValue
* javax.baja.gx.BBrush
* javax.baja.gx.BInsets
* javax.baja.naming.BOrd
* javax.baja.naming.SlotPath
* javax.baja.sys.Action
* javax.baja.sys.BAbsTime
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BMonth
* javax.baja.sys.BObject
* javax.baja.sys.BRelTime
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.timezone.BTimeZone
* javax.baja.ui.BBorder
* javax.baja.ui.BCheckBox
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BListDropDown
* javax.baja.ui.BNullWidget
* javax.baja.ui.BWidget
* javax.baja.ui.CommandArtifact
* javax.baja.ui.ToggleCommand
* javax.baja.ui.enums.BHalign
* javax.baja.ui.enums.BValign
* javax.baja.ui.list.ListModel
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BScrollPane
* javax.baja.util.LexiconText
* javax.baja.workbench.BWbPlugin
* javax.baja.workbench.fieldeditor.BWbFieldEditor
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui;
import com.tridium.platform.BEngineWatchdogPolicy;
import com.tridium.platform.BFilesystemAttributes;
import com.tridium.platform.BPlatform;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.platform.win32.BSystemPlatformServiceNxs;
import com.tridium.platform.win32.BSystemPlatformServiceNxtFlash;
import com.tridium.ui.theme.Theme;
import com.tridium.workbench.fieldeditors.BDateFE;
import com.tridium.workbench.fieldeditors.BIntegerFE;
import javax.baja.data.BIDataValue;
import javax.baja.gx.BBrush;
import javax.baja.gx.BInsets;
import javax.baja.naming.BOrd;
import javax.baja.naming.SlotPath;
import javax.baja.sys.Action;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BMonth;
import javax.baja.sys.BObject;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.timezone.BTimeZone;
import javax.baja.ui.BBorder;
import javax.baja.ui.BCheckBox;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BListDropDown;
import javax.baja.ui.BNullWidget;
import javax.baja.ui.BWidget;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.ToggleCommand;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.enums.BValign;
import javax.baja.ui.list.ListModel;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.util.LexiconText;
import javax.baja.workbench.BWbPlugin;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
import javax.baja.workbench.view.BWbComponentView;
public class BSystemPlatformServicePlugin
extends BWbComponentView {
public static final Action timeModified = BSystemPlatformServicePlugin.newAction((int)4, null);
public static final Action timeZoneModified = BSystemPlatformServicePlugin.newAction((int)4, null);
public static final Action localeModified = BSystemPlatformServicePlugin.newAction((int)4, null);
public static final Action markRebootFieldDirty = BSystemPlatformServicePlugin.newAction((int)4, null);
public static final Action markRestartFieldDirty = BSystemPlatformServicePlugin.newAction((int)4, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BSystemPlatformServicePlugin == null ? (class$com$tridium$platform$ui$BSystemPlatformServicePlugin = BSystemPlatformServicePlugin.class$("com.tridium.platform.ui.BSystemPlatformServicePlugin")) : class$com$tridium$platform$ui$BSystemPlatformServicePlugin));
protected ToggleCommand toggleAutoSaveCommand;
protected BGridPane ledgerPane;
protected BGridPane filesystemPane;
protected BButtonPane buttonPane;
protected BLabel javaVmNameLabel;
protected BLabel javaVmVendorLabel;
protected BLabel javaVmVersionLabel;
protected BLabel osArchLabel;
protected BLabel osNameLabel;
protected BLabel modelLabel;
protected BLabel hostLabel;
protected BLabel niagaraVersionLabel;
protected BLabel fipsStatusLabel;
protected BWbFieldEditor localeEditor;
protected BLabel osVersionLabel;
protected BLabel hostIdLabel;
protected BLabel nameLabel;
protected BLabel numCpusLabel;
protected BLabel currentCpuLabel;
protected BLabel overallCpuLabel;
protected BLabel daemonPortLabel;
protected BLabel daemonSSLPortLabel;
protected BLabel freePhysicalMemoryLabel;
protected BLabel totalPhysicalMemoryLabel;
protected BWbFieldEditor watchdogPolicyEditor;
protected BWbFieldEditor watchdogTimeoutEditor;
protected BWbFieldEditor stationAutoSaveFrequencyEditor;
protected BIntegerFE stationSaveBackupCountEditor;
protected BListDropDown timeZoneDropDown;
protected BWbFieldEditor timeEditor;
protected BDateFE dateEditor;
protected boolean isTimeModified = false;
protected boolean isLocaleModified = false;
protected boolean isTimeZoneModified = false;
protected boolean tzRequiresReboot = false;
protected boolean restartEnabled = false;
protected boolean saving = false;
protected boolean loading = false;
protected boolean rebootFieldDirty = false;
protected boolean restartFieldDirty = false;
protected boolean fipsLicensed = false;
protected boolean fipsInstalled = false;
private static final BFacets HOUR_MINUTE = BFacets.make((String[])new String[]{"timeFormat", "showDate", "showTime", "showSeconds"}, (BIDataValue[])new BIDataValue[]{BString.make((String)"HH:mm"), BBoolean.FALSE, BBoolean.TRUE, BBoolean.FALSE});
static /* synthetic */ Class class$com$tridium$platform$ui$BSystemPlatformServicePlugin;
static /* synthetic */ Class class$javax$baja$timezone$BTimeZone;
public void timeModified() {
this.invoke(timeModified, null, null);
}
public void timeZoneModified() {
this.invoke(timeZoneModified, null, null);
}
public void localeModified() {
this.invoke(localeModified, null, null);
}
public void markRebootFieldDirty() {
this.invoke(markRebootFieldDirty, null, null);
}
public void markRestartFieldDirty() {
this.invoke(markRestartFieldDirty, null, null);
}
public Type getType() {
return TYPE;
}
public BSystemPlatformServicePlugin() {
this.autoRegisterForComponentEvents = false;
this.ledgerPane = new BGridPane(2);
this.ledgerPane.setHalign(BHalign.left);
this.ledgerPane.setValign(BValign.top);
this.ledgerPane.setColumnGap(10.0);
this.ledgerPane.setRowGap(6.0);
this.ledgerPane.setColorRows(true);
this.nameLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.name"), (BWidget)this.nameLabel);
this.hostLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.host"), (BWidget)this.hostLabel);
this.modelLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.model"), (BWidget)this.modelLabel);
this.hostIdLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.hostId"), (BWidget)this.hostIdLabel);
this.niagaraVersionLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.niagaraVersion"), (BWidget)this.niagaraVersionLabel);
this.javaVmNameLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.javaVmName"), (BWidget)this.javaVmNameLabel);
this.javaVmVendorLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.javaVmVendor"), (BWidget)this.javaVmVendorLabel);
this.javaVmVersionLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.javaVmVersion"), (BWidget)this.javaVmVersionLabel);
this.osNameLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.osName"), (BWidget)this.osNameLabel);
this.osArchLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.osArch"), (BWidget)this.osArchLabel);
this.osVersionLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.osVersion"), (BWidget)this.osVersionLabel);
this.daemonPortLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.daemonPort"), (BWidget)this.daemonPortLabel);
this.daemonSSLPortLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.daemonSSLPort"), (BWidget)this.daemonSSLPortLabel);
this.localeEditor = BWbFieldEditor.makeFor((BObject)BString.DEFAULT);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.locale"), (BWidget)this.localeEditor);
this.timeEditor = BWbFieldEditor.makeFor((BObject)BAbsTime.DEFAULT, (Context)HOUR_MINUTE);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.systemTime"), (BWidget)this.timeEditor);
this.dateEditor = new BDateFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.systemDate"), (BWidget)this.dateEditor);
this.timeZoneDropDown = new BListDropDown();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.systemTimeZone"), (BWidget)this.timeZoneDropDown);
this.timeZoneDropDown.getList().setMultipleSelection(false);
this.watchdogPolicyEditor = BWbFieldEditor.makeFor((BObject)BEngineWatchdogPolicy.terminate);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.engineWatchdogPolicy"), (BWidget)this.watchdogPolicyEditor);
this.watchdogTimeoutEditor = BWbFieldEditor.makeFor((BObject)BRelTime.MINUTE, (Context)BSystemPlatformService.engineWatchdogTimeout.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.engineWatchdogTimeout"), (BWidget)this.watchdogTimeoutEditor);
this.toggleAutoSaveCommand = new ToggleAutoSaveEnabledCommand();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.isStationAutoSaveEnabled"), (BWidget)new BCheckBox(this.toggleAutoSaveCommand));
this.stationAutoSaveFrequencyEditor = BWbFieldEditor.makeFor((BObject)BRelTime.HOUR, (Context)BSystemPlatformService.stationAutoSaveFrequency.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.stationAutoSaveFrequency"), (BWidget)this.stationAutoSaveFrequencyEditor);
this.stationSaveBackupCountEditor = new BIntegerFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.stationSaveBackupCount"), (BWidget)this.stationSaveBackupCountEditor);
this.numCpusLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.numCpus"), (BWidget)this.numCpusLabel);
this.currentCpuLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.currentCpuUsage"), (BWidget)this.currentCpuLabel);
this.overallCpuLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.overallCpuUsage"), (BWidget)this.overallCpuLabel);
this.filesystemPane = new BGridPane(6);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.filesystem"), (BWidget)this.filesystemPane);
this.filesystemPane.setColumnAlign(BHalign.fill);
BGridPane bGridPane = new BGridPane(2);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.totalKb"), true, BHalign.center));
bGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.freeKb"), true, BHalign.center));
this.totalPhysicalMemoryLabel = new BLabel("", BHalign.right);
bGridPane.add(null, (BValue)this.totalPhysicalMemoryLabel);
this.freePhysicalMemoryLabel = new BLabel("", BHalign.right);
bGridPane.add(null, (BValue)this.freePhysicalMemoryLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.physicalMemory"), (BWidget)bGridPane);
this.buttonPane = new BButtonPane();
BBrush bBrush = Theme.scrollPane().getControlBackground();
BScrollPane bScrollPane = new BScrollPane((BWidget)new BBorderPane((BWidget)this.ledgerPane));
bScrollPane.setViewportBackground(bBrush);
this.linkTo(null, (BComponent)this.timeZoneDropDown, (Slot)BListDropDown.valueModified, (Slot)timeZoneModified);
this.linkTo(null, (BComponent)this.timeEditor, (Slot)BWbPlugin.pluginModified, (Slot)timeModified);
this.linkTo(null, (BComponent)this.dateEditor, (Slot)BWbPlugin.pluginModified, (Slot)timeModified);
this.linkTo(null, (BComponent)this.localeEditor, (Slot)BWbPlugin.pluginModified, (Slot)localeModified);
this.linkTo(null, (BComponent)this.watchdogPolicyEditor, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.watchdogTimeoutEditor, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.stationAutoSaveFrequencyEditor, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.stationSaveBackupCountEditor, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.setContent((BWidget)new BEdgePane(null, (BWidget)new BBorderPane((BWidget)this.buttonPane, 5.0, 5.0, 0.0, 5.0), null, null, (BWidget)new BBorderPane((BWidget)bScrollPane, BBorder.inset, BInsets.DEFAULT)));
}
public BSystemPlatformService getSystemPlatformService() {
return (BSystemPlatformService)this.getCurrentValue();
}
protected void loadTimeEditors(long l, BTimeZone bTimeZone, Context context) {
Context context2 = context == null ? new BasicContext() : context;
BAbsTime bAbsTime = BAbsTime.make((long)l, (BTimeZone)bTimeZone);
BasicContext basicContext = new BasicContext(context2, BFacets.make((BFacets)HOUR_MINUTE, (String)"TimeZone", (BIDataValue)bTimeZone));
this.timeEditor.loadValue((BObject)bAbsTime, (Context)basicContext);
basicContext = new BasicContext(context2, BFacets.make((String)"TimeZone", (BIDataValue)bTimeZone));
this.dateEditor.loadValue((BObject)bAbsTime, (Context)basicContext);
}
protected void doLoadValue(BObject bObject, Context context) {
Context context2 = context == null ? new BasicContext() : context;
boolean bl = this.loading;
this.loading = true;
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)bObject;
bSystemPlatformService.poll();
this.registerForComponentEvents(bSystemPlatformService, 4);
this.javaVmNameLabel.setText(bSystemPlatformService.getJavaVmName());
this.hostLabel.setText(BOrd.toHost((BObject)bSystemPlatformService).getNavDisplayName(null));
this.javaVmVendorLabel.setText(bSystemPlatformService.getJavaVmVendor());
this.javaVmVersionLabel.setText(bSystemPlatformService.getJavaVmVersion());
this.osArchLabel.setText(bSystemPlatformService.getOsArch());
this.modelLabel.setText(bSystemPlatformService.getModel());
this.osNameLabel.setText(bSystemPlatformService.getOsName());
this.niagaraVersionLabel.setText(bSystemPlatformService.getNiagaraVersion());
this.osVersionLabel.setText(bSystemPlatformService.getOsVersion());
this.hostIdLabel.setText(bSystemPlatformService.getHostId());
this.nameLabel.setText(bSystemPlatformService.getStationName());
String string = bSystemPlatformService.getFipsStatus();
if (string != null && !string.equals("")) {
this.fipsStatusLabel = new BLabel(string);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.fipsStatus"), (BWidget)this.fipsStatusLabel);
}
if (bSystemPlatformService.getLocalDaemonPort() > 0) {
this.daemonPortLabel.setText(String.valueOf(bSystemPlatformService.getLocalDaemonPort()));
} else {
this.daemonPortLabel.setText(this.getLexicon().getText("unknown"));
}
if (bSystemPlatformService.getLocalDaemonSslPort() > 0) {
this.daemonSSLPortLabel.setText(String.valueOf(bSystemPlatformService.getLocalDaemonSslPort()));
} else {
this.daemonSSLPortLabel.setText(this.getLexicon().getText("unknown"));
}
this.localeEditor.loadValue((BObject)BString.make((String)bSystemPlatformService.getLocale()), (Context)new BasicContext(context2, BSystemPlatformService.locale.getFacets()));
this.loadTimeEditors(bSystemPlatformService.getSystemTime().getMillis(), bSystemPlatformService.getTimeZone(), context2);
this.timeEditor.setReadonly(bSystemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
this.dateEditor.setReadonly(bSystemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
this.watchdogPolicyEditor.loadValue((BObject)bSystemPlatformService.getEngineWatchdogPolicy(), context2);
this.watchdogTimeoutEditor.loadValue((BObject)bSystemPlatformService.getEngineWatchdogTimeout(), (Context)new BasicContext(context2, BSystemPlatformService.engineWatchdogTimeout.getFacets()));
this.toggleAutoSaveCommand.setSelected(bSystemPlatformService.getIsStationAutoSaveEnabled());
this.stationAutoSaveFrequencyEditor.loadValue((BObject)bSystemPlatformService.getStationAutoSaveFrequency(), (Context)new BasicContext(context2, BSystemPlatformService.stationAutoSaveFrequency.getFacets()));
this.stationSaveBackupCountEditor.loadValue((BObject)BInteger.make((int)bSystemPlatformService.getStationSaveBackupCount()), context2);
this.stationAutoSaveFrequencyEditor.setEnabled(bSystemPlatformService.getIsStationAutoSaveEnabled());
this.stationSaveBackupCountEditor.setEnabled(bSystemPlatformService.getIsStationAutoSaveEnabled());
this.numCpusLabel.setText(String.valueOf(bSystemPlatformService.getNumCpus()));
int n = bSystemPlatformService.getCurrentCpuUsage();
if (n < 0) {
this.currentCpuLabel.setText(this.getLexicon().getText("labels.system.cpuUsage.unavailable"));
} else {
this.currentCpuLabel.setText(n + "%");
}
n = bSystemPlatformService.getOverallCpuUsage();
if (n < 0) {
this.overallCpuLabel.setText(this.getLexicon().getText("labels.system.cpuUsage.unavailable"));
} else {
this.overallCpuLabel.setText(n + "%");
}
this.freePhysicalMemoryLabel.setText(DaemonFileUtil.kbFormat.format(bSystemPlatformService.getFreePhysicalMemory()));
this.totalPhysicalMemoryLabel.setText(DaemonFileUtil.kbFormat.format(bSystemPlatformService.getTotalPhysicalMemory()));
this.filesystemPane.removeAll();
this.filesystemPane.add(null, (BValue)new BNullWidget());
this.filesystemPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.totalKb"), true, BHalign.center));
this.filesystemPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.freeKb"), true, BHalign.center));
this.filesystemPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.blockSize"), true, BHalign.center));
if (bSystemPlatformService instanceof BSystemPlatformServiceQnx) {
this.filesystemPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.currentFileCount"), true, BHalign.center));
this.filesystemPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.maxFileCount"), true, BHalign.center));
} else {
this.filesystemPane.add(null, (BValue)new BNullWidget());
this.filesystemPane.add(null, (BValue)new BNullWidget());
}
Object object = bSystemPlatformService.getFilesystemAttributes().loadSlots().getProperties();
while (object.next()) {
Property property = object.property();
this.filesystemPane.add(null, (BValue)new BLabel(SlotPath.unescape((String)property.getName())));
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)object.get();
this.filesystemPane.add(property.getName() + "total", (BValue)new BLabel(DaemonFileUtil.kbFormat.format(bFilesystemAttributes.getTotalSpace()), BHalign.right));
this.filesystemPane.add(property.getName() + "free", (BValue)new BLabel(DaemonFileUtil.kbFormat.format(bFilesystemAttributes.getFreeSpace()), BHalign.right));
this.filesystemPane.add(property.getName() + "block", (BValue)new BLabel(DaemonFileUtil.byteFormat.format(bFilesystemAttributes.getBlockSize()), BHalign.right));
if (bSystemPlatformService instanceof BSystemPlatformServiceQnx) {
String string2 = bFilesystemAttributes.getCurrentFileCount() < 0L ? this.getLexicon().getText("labels.system.fileCount.unavailable") : String.valueOf(bFilesystemAttributes.getCurrentFileCount());
String string3 = bFilesystemAttributes.getMaxFileCount() < 0L ? this.getLexicon().getText("labels.system.fileCount.unavailable") : String.valueOf(bFilesystemAttributes.getMaxFileCount());
this.filesystemPane.add(property.getName() + "currentFile", (BValue)new BLabel(string2, BHalign.right));
this.filesystemPane.add(property.getName() + "maxFile", (BValue)new BLabel(string3, BHalign.right));
continue;
}
this.filesystemPane.add(null, (BValue)new BNullWidget());
this.filesystemPane.add(null, (BValue)new BNullWidget());
}
object = new ZoneListModel(bSystemPlatformService.getStationTimeZones());
this.timeZoneDropDown.getList().setModel((ListModel)object);
this.timeZoneDropDown.setSelectedItem((Object)bSystemPlatformService.getTimeZone());
this.isTimeModified = false;
this.isTimeZoneModified = false;
this.restartEnabled = bSystemPlatformService.getAllowStationRestart();
this.tzRequiresReboot = bSystemPlatformService instanceof BSystemPlatformServiceQnx || bSystemPlatformService instanceof BSystemPlatformServiceNxs || bSystemPlatformService instanceof BSystemPlatformServiceNxtFlash;
this.buttonPane.removeAll();
this.buttonPane.addWorkbenchButtons((BWidget)this);
this.getContent().relayout();
this.loading = bl;
}
protected final BObject doSaveValue(BObject bObject, Context context) throws Exception {
this.saving = true;
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)bObject;
bSystemPlatformService.setEngineWatchdogPolicy((BEngineWatchdogPolicy)this.watchdogPolicyEditor.saveValue());
bSystemPlatformService.setEngineWatchdogTimeout((BRelTime)this.watchdogTimeoutEditor.saveValue());
bSystemPlatformService.setIsStationAutoSaveEnabled(this.toggleAutoSaveCommand.isSelected());
bSystemPlatformService.setStationAutoSaveFrequency((BRelTime)this.stationAutoSaveFrequencyEditor.saveValue());
bSystemPlatformService.setStationSaveBackupCount(((BInteger)this.stationSaveBackupCountEditor.saveValue()).getInt());
if (this.isLocaleModified) {
bSystemPlatformService.setLocale(((BString)this.localeEditor.saveValue()).toString());
this.isLocaleModified = false;
}
if (this.isTimeModified || this.isTimeZoneModified) {
BAbsTime bAbsTime = (BAbsTime)this.dateEditor.saveValue();
BAbsTime bAbsTime2 = (BAbsTime)this.timeEditor.saveValue();
BAbsTime bAbsTime3 = BAbsTime.make((int)bAbsTime.getYear(), (BMonth)bAbsTime.getMonth(), (int)bAbsTime.getDay(), (int)bAbsTime2.getHour(), (int)bAbsTime2.getMinute(), (int)0, (int)0, (BTimeZone)((BTimeZone)this.timeZoneDropDown.getSelectedItem()));
if (bSystemPlatformService.getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
bSystemPlatformService.set(BSystemPlatformService.systemTime, (BValue)bAbsTime3, context);
}
this.isTimeModified = false;
}
if (this.isTimeZoneModified) {
bSystemPlatformService.setTimeZone((BTimeZone)this.timeZoneDropDown.getSelectedItem());
this.isTimeZoneModified = false;
}
this.doSaveSystemPlatformServiceFields(bSystemPlatformService, context);
bSystemPlatformService.savePlatformServiceProperties();
if (this.rebootFieldDirty) {
if (bSystemPlatformService.getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
if (4 == BDialog.confirm((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.rebootNow.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.rebootNow.message"))) {
bSystemPlatformService.reboot();
}
} else {
BDialog.message((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.rebootRequired.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.rebootRequired.message"));
}
} else if (this.restartFieldDirty) {
if (bSystemPlatformService.getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
if (4 == BDialog.confirm((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.restartNow.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.restartNow.message"))) {
bSystemPlatformService.restartStation();
}
} else {
BDialog.message((BWidget)this, (String)this.getLexicon().getText("SystemPlatformServicePlugin.restartRequired.title"), (Object)this.getLexicon().getText("SystemPlatformServicePlugin.restartRequired.message"));
}
}
this.rebootFieldDirty = false;
this.restartFieldDirty = false;
this.saving = false;
return bObject;
}
protected void doSaveSystemPlatformServiceFields(BSystemPlatformService bSystemPlatformService, Context context) throws Exception {
}
public void handleComponentEvent(BComponentEvent bComponentEvent) {
if (this.saving || this.loading || bComponentEvent == null || bComponentEvent.getSlot() == null || !bComponentEvent.getSlot().isProperty()) {
return;
}
if (bComponentEvent.getSourceComponent() instanceof BSystemPlatformService) {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
BValue bValue = bSystemPlatformService.get(property);
if (property == BSystemPlatformService.javaVmName) {
this.javaVmNameLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.javaVmVendor) {
this.javaVmVendorLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.javaVmVersion) {
this.javaVmVersionLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.osArch) {
this.osArchLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.osName) {
this.osNameLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.osVersion) {
this.osVersionLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.hostId) {
this.hostIdLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.stationName) {
this.nameLabel.setText(bValue.toString());
} else if (property == BSystemPlatformService.locale) {
if (!this.isLocaleModified) {
this.localeEditor.loadValue((BObject)BString.make((String)bValue.toString()), (Context)new BasicContext((Context)bComponentEvent.getSlot().getFacets()));
}
} else if (property == BSystemPlatformService.systemTime) {
if (!this.isTimeModified) {
this.loadTimeEditors(((BAbsTime)bValue).getMillis(), bSystemPlatformService.getTimeZone(), this.getCurrentContext());
}
} else if (property == BSystemPlatformService.timeZone) {
if (!this.isTimeZoneModified) {
this.timeZoneDropDown.setSelectedItem((Object)bSystemPlatformService.getTimeZone());
}
} else if (property == BSystemPlatformService.engineWatchdogPolicy) {
this.watchdogPolicyEditor.loadValue((BObject)((BEngineWatchdogPolicy)bValue), (Context)new BasicContext((Context)bComponentEvent.getSlot().getFacets()));
} else if (property == BSystemPlatformService.engineWatchdogTimeout) {
this.watchdogTimeoutEditor.loadValue((BObject)((BRelTime)bValue), (Context)new BasicContext((Context)bComponentEvent.getSlot().getFacets()));
} else if (property == BSystemPlatformService.totalPhysicalMemory) {
this.totalPhysicalMemoryLabel.setText(DaemonFileUtil.kbFormat.format(bSystemPlatformService.getTotalPhysicalMemory()));
} else if (property == BSystemPlatformService.freePhysicalMemory) {
this.freePhysicalMemoryLabel.setText(DaemonFileUtil.kbFormat.format(bSystemPlatformService.getFreePhysicalMemory()));
} else if (property == BSystemPlatformService.isStationAutoSaveEnabled) {
this.lockModifiedState();
this.toggleAutoSaveCommand.setSelected(bSystemPlatformService.getIsStationAutoSaveEnabled());
this.unlockModifiedState();
} else if (property == BSystemPlatformService.stationAutoSaveFrequency || property == BSystemPlatformServiceQnx.stationAutoSaveFrequency) {
this.stationAutoSaveFrequencyEditor.loadValue((BObject)((BRelTime)bValue), (Context)new BasicContext((Context)bComponentEvent.getSlot().getFacets()));
} else if (property == BSystemPlatformService.stationSaveBackupCount || property == BSystemPlatformServiceQnx.stationSaveBackupCount) {
this.stationSaveBackupCountEditor.loadValue((BObject)BInteger.make((int)bSystemPlatformService.getStationSaveBackupCount()));
} else if (property == BSystemPlatformService.currentCpuUsage) {
int n = bSystemPlatformService.getCurrentCpuUsage();
if (n < 0) {
this.currentCpuLabel.setText(this.getLexicon().getText("labels.system.cpuUsage.unavailable"));
} else {
this.currentCpuLabel.setText(n + "%");
}
} else if (property == BSystemPlatformService.overallCpuUsage) {
int n = bSystemPlatformService.getOverallCpuUsage();
if (n < 0) {
this.overallCpuLabel.setText(this.getLexicon().getText("labels.system.cpuUsage.unavailable"));
} else {
this.overallCpuLabel.setText(n + "%");
}
} else if (property == BSystemPlatformService.localDaemonPort) {
if (bSystemPlatformService.getLocalDaemonPort() > 0) {
this.daemonPortLabel.setText(String.valueOf(bSystemPlatformService.getLocalDaemonPort()));
} else {
this.daemonPortLabel.setText(this.getLexicon().getText("unknown"));
}
} else if (property == BSystemPlatformService.localDaemonSslPort) {
if (bSystemPlatformService.getLocalDaemonSslPort() > 0) {
this.daemonSSLPortLabel.setText(String.valueOf(bSystemPlatformService.getLocalDaemonSslPort()));
} else {
this.daemonSSLPortLabel.setText(this.getLexicon().getText("unknown"));
}
}
this.getContent().relayout();
} else if (bComponentEvent.getSourceComponent() instanceof BFilesystemAttributes) {
BLabel bLabel;
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
String string = bFilesystemAttributes.getPropertyInParent().getName();
if (property == BFilesystemAttributes.freeSpace) {
BLabel bLabel2 = (BLabel)this.filesystemPane.get(string + "free");
if (bLabel2 != null) {
bLabel2.setText(DaemonFileUtil.kbFormat.format(bFilesystemAttributes.getFreeSpace()));
}
} else if (property == BFilesystemAttributes.blockSize) {
BLabel bLabel3 = (BLabel)this.filesystemPane.get(string + "block");
if (bLabel3 != null) {
bLabel3.setText(DaemonFileUtil.byteFormat.format(bFilesystemAttributes.getBlockSize()));
}
} else if (property == BFilesystemAttributes.totalSpace) {
BLabel bLabel4 = (BLabel)this.filesystemPane.get(string + "total");
if (bLabel4 != null) {
bLabel4.setText(DaemonFileUtil.kbFormat.format(bFilesystemAttributes.getTotalSpace()));
}
} else if (property == BFilesystemAttributes.currentFileCount) {
BLabel bLabel5 = (BLabel)this.filesystemPane.get(string + "currentFile");
if (bLabel5 != null) {
String string2 = bFilesystemAttributes.getCurrentFileCount() < 0L ? this.getLexicon().getText("labels.system.fileCount.unavailable") : String.valueOf(bFilesystemAttributes.getCurrentFileCount());
bLabel5.setText(string2);
}
} else if (property == BFilesystemAttributes.maxFileCount && (bLabel = (BLabel)this.filesystemPane.get(string + "maxFile")) != null) {
String string3 = bFilesystemAttributes.getMaxFileCount() < 0L ? this.getLexicon().getText("labels.system.fileCount.unavailable") : String.valueOf(bFilesystemAttributes.getMaxFileCount());
bLabel.setText(string3);
}
} else {
BPlatform.log.trace("unhandled event " + bComponentEvent);
}
}
public void doTimeModified() {
if (!this.isModifiedStateLocked()) {
this.isTimeModified = true;
this.invoke(setModified, null, null);
}
}
public void doTimeZoneModified() {
if (!this.isModifiedStateLocked()) {
this.isTimeZoneModified = true;
if (this.tzRequiresReboot || !this.restartEnabled) {
this.rebootFieldDirty = true;
} else {
this.restartFieldDirty = true;
}
this.invoke(setModified, null, null);
}
}
public void doLocaleModified() {
if (!this.isModifiedStateLocked()) {
this.isLocaleModified = true;
if (this.restartEnabled) {
this.restartFieldDirty = true;
} else {
this.rebootFieldDirty = true;
}
this.invoke(setModified, null, null);
}
}
public void doMarkRestartFieldDirty() {
if (this.restartEnabled) {
if (!this.isModifiedStateLocked()) {
this.restartFieldDirty = true;
this.invoke(setModified, null, null);
}
} else {
this.doMarkRebootFieldDirty();
}
}
public void doMarkRebootFieldDirty() {
if (!this.isModifiedStateLocked()) {
this.rebootFieldDirty = true;
this.invoke(setModified, null, null);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private class ToggleAutoSaveEnabledCommand
extends ToggleCommand {
public ToggleAutoSaveEnabledCommand() {
super((BWidget)BSystemPlatformServicePlugin.this, BSystemPlatformServicePlugin.this.getLexicon().getText("labels.system.enableStationAutoSave"));
}
public CommandArtifact doInvoke() {
BSystemPlatformServicePlugin.this.stationAutoSaveFrequencyEditor.setEnabled(this.isSelected());
BSystemPlatformServicePlugin.this.stationSaveBackupCountEditor.setEnabled(this.isSelected());
BSystemPlatformServicePlugin.this.setModified();
return null;
}
}
private static class ZoneListModel
extends ListModel {
BTimeZone[] items;
public ZoneListModel(BVector bVector) {
this.items = (BTimeZone[])bVector.getChildren(class$javax$baja$timezone$BTimeZone == null ? (class$javax$baja$timezone$BTimeZone = BSystemPlatformServicePlugin.class$("javax.baja.timezone.BTimeZone")) : class$javax$baja$timezone$BTimeZone);
}
public int getItemCount() {
return this.items.length;
}
public BTimeZone getTimeZone(int n) {
return this.items[n];
}
public Object getItem(int n) {
return this.getTimeZone(n);
}
}
}
@@ -0,0 +1,517 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BIntegerFE
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BRelTime
* javax.baja.sys.BValue
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BLabel
* javax.baja.ui.BNullWidget
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BExpandablePane
* javax.baja.ui.pane.BFlowPane
* javax.baja.util.LexiconText
* javax.baja.workbench.BWbPlugin
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.alarm.BPlatformAlarmSupport;
import com.tridium.platform.qnx.BSystemPlatformServiceQnx;
import com.tridium.platform.qnx.BSystemPlatformServiceQnxJavelina;
import com.tridium.platform.qnx.BSystemPlatformServiceQnxLegacy;
import com.tridium.platform.qnx.BSystemPlatformServiceQnxTitan;
import com.tridium.platform.ui.BSystemPlatformServicePlugin;
import com.tridium.platform.ui.util.BCoordinatedGridPane;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BIntegerFE;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BValue;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BLabel;
import javax.baja.ui.BNullWidget;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BExpandablePane;
import javax.baja.ui.pane.BFlowPane;
import javax.baja.util.LexiconText;
import javax.baja.workbench.BWbPlugin;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BSystemPlatformServiceQnxPlugin
extends BSystemPlatformServicePlugin {
public static final Action rebootLimitModified = BSystemPlatformServiceQnxPlugin.newAction((int)4, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$BSystemPlatformServiceQnxPlugin == null ? (class$com$tridium$platform$ui$BSystemPlatformServiceQnxPlugin = BSystemPlatformServiceQnxPlugin.class$("com.tridium.platform.ui.BSystemPlatformServiceQnxPlugin")) : class$com$tridium$platform$ui$BSystemPlatformServiceQnxPlugin));
private BLabel isJumperPresentLabel;
private BWbFieldEditor isJumperPresentVal;
private BLabel isBatteryPresentLabel;
private BWbFieldEditor isBatteryPresentVal;
private BIntegerFE ramDiskSizeFE;
private BWbFieldEditor failureRebootLimitFE;
private BWbFieldEditor failureRebootLimitPeriodFE;
private boolean isRebootLimitModified = false;
private BLabel serialNumberLabel = new BLabel();
private BLabel hardwareRevisionLabel;
private BIntegerFE minFreeHeapFE;
private BLabel maxHeapLabel;
private BLabel freeHeapLabel;
private BLabel heapStatusLabel;
private BIntegerFE minRamDiskFE;
private BLabel ramDiskStatusLabel;
private BIntegerFE minFreeFileDescriptorFE;
private BLabel maxOpenFileDescriptorLabel;
private BLabel freeFileDescriptorLabel;
private BLabel fileDescriptorStatusLabel;
private BIntegerFE minFreeMemoryFE;
private BLabel physMemoryStatusLabel;
private BIntegerFE minFreeDiskFE;
private BLabel diskStatusLabel;
private BIntegerFE minFileFreeFE;
private BLabel fileCountStatusLabel;
private BLabel tamperEnabledLabel;
private BWbFieldEditor tamperEnabledVal;
private BLabel tamperOkLabel;
private BWbFieldEditor tamperOkVal;
private BLabel tamperSwitchAlarmSupportLabel;
private BWbFieldEditor tamperSwitchAlarmSupportVal;
private BExpandablePane tamperSwitchAlarmSupportExpansion;
static /* synthetic */ Class class$com$tridium$platform$ui$BSystemPlatformServiceQnxPlugin;
public void rebootLimitModified() {
this.invoke(rebootLimitModified, null, null);
}
public Type getType() {
return TYPE;
}
public BSystemPlatformServiceQnxPlugin() {
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.serialNumber"), (BWidget)this.serialNumberLabel);
this.hardwareRevisionLabel = new BLabel();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.hardwareRevision"), (BWidget)this.hardwareRevisionLabel);
this.isJumperPresentLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.isJumperPresent"), true);
this.isJumperPresentLabel.setVisible(false);
this.isJumperPresentVal = BWbFieldEditor.makeFor((BObject)BBoolean.FALSE, (Context)BSystemPlatformServiceQnxLegacy.isJumperPresent.getFacets());
this.isJumperPresentVal.setVisible(false);
this.isJumperPresentVal.setReadonly(true);
this.ledgerPane.add(null, (BValue)this.isJumperPresentLabel);
this.ledgerPane.add(null, (BValue)this.isJumperPresentVal);
this.isBatteryPresentLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.isBatteryPresent"), true);
this.isBatteryPresentLabel.setVisible(false);
this.isBatteryPresentVal = BWbFieldEditor.makeFor((BObject)BBoolean.FALSE, (Context)BSystemPlatformServiceQnxLegacy.isBatteryPresent.getFacets());
this.isBatteryPresentVal.setVisible(false);
this.ledgerPane.add(null, (BValue)this.isBatteryPresentLabel);
this.ledgerPane.add(null, (BValue)this.isBatteryPresentVal);
this.linkTo(null, (BComponent)this.isBatteryPresentVal, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.failureRebootLimitFE = BWbFieldEditor.makeFor((BObject)BInteger.make((int)1), (Context)BSystemPlatformServiceQnx.failureRebootLimit.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.failureRebootLimit"), (BWidget)this.failureRebootLimitFE);
this.linkTo(null, (BComponent)this.failureRebootLimitFE, (Slot)BWbPlugin.pluginModified, (Slot)rebootLimitModified);
this.failureRebootLimitPeriodFE = BWbFieldEditor.makeFor((BObject)BRelTime.HOUR, (Context)BSystemPlatformServiceQnx.failureRebootLimitPeriod.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.failureRebootLimitPeriod"), (BWidget)this.failureRebootLimitPeriodFE);
this.linkTo(null, (BComponent)this.failureRebootLimitPeriodFE, (Slot)BWbPlugin.pluginModified, (Slot)rebootLimitModified);
BCoordinatedGridPane bCoordinatedGridPane = new BCoordinatedGridPane(4);
bCoordinatedGridPane.setColumnGap(8.0);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.minFree"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.size"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.status"), true, BHalign.center));
this.minRamDiskFE = new BIntegerFE();
bCoordinatedGridPane.add(null, (BValue)this.minRamDiskFE);
this.linkTo(null, (BComponent)this.minRamDiskFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
BFlowPane bFlowPane = new BFlowPane(BHalign.right);
this.ramDiskSizeFE = new BIntegerFE();
bFlowPane.add(null, (BValue)this.ramDiskSizeFE);
bFlowPane.add(null, (BValue)new BLabel(this.getLexicon().getText("labels.system.qnx.ramDiskSizeUnits")));
bCoordinatedGridPane.add(null, (BValue)bFlowPane);
this.linkTo(null, (BComponent)this.ramDiskSizeFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
this.ramDiskStatusLabel = new BLabel();
bCoordinatedGridPane.add(null, (BValue)this.ramDiskStatusLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.ramDisk"), (BWidget)bCoordinatedGridPane);
this.linkTo(null, (BComponent)this.ramDiskSizeFE, (Slot)BWbPlugin.pluginModified, (Slot)markRebootFieldDirty);
bCoordinatedGridPane = new BCoordinatedGridPane(bCoordinatedGridPane);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.minFree"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.max"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.free"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.status"), true, BHalign.center));
bFlowPane = new BFlowPane(BHalign.right);
this.minFreeHeapFE = new BIntegerFE();
bFlowPane.add(null, (BValue)this.minFreeHeapFE);
bFlowPane.add(null, (BValue)new BLabel(this.getLexicon().getText("labels.system.qnx.freeHeapUnits")));
bCoordinatedGridPane.add(null, (BValue)bFlowPane);
this.linkTo(null, (BComponent)this.minFreeHeapFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
bFlowPane = new BFlowPane(BHalign.right);
this.maxHeapLabel = new BLabel("", BHalign.right);
bFlowPane.add(null, (BValue)this.maxHeapLabel);
bFlowPane.add(null, (BValue)new BLabel(this.getLexicon().getText("labels.system.qnx.freeHeapUnits")));
bCoordinatedGridPane.add(null, (BValue)bFlowPane);
bFlowPane = new BFlowPane(BHalign.right);
this.freeHeapLabel = new BLabel("", BHalign.right);
bFlowPane.add(null, (BValue)this.freeHeapLabel);
bFlowPane.add(null, (BValue)new BLabel(this.getLexicon().getText("labels.system.qnx.freeHeapUnits")));
bCoordinatedGridPane.add(null, (BValue)bFlowPane);
this.heapStatusLabel = new BLabel();
bCoordinatedGridPane.add(null, (BValue)this.heapStatusLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.javaHeap"), (BWidget)bCoordinatedGridPane);
this.linkTo(null, (BComponent)this.minFreeHeapFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
bCoordinatedGridPane = new BCoordinatedGridPane(bCoordinatedGridPane);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.minFree"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.maxOpen"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.free"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.status"), true, BHalign.center));
this.minFreeFileDescriptorFE = new BIntegerFE();
bCoordinatedGridPane.add(null, (BValue)this.minFreeFileDescriptorFE);
this.linkTo(null, (BComponent)this.minFreeFileDescriptorFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.maxOpenFileDescriptorLabel = new BLabel("", BHalign.right);
bCoordinatedGridPane.add(null, (BValue)this.maxOpenFileDescriptorLabel);
this.freeFileDescriptorLabel = new BLabel("", BHalign.right);
bCoordinatedGridPane.add(null, (BValue)this.freeFileDescriptorLabel);
this.fileDescriptorStatusLabel = new BLabel();
bCoordinatedGridPane.add(null, (BValue)this.fileDescriptorStatusLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.fileDescriptors"), (BWidget)bCoordinatedGridPane);
bCoordinatedGridPane = new BCoordinatedGridPane(bCoordinatedGridPane);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.minFree"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.status"), true, BHalign.center));
bFlowPane = new BFlowPane(BHalign.right);
this.minFreeMemoryFE = new BIntegerFE();
bFlowPane.add(null, (BValue)this.minFreeMemoryFE);
bFlowPane.add(null, (BValue)new BLabel(this.getLexicon().getText("labels.system.qnx.freePhysUnits")));
bCoordinatedGridPane.add(null, (BValue)bFlowPane);
this.linkTo(null, (BComponent)this.minFreeMemoryFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
this.physMemoryStatusLabel = new BLabel();
bCoordinatedGridPane.add(null, (BValue)this.physMemoryStatusLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.physMemoryLimits"), (BWidget)bCoordinatedGridPane);
bCoordinatedGridPane = new BCoordinatedGridPane(bCoordinatedGridPane);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.minFree"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.status"), true, BHalign.center));
this.minFreeDiskFE = new BIntegerFE();
bCoordinatedGridPane.add(null, (BValue)this.minFreeDiskFE);
this.linkTo(null, (BComponent)this.minFreeDiskFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
this.diskStatusLabel = new BLabel();
bCoordinatedGridPane.add(null, (BValue)this.diskStatusLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.diskSpace"), (BWidget)bCoordinatedGridPane);
bCoordinatedGridPane = new BCoordinatedGridPane(bCoordinatedGridPane);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.minFree"), true, BHalign.center));
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.status"), true, BHalign.center));
this.minFileFreeFE = new BIntegerFE();
bCoordinatedGridPane.add(null, (BValue)this.minFileFreeFE);
this.linkTo(null, (BComponent)this.minFileFreeFE, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
bCoordinatedGridPane.add(null, (BValue)new BNullWidget());
this.fileCountStatusLabel = new BLabel();
bCoordinatedGridPane.add(null, (BValue)this.fileCountStatusLabel);
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"labels.system.qnx.fileCount"), (BWidget)bCoordinatedGridPane);
this.tamperEnabledLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.tamperEnabled"), true);
this.tamperEnabledLabel.setVisible(false);
this.tamperEnabledVal = BWbFieldEditor.makeFor((BObject)BBoolean.FALSE, (Context)BSystemPlatformServiceQnxJavelina.tamperSwitchOk.getFacets());
this.linkTo(null, (BComponent)this.tamperEnabledVal, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.tamperEnabledVal.setVisible(false);
this.ledgerPane.add(null, (BValue)this.tamperEnabledLabel);
this.ledgerPane.add(null, (BValue)this.tamperEnabledVal);
this.tamperOkLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.tamperSwitchOk"), true);
this.tamperOkLabel.setVisible(false);
this.tamperOkVal = BWbFieldEditor.makeFor((BObject)BBoolean.FALSE, (Context)BSystemPlatformServiceQnxJavelina.tamperSwitchOk.getFacets());
this.tamperOkVal.setVisible(false);
this.tamperOkVal.setReadonly(true);
this.ledgerPane.add(null, (BValue)this.tamperOkLabel);
this.ledgerPane.add(null, (BValue)this.tamperOkVal);
this.tamperSwitchAlarmSupportLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"labels.system.qnx.tamperSwitchAlarmSupport"), true);
this.tamperSwitchAlarmSupportLabel.setVisible(false);
this.tamperSwitchAlarmSupportVal = BWbFieldEditor.makeFor((BObject)new BPlatformAlarmSupport(), (Context)BSystemPlatformServiceQnxJavelina.tamperSwitchAlarmSupport.getFacets());
this.linkTo(null, (BComponent)this.tamperSwitchAlarmSupportVal, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
this.tamperSwitchAlarmSupportVal.setVisible(false);
this.ledgerPane.add(null, (BValue)this.tamperSwitchAlarmSupportLabel);
this.tamperSwitchAlarmSupportExpansion = new BExpandablePane((BWidget)new BNullWidget(), (BWidget)this.tamperSwitchAlarmSupportVal);
this.tamperSwitchAlarmSupportExpansion.setVisible(false);
this.ledgerPane.add(null, (BValue)this.tamperSwitchAlarmSupportExpansion);
}
protected void doLoadValue(BObject bObject, Context context) {
Context context2 = context == null ? new BasicContext() : context;
this.loading = true;
BSystemPlatformServiceQnx bSystemPlatformServiceQnx = (BSystemPlatformServiceQnx)bObject;
bSystemPlatformServiceQnx.lease(4);
this.serialNumberLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getSerialNumber()));
this.hardwareRevisionLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getHardwareRevision()));
if (bObject instanceof BSystemPlatformServiceQnxLegacy) {
this.isJumperPresentLabel.setVisible(true);
this.isJumperPresentVal.setVisible(true);
this.isJumperPresentVal.loadValue((BObject)BBoolean.make((boolean)((BSystemPlatformServiceQnxLegacy)bSystemPlatformServiceQnx).getIsJumperPresent()), context);
this.isBatteryPresentLabel.setVisible(true);
this.isBatteryPresentVal.setVisible(true);
this.isBatteryPresentVal.loadValue((BObject)BBoolean.make((boolean)((BSystemPlatformServiceQnxLegacy)bSystemPlatformServiceQnx).getIsBatteryPresent()), context);
}
this.ramDiskSizeFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getRamDiskSize()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("ramDiskSize")));
if (bObject instanceof BSystemPlatformServiceQnxTitan) {
this.ramDiskSizeFE.setReadonly(true);
}
this.failureRebootLimitFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getFailureRebootLimit()), (Context)BSystemPlatformServiceQnx.failureRebootLimit.getFacets());
this.failureRebootLimitPeriodFE.loadValue((BObject)bSystemPlatformServiceQnx.getFailureRebootLimitPeriod(), (Context)BSystemPlatformServiceQnx.failureRebootLimitPeriod.getFacets());
this.minFreeHeapFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getMinFreeHeap()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("minFreeHeap")));
this.maxHeapLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getMaxHeap()));
this.freeHeapLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getFreeHeap()));
if (bSystemPlatformServiceQnx.getLowHeap()) {
this.heapStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowHeap"));
} else {
this.heapStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
this.minRamDiskFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getMinFreeRamDiskPercentage()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("minFreeRamDiskPercentage")));
if (bSystemPlatformServiceQnx.getLowRamDiskSpace()) {
this.ramDiskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowRamDiskSpace"));
} else {
this.ramDiskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
this.minFreeFileDescriptorFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getMinFreeFileDescriptors()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("minFreeFileDescriptors")));
this.maxOpenFileDescriptorLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getMaxOpenFileDescriptors()));
this.freeFileDescriptorLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getMaxOpenFileDescriptors() - bSystemPlatformServiceQnx.getOpenFileDescriptors()));
if (bSystemPlatformServiceQnx.getTooManyOpenFiles()) {
this.fileDescriptorStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.tooManyOpenFiles"));
} else {
this.fileDescriptorStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
this.minFreeMemoryFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getMinFreePhysicalMemory()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("minFreePhysicalMemory")));
if (bSystemPlatformServiceQnx.getLowMemory()) {
this.physMemoryStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowMemory"));
} else {
this.physMemoryStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
this.minFreeDiskFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getMinFreeDiskPercentage()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("minFreeDiskPercentage")));
if (bSystemPlatformServiceQnx.getLowDiskSpace()) {
this.diskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowDiskSpace"));
} else {
this.diskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
this.minFileFreeFE.loadValue((BObject)BInteger.make((int)bSystemPlatformServiceQnx.getMinAvailableFiles()), (Context)bSystemPlatformServiceQnx.getSlotFacets(bSystemPlatformServiceQnx.getSlot("minAvailableFiles")));
if (bSystemPlatformServiceQnx.getLowDiskSpace()) {
this.fileCountStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowFilesAvailable"));
} else {
this.fileCountStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
if (bObject instanceof BSystemPlatformServiceQnxJavelina) {
BSystemPlatformServiceQnxJavelina bSystemPlatformServiceQnxJavelina = (BSystemPlatformServiceQnxJavelina)bObject;
this.tamperEnabledVal.loadValue((BObject)BBoolean.make((boolean)bSystemPlatformServiceQnxJavelina.getTamperSwitchEnabled()));
this.tamperOkVal.loadValue((BObject)BBoolean.make((boolean)bSystemPlatformServiceQnxJavelina.getTamperSwitchOk()));
this.tamperSwitchAlarmSupportVal.loadValue((BObject)bSystemPlatformServiceQnxJavelina.getTamperSwitchAlarmSupport());
this.tamperEnabledLabel.setVisible(true);
this.tamperEnabledVal.setVisible(true);
this.tamperOkLabel.setVisible(true);
this.tamperOkVal.setVisible(true);
this.tamperSwitchAlarmSupportLabel.setVisible(true);
this.tamperSwitchAlarmSupportVal.setVisible(true);
this.tamperSwitchAlarmSupportExpansion.setVisible(true);
}
super.doLoadValue(bObject, context2);
this.loading = false;
}
protected void doSaveSystemPlatformServiceFields(BSystemPlatformService bSystemPlatformService, Context context) throws Exception {
BBoolean bBoolean;
BSystemPlatformServiceQnx bSystemPlatformServiceQnx = (BSystemPlatformServiceQnx)bSystemPlatformService;
if (bSystemPlatformService instanceof BSystemPlatformServiceQnxLegacy) {
bBoolean = (BBoolean)this.isBatteryPresentVal.saveValue(context);
((BSystemPlatformServiceQnxLegacy)bSystemPlatformServiceQnx).setIsBatteryPresent(bBoolean.getBoolean());
}
bBoolean = (BInteger)this.ramDiskSizeFE.saveValue(context);
bSystemPlatformServiceQnx.setRamDiskSize(bBoolean.getInt());
bBoolean = (BInteger)this.minFreeHeapFE.saveValue(context);
bSystemPlatformServiceQnx.setMinFreeHeap(bBoolean.getInt());
bBoolean = (BInteger)this.minRamDiskFE.saveValue(context);
bSystemPlatformServiceQnx.setMinFreeRamDiskPercentage(bBoolean.getInt());
bBoolean = (BInteger)this.minFreeFileDescriptorFE.saveValue(context);
bSystemPlatformServiceQnx.setMinFreeFileDescriptors(bBoolean.getInt());
bBoolean = (BInteger)this.minFreeMemoryFE.saveValue(context);
bSystemPlatformServiceQnx.setMinFreePhysicalMemory(bBoolean.getInt());
bBoolean = (BInteger)this.minFreeDiskFE.saveValue(context);
bSystemPlatformServiceQnx.setMinFreeDiskPercentage(bBoolean.getInt());
bBoolean = (BInteger)this.minFileFreeFE.saveValue(context);
bSystemPlatformServiceQnx.setMinAvailableFiles(bBoolean.getInt());
if (this.isRebootLimitModified) {
bSystemPlatformServiceQnx.setFailureRebootLimit(((BInteger)this.failureRebootLimitFE.saveValue(context)).getInt());
bSystemPlatformServiceQnx.setFailureRebootLimitPeriod((BRelTime)this.failureRebootLimitPeriodFE.saveValue(context));
this.isRebootLimitModified = false;
}
if (bSystemPlatformService instanceof BSystemPlatformServiceQnxJavelina) {
BSystemPlatformServiceQnxJavelina bSystemPlatformServiceQnxJavelina = (BSystemPlatformServiceQnxJavelina)bSystemPlatformService;
BBoolean bBoolean2 = (BBoolean)this.tamperEnabledVal.saveValue(context);
bSystemPlatformServiceQnxJavelina.setTamperSwitchEnabled(bBoolean2.getBoolean());
bSystemPlatformServiceQnxJavelina.setTamperSwitchAlarmSupport((BPlatformAlarmSupport)this.tamperSwitchAlarmSupportVal.saveValue());
}
}
public void doRebootLimitModified() {
if (!this.isModifiedStateLocked()) {
this.isRebootLimitModified = true;
this.invoke(setModified, null, null);
}
}
public void handleComponentEvent(BComponentEvent bComponentEvent) {
if (this.saving || this.loading || bComponentEvent == null || bComponentEvent.getSlot() == null || !bComponentEvent.getSlot().isProperty()) {
return;
}
boolean bl = false;
if (bComponentEvent.getSourceComponent() instanceof BSystemPlatformService) {
BSystemPlatformServiceQnx bSystemPlatformServiceQnx = (BSystemPlatformServiceQnx)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
BValue bValue = bSystemPlatformServiceQnx.get(property);
if (property == BSystemPlatformServiceQnx.ramDiskSize) {
this.ramDiskSizeFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnxLegacy.isJumperPresent) {
this.isJumperPresentLabel.setText(bValue.toString());
bl = true;
} else if (property == BSystemPlatformServiceQnx.serialNumber) {
this.serialNumberLabel.setText(bValue.toString());
bl = true;
} else if (property == BSystemPlatformServiceQnx.hardwareRevision) {
this.hardwareRevisionLabel.setText(bValue.toString());
bl = true;
} else if (property == BSystemPlatformServiceQnx.minFreeHeap) {
this.minFreeHeapFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.failureRebootLimit) {
if (!this.isRebootLimitModified) {
this.failureRebootLimitFE.loadValue((BObject)bValue, (Context)BSystemPlatformServiceQnx.failureRebootLimit.getFacets());
}
bl = true;
} else if (property == BSystemPlatformServiceQnxLegacy.isBatteryPresent) {
this.isBatteryPresentVal.loadValue((BObject)((BBoolean)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.failureRebootLimitPeriod) {
if (!this.isRebootLimitModified) {
this.failureRebootLimitPeriodFE.loadValue((BObject)bValue, (Context)BSystemPlatformServiceQnx.failureRebootLimitPeriod.getFacets());
}
bl = true;
} else if (property == BSystemPlatformServiceQnx.maxHeap) {
this.maxHeapLabel.setText(bValue.toString());
bl = true;
} else if (property == BSystemPlatformServiceQnx.freeHeap) {
this.freeHeapLabel.setText(bValue.toString());
bl = true;
} else if (property == BSystemPlatformServiceQnx.lowHeap) {
if (((BBoolean)bValue).getBoolean()) {
this.heapStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowHeap"));
} else {
this.heapStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
bl = true;
} else if (property == BSystemPlatformServiceQnx.minFreeRamDiskPercentage) {
this.minRamDiskFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.lowRamDiskSpace) {
if (((BBoolean)bValue).getBoolean()) {
this.ramDiskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowRamDiskSpace"));
} else {
this.ramDiskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
bl = true;
} else if (property == BSystemPlatformServiceQnx.minFreeFileDescriptors) {
this.minFreeFileDescriptorFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.maxOpenFileDescriptors) {
this.maxOpenFileDescriptorLabel.setText(bValue.toString());
bl = true;
} else if (property == BSystemPlatformServiceQnx.openFileDescriptors) {
this.freeFileDescriptorLabel.setText(String.valueOf(bSystemPlatformServiceQnx.getMaxOpenFileDescriptors() - bSystemPlatformServiceQnx.getOpenFileDescriptors()));
bl = true;
} else if (property == BSystemPlatformServiceQnx.tooManyOpenFiles) {
if (((BBoolean)bValue).getBoolean()) {
this.fileDescriptorStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.tooManyOpenFiles"));
} else {
this.fileDescriptorStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
bl = true;
} else if (property == BSystemPlatformServiceQnx.minFreePhysicalMemory) {
this.minFreeMemoryFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.lowMemory) {
if (((BBoolean)bValue).getBoolean()) {
this.physMemoryStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowMemory"));
} else {
this.physMemoryStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
bl = true;
} else if (property == BSystemPlatformServiceQnx.minFreeDiskPercentage) {
this.minFreeDiskFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.lowDiskSpace) {
if (((BBoolean)bValue).getBoolean()) {
this.diskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowDiskSpace"));
} else {
this.diskStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
bl = true;
} else if (property == BSystemPlatformServiceQnx.minAvailableFiles) {
this.minFileFreeFE.loadValue((BObject)((BInteger)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnx.lowAvailableFiles) {
if (((BBoolean)bValue).getBoolean()) {
this.fileCountStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.lowFilesAvailable"));
} else {
this.fileCountStatusLabel.setText(this.getLexicon().getText("labels.system.qnx.ok"));
}
bl = true;
} else if (property == BSystemPlatformServiceQnxJavelina.tamperSwitchEnabled) {
this.tamperEnabledVal.loadValue((BObject)((BBoolean)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnxJavelina.tamperSwitchOk) {
this.tamperOkVal.loadValue((BObject)((BBoolean)bValue));
bl = true;
} else if (property == BSystemPlatformServiceQnxJavelina.tamperSwitchAlarmSupport) {
this.tamperSwitchAlarmSupportVal.loadValue((BObject)((BPlatformAlarmSupport)bValue));
bl = true;
}
if (bl) {
this.getContent().relayout();
}
}
if (!bl) {
super.handleComponentEvent(bComponentEvent);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,77 @@
/*
* 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.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.workbench.view.BWbView
*/
package com.tridium.platform.ui;
import com.tridium.platform.ui.util.CommandUtil;
import javax.baja.gx.BImage;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.workbench.view.BWbView;
public class ConfirmedActionCommand
extends Command {
private String title;
private String message;
private Action action;
private int buttons;
public ConfirmedActionCommand(BWbView bWbView, Action action, String string) {
this(bWbView, action, string, 12);
}
public ConfirmedActionCommand(BWbView bWbView, Action action, String string, int n) {
super((BWidget)bWbView, bWbView.getType().getModule(), string + "." + action.getName());
this.title = bWbView.getLexicon().getText(string + "." + action.getName() + ".confirmTitle");
this.message = bWbView.getLexicon().getText(string + "." + action.getName() + ".confirmMessage");
this.buttons = n;
this.action = action;
}
public CommandArtifact doInvoke() {
try {
ConfirmedActionCommand.doConfirmedAction((BWidget)((BWbView)this.getOwner()), (BComponent)((BWbView)this.getOwner()).getCurrentValue(), this.title, this.message, this.action, this.buttons);
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
public static void doConfirmedAction(BWbView bWbView, Action action, String string) {
ConfirmedActionCommand.doConfirmedAction(bWbView, action, string, 12);
}
public static void doConfirmedAction(BWbView bWbView, Action action, String string, int n) {
ConfirmedActionCommand.doConfirmedAction((BWidget)bWbView, (BComponent)bWbView.getCurrentValue(), action, string, n);
}
public static void doConfirmedAction(BWidget bWidget, BComponent bComponent, Action action, String string) {
ConfirmedActionCommand.doConfirmedAction(bWidget, bComponent, action, string, 12);
}
public static void doConfirmedAction(BWidget bWidget, BComponent bComponent, Action action, String string, int n) {
ConfirmedActionCommand.doConfirmedAction(bWidget, bComponent, bComponent.getLexicon().getText(string + "." + action.getName() + ".confirmTitle"), bComponent.getLexicon().getText(string + "." + action.getName() + ".confirmMessage"), action, n);
}
private static void doConfirmedAction(BWidget bWidget, BComponent bComponent, String string, String string2, Action action, int n) {
if (BDialog.open((BWidget)bWidget, (String)string, (Object)string2, (int)n, (BImage)BDialog.WARNING_ICON, (String)null) == (n & 5)) {
bComponent.invoke(action, null, null);
}
}
}
@@ -0,0 +1,62 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.license.LicenseUtil
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.license;
import com.tridium.platform.license.BCertificateSummary;
import com.tridium.sys.license.LicenseUtil;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BCertificateSummaryFE
extends BWbFieldEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BCertificateSummaryFE == null ? (class$com$tridium$platform$ui$license$BCertificateSummaryFE = BCertificateSummaryFE.class$("com.tridium.platform.ui.license.BCertificateSummaryFE")) : class$com$tridium$platform$ui$license$BCertificateSummaryFE));
protected BTextField text = new BTextField("", 41, false);
static /* synthetic */ Class class$com$tridium$platform$ui$license$BCertificateSummaryFE;
public Type getType() {
return TYPE;
}
public BCertificateSummaryFE() {
this.setContent((BWidget)this.text);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BCertificateSummary bCertificateSummary = (BCertificateSummary)bObject;
if (bCertificateSummary.getCertificateGenerated() == Long.MIN_VALUE) {
this.text.setText(this.getLexicon().getText("CertificateSummaryFE.text.null"));
} else {
this.text.setText(this.getLexicon().getText("CertificateSummaryFE.text", new Object[]{LicenseUtil.formatDate((long)bCertificateSummary.getCertificateGenerated()), LicenseUtil.formatDate((long)bCertificateSummary.getCertificateExpires())}));
}
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
return bObject;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,170 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFile
* javax.baja.file.IFileFilter
* javax.baja.log.Log
* javax.baja.space.Mark
* javax.baja.sys.BObject
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.list.BList
* javax.baja.ui.list.ListModel
* javax.baja.ui.pane.BTextEditorPane
* javax.baja.ui.transfer.TransferContext
* javax.baja.ui.transfer.TransferFormat
*/
package com.tridium.platform.ui.license;
import com.tridium.platform.ui.license.FileInfoListModel;
import javax.baja.file.BIFile;
import javax.baja.file.IFileFilter;
import javax.baja.log.Log;
import javax.baja.space.Mark;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.list.BList;
import javax.baja.ui.list.ListModel;
import javax.baja.ui.pane.BTextEditorPane;
import javax.baja.ui.transfer.TransferContext;
import javax.baja.ui.transfer.TransferFormat;
public class BFileInfoList
extends BList {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BFileInfoList == null ? (class$com$tridium$platform$ui$license$BFileInfoList = BFileInfoList.class$("com.tridium.platform.ui.license.BFileInfoList")) : class$com$tridium$platform$ui$license$BFileInfoList));
private IFileFilter dragOverFilter;
private IFileFilter dropFilter;
private Command deleteCommand;
private Command viewCommand;
private ListTransfer listTransfer;
private static Log log = Log.getLog((String)"platform");
static /* synthetic */ Class class$com$tridium$platform$ui$license$BFileInfoList;
public BFileInfoList() {
throw new UnsupportedOperationException();
}
public BFileInfoList(FileInfoListModel fileInfoListModel, IFileFilter iFileFilter, ListTransfer listTransfer) {
this(fileInfoListModel, iFileFilter, iFileFilter, listTransfer);
}
public BFileInfoList(FileInfoListModel fileInfoListModel, IFileFilter iFileFilter, IFileFilter iFileFilter2, ListTransfer listTransfer) {
super((ListModel)fileInfoListModel);
this.dragOverFilter = iFileFilter;
this.dropFilter = iFileFilter2;
this.listTransfer = listTransfer;
this.setPasteEnabled(true);
this.deleteCommand = new DeleteFileCommand();
this.viewCommand = new ViewFileCommand();
}
public FileInfoListModel getFileInfoListModel() {
return (FileInfoListModel)this.getModel();
}
public CommandArtifact doDelete() throws Exception {
this.deleteCommand.invoke();
return null;
}
public CommandArtifact insertTransferData(TransferContext transferContext) throws Exception {
BObject[] bObjectArray;
Mark mark = Mark.getCurrent();
if (mark != null && (bObjectArray = mark.getValues())[0] instanceof BIFile && this.dragOverFilter.accept((BIFile)bObjectArray[0]) && this.dropFilter.accept((BIFile)bObjectArray[0])) {
this.listTransfer.processFile((BIFile)bObjectArray[0]);
}
return null;
}
public int dragOver(TransferContext transferContext) {
Mark mark;
if (transferContext.getEnvelope().supports(TransferFormat.mark) && (mark = (Mark)transferContext.getEnvelope().getData(TransferFormat.mark)).getValues()[0] instanceof BIFile && this.dragOverFilter.accept((BIFile)mark.getValues()[0])) {
return 16;
}
return 0;
}
public CommandArtifact drop(TransferContext transferContext) throws Exception {
Mark mark = (Mark)transferContext.getEnvelope().getData(TransferFormat.mark);
if (mark.getValues()[0] instanceof BIFile && this.dragOverFilter.accept((BIFile)mark.getValues()[0]) && this.dropFilter.accept((BIFile)mark.getValues()[0])) {
this.listTransfer.processFile((BIFile)mark.getValues()[0]);
}
return null;
}
public Command getDeleteCommand() {
return this.deleteCommand;
}
public Command getViewCommand() {
return this.viewCommand;
}
public Type getType() {
return TYPE;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
public static interface ListTransfer {
public void processFile(BIFile var1) throws Exception;
}
private class ViewFileCommand
extends Command {
public ViewFileCommand() {
super((BWidget)BFileInfoList.this, TYPE.getModule(), "FileList.view");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
try {
FileInfoListModel fileInfoListModel = (FileInfoListModel)BFileInfoList.this.getModel();
int n = BFileInfoList.this.getSelectedIndex();
BDialog.message((BWidget)BFileInfoList.this, (String)fileInfoListModel.getFileName(n), (Object)new BTextEditorPane(fileInfoListModel.getFileContents(n), 20, 80, false));
}
catch (Exception exception) {
log.error("error reading contents of file", (Throwable)exception);
}
return null;
}
}
private class DeleteFileCommand
extends Command {
public DeleteFileCommand() {
super((BWidget)BFileInfoList.this, TYPE.getModule(), "FileList.delete");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
FileInfoListModel fileInfoListModel = (FileInfoListModel)BFileInfoList.this.getModel();
int[] nArray = BFileInfoList.this.getSelectedIndices();
if (4 == BDialog.confirm((BWidget)BFileInfoList.this, (String)BFileInfoList.this.getLexicon().getText("FileList.delete.confirmTitle"), (Object)BFileInfoList.this.getLexicon().getText("FileList.delete.confirmMessage"))) {
for (int i = 0; i < nArray.length; ++i) {
fileInfoListModel.deleteFiles(nArray);
}
}
BFileInfoList.this.getSelection().deselectAll();
return null;
}
}
}
@@ -0,0 +1,40 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BIcon
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.workbench.tool.BWbNavNodeTool
*/
package com.tridium.platform.ui.license;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.workbench.tool.BWbNavNodeTool;
public class BLicenseDatabaseTool
extends BWbNavNodeTool {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BLicenseDatabaseTool == null ? (class$com$tridium$platform$ui$license$BLicenseDatabaseTool = BLicenseDatabaseTool.class$("com.tridium.platform.ui.license.BLicenseDatabaseTool")) : class$com$tridium$platform$ui$license$BLicenseDatabaseTool));
private static final BIcon icon = BIcon.std((String)"doc.png");
static /* synthetic */ Class class$com$tridium$platform$ui$license$BLicenseDatabaseTool;
public Type getType() {
return TYPE;
}
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,676 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.file.types.text.BLicenseFile
* com.tridium.sys.Nre
* com.tridium.sys.license.dom.LicenseDatabase
* com.tridium.sys.license.dom.VendorLicense
* com.tridium.workbench.tools.BRequestLicenseTool
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* 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.naming.BOrd
* javax.baja.nre.util.Array
* javax.baja.nre.util.IFilter
* javax.baja.sys.BAbsTime
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BRadioButton
* javax.baja.ui.BWidget
* javax.baja.ui.ToggleCommandGroup
* javax.baja.ui.enums.BHalign
* javax.baja.ui.enums.BValign
* javax.baja.ui.event.BFocusEvent
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.list.BList
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.transfer.BTransferWidget
* javax.baja.ui.util.UiLexicon
* javax.baja.util.Lexicon
* javax.baja.util.LexiconText
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui.license;
import com.tridium.file.types.text.BLicenseFile;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.license.BLicenseArchiveFile;
import com.tridium.platform.license.BLicensePlatformService;
import com.tridium.platform.license.BrandProps;
import com.tridium.platform.license.CertificateInfo;
import com.tridium.platform.license.IFileInfo;
import com.tridium.platform.license.LicenseInfo;
import com.tridium.platform.license.LicenseSync;
import com.tridium.platform.license.PortalLicenseUtil;
import com.tridium.platform.ui.license.BFileInfoList;
import com.tridium.platform.ui.license.FileInfoListModel;
import com.tridium.platform.ui.license.UiUtil;
import com.tridium.platform.ui.util.AsyncCommand;
import com.tridium.platform.ui.util.BBox;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.BFileChooserDialog;
import com.tridium.platform.ui.util.BFileChooserListView;
import com.tridium.platform.ui.util.BIBeamPane;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.platform.ui.util.ExtPathFilter;
import com.tridium.platform.ui.util.IFilePathFilter;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.sys.Nre;
import com.tridium.sys.license.dom.LicenseDatabase;
import com.tridium.sys.license.dom.VendorLicense;
import com.tridium.workbench.tools.BRequestLicenseTool;
import java.io.OutputStream;
import java.util.HashSet;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
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.naming.BOrd;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.IFilter;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BBorder;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BRadioButton;
import javax.baja.ui.BWidget;
import javax.baja.ui.ToggleCommandGroup;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.enums.BValign;
import javax.baja.ui.event.BFocusEvent;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.list.BList;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.transfer.BTransferWidget;
import javax.baja.ui.util.UiLexicon;
import javax.baja.util.Lexicon;
import javax.baja.util.LexiconText;
import javax.baja.workbench.view.BWbComponentView;
public class BLicensePlatformServicePlugin
extends BWbComponentView {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BLicensePlatformServicePlugin == null ? (class$com$tridium$platform$ui$license$BLicensePlatformServicePlugin = BLicensePlatformServicePlugin.class$("com.tridium.platform.ui.license.BLicensePlatformServicePlugin")) : class$com$tridium$platform$ui$license$BLicensePlatformServicePlugin));
private static IFileFilter licenseFilter = new ExtFileFilter("TODO", "license,lar");
private static IFileFilter larFilter = new ExtFileFilter("TODO", "lar");
private static IFilePathFilter larPathFilter = new ExtPathFilter("lar");
private static IFileFilter certFilter = new ExtFileFilter("TODO", "certificate");
private BFileInfoList certs;
private FileInfoListModel certModel;
private BFileInfoList licenses;
private FileInfoListModel licenseModel;
private BLabel hostNameLabel;
private BLabel hostIdLabel;
private BLabel brandIdLabel;
private BFileSpace fileSpace;
private String brandId;
private String hostId;
private static final Lexicon lex = Lexicon.make((String)"platform");
static /* synthetic */ Class class$com$tridium$platform$ui$license$BLicensePlatformServicePlugin;
static /* synthetic */ Class class$com$tridium$platform$license$LicenseInfo;
static /* synthetic */ Class class$com$tridium$platform$license$CertificateInfo;
static /* synthetic */ Class class$com$tridium$platform$license$IFileInfo;
public Type getType() {
return TYPE;
}
public BLicensePlatformServicePlugin() {
BIBeamPane bIBeamPane = new BIBeamPane();
BGridPane bGridPane = new BGridPane(2);
bGridPane.setHalign(BHalign.left);
bGridPane.setValign(BValign.top);
bGridPane.setColumnGap(10.0);
bGridPane.setRowGap(6.0);
BLabel bLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"LicensePlatformServicePlugin.hostNameLabel"), true);
bGridPane.add(null, (BValue)bLabel);
this.hostNameLabel = new BLabel();
bGridPane.add(null, (BValue)this.hostNameLabel);
bLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"LicensePlatformServicePlugin.hostIdLabel"), true);
bGridPane.add(null, (BValue)bLabel);
this.hostIdLabel = new BLabel();
bGridPane.add(null, (BValue)this.hostIdLabel);
bLabel = LabelUtil.makeLabel(LexiconText.make((Type)TYPE, (String)"LicensePlatformServicePlugin.brandIdLabel"), true);
bGridPane.add(null, (BValue)bLabel);
this.brandIdLabel = new BLabel();
bGridPane.add(null, (BValue)this.brandIdLabel);
bIBeamPane.setTop((BWidget)new BBorderPane((BWidget)bGridPane, 0.0, 0.0, 6.0, 0.0));
this.licenseModel = new FileInfoListModel(LicenseInfo.LICENSES_PATH, "license", class$com$tridium$platform$license$LicenseInfo == null ? (class$com$tridium$platform$license$LicenseInfo = BLicensePlatformServicePlugin.class$("com.tridium.platform.license.LicenseInfo")) : class$com$tridium$platform$license$LicenseInfo);
this.licenses = new BFileInfoList(this.licenseModel, licenseFilter, new LicenseValidator(), new LicenseTransfer());
CommandBindings commandBindings = new CommandBindings();
ImportCommand importCommand = new ImportCommand(this.licenses);
ExportCommand exportCommand = new ExportCommand(this.licenses);
commandBindings.addCommand(importCommand, BCommandEnablePolicy.always);
commandBindings.addCommand(exportCommand, BCommandEnablePolicy.anySelection);
commandBindings.addCommand(this.licenses.getViewCommand(), BCommandEnablePolicy.singleSelection);
commandBindings.addCommand(this.licenses.getDeleteCommand(), BCommandEnablePolicy.anySelection);
commandBindings.setDoubleClickCommand(this.licenses.getViewCommand());
this.licenses.setController(new FileListController(commandBindings));
this.licenses.setSelection(new CommandBindings.ListSelection(commandBindings));
this.licenses.setMultipleSelection(true);
BButtonPane bButtonPane = new BButtonPane();
bButtonPane.setUniformColumnWidth(false);
bButtonPane.add(importCommand);
bButtonPane.add(exportCommand);
bButtonPane.add(this.licenses.getViewCommand());
bButtonPane.add(this.licenses.getDeleteCommand());
bLabel = new BLabel(lex.getText("LicensePlatformServicePlugin.licenseList.header"));
bIBeamPane.setLeft((BWidget)new BEdgePane((BWidget)bLabel, (BWidget)bButtonPane, null, null, (BWidget)new BBorderPane((BWidget)new BBorderPane((BWidget)this.licenses, BBorder.inset, BInsets.DEFAULT), 5.0, 0.0, 5.0, 0.0)));
bLabel.setHalign(BHalign.left);
this.certModel = new FileInfoListModel(CertificateInfo.CERTS_PATH, "certificate", class$com$tridium$platform$license$CertificateInfo == null ? (class$com$tridium$platform$license$CertificateInfo = BLicensePlatformServicePlugin.class$("com.tridium.platform.license.CertificateInfo")) : class$com$tridium$platform$license$CertificateInfo);
this.certs = new BFileInfoList(this.certModel, certFilter, new CertificateTransfer());
AddCertCommand addCertCommand = new AddCertCommand(this.certs);
commandBindings = new CommandBindings();
commandBindings.addCommand(addCertCommand, BCommandEnablePolicy.always);
commandBindings.addCommand(this.certs.getViewCommand(), BCommandEnablePolicy.singleSelection);
commandBindings.addCommand(this.certs.getDeleteCommand(), BCommandEnablePolicy.anySelection);
commandBindings.setDoubleClickCommand(this.certs.getViewCommand());
this.certs.setController(new FileListController(commandBindings));
this.certs.setSelection(new CommandBindings.ListSelection(commandBindings));
this.certs.setMultipleSelection(true);
bButtonPane = new BButtonPane();
bButtonPane.setUniformColumnWidth(false);
bButtonPane.add(addCertCommand);
bButtonPane.add(this.certs.getViewCommand());
bButtonPane.add(this.certs.getDeleteCommand());
bLabel = new BLabel(lex.getText("LicensePlatformServicePlugin.certList.header"));
bIBeamPane.setRight((BWidget)new BEdgePane((BWidget)bLabel, (BWidget)bButtonPane, null, null, (BWidget)new BBorderPane((BWidget)new BBorderPane((BWidget)this.certs, BBorder.inset, BInsets.DEFAULT), 5.0, 0.0, 5.0, 0.0)));
bLabel.setHalign(BHalign.left);
bIBeamPane.setCenter(new BBox(20.0, 0.0));
this.setContent((BWidget)bIBeamPane);
this.autoRegisterForComponentEvents = false;
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BLicensePlatformService bLicensePlatformService = (BLicensePlatformService)bObject;
this.registerForComponentEvents(bLicensePlatformService, 4);
bLicensePlatformService.poll();
this.hostNameLabel.setText(bLicensePlatformService.getHost().getNavDisplayName(null));
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bLicensePlatformService);
bSystemPlatformService.lease(2);
this.hostId = bSystemPlatformService.getHostId();
this.hostIdLabel.setText(this.hostId);
this.fileSpace = (BFileSpace)BOrd.make((String)"file:").get((BObject)bLicensePlatformService);
this.certModel.loadValue(this.fileSpace);
this.licenseModel.loadValue(this.fileSpace);
this.findBrandId();
}
protected void findBrandId() throws Exception {
this.brandId = null;
for (int i = 0; this.brandId == null && i < this.licenseModel.getItemCount(); ++i) {
VendorLicense vendorLicense = ((LicenseInfo)this.licenseModel.getInfo((int)i)).vendorLicense;
this.brandId = vendorLicense.getBrandId();
}
if (this.brandId == null) {
this.brandId = new BrandProps(this.fileSpace).get("brand.id", null);
}
this.brandIdLabel.setText(this.brandId == null ? "" : this.brandId);
}
protected LicenseInfo[] getDatabaseLicenses() throws Exception {
Array array = new Array(class$com$tridium$platform$license$LicenseInfo == null ? (class$com$tridium$platform$license$LicenseInfo = BLicensePlatformServicePlugin.class$("com.tridium.platform.license.LicenseInfo")) : class$com$tridium$platform$license$LicenseInfo);
VendorLicense[] vendorLicenseArray = LicenseDatabase.LOCAL_INSTANCE.getLicenses(this.hostId);
String string = this.brandId;
for (int i = 0; i < vendorLicenseArray.length; ++i) {
if (vendorLicenseArray[i].getBrandId() != null && string != null && !string.equals(vendorLicenseArray[i].getBrandId())) continue;
array.add((Object)new LicenseInfo(vendorLicenseArray[i], null));
string = vendorLicenseArray[i].getBrandId();
}
return (LicenseInfo[])array.trim();
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
protected void saveToStation(IFileInfo iFileInfo) throws Exception {
BIFile bIFile = this.fileSpace.makeFile(iFileInfo.getInstalledFilePath());
OutputStream outputStream = bIFile.getOutputStream();
try {
iFileInfo.write(outputStream);
}
finally {
try {
outputStream.close();
}
catch (Exception exception) {}
}
}
protected void sync(LicenseSync licenseSync, LicenseSync licenseSync2) throws Exception {
IFileInfo iFileInfo;
int n;
int n2;
Array array = new Array(class$com$tridium$platform$license$IFileInfo == null ? (class$com$tridium$platform$license$IFileInfo = BLicensePlatformServicePlugin.class$("com.tridium.platform.license.IFileInfo")) : class$com$tridium$platform$license$IFileInfo);
Array array2 = new Array(class$com$tridium$platform$license$IFileInfo == null ? (class$com$tridium$platform$license$IFileInfo = BLicensePlatformServicePlugin.class$("com.tridium.platform.license.IFileInfo")) : class$com$tridium$platform$license$IFileInfo);
Array array3 = new Array(class$com$tridium$platform$license$IFileInfo == null ? (class$com$tridium$platform$license$IFileInfo = BLicensePlatformServicePlugin.class$("com.tridium.platform.license.IFileInfo")) : class$com$tridium$platform$license$IFileInfo);
boolean bl = false;
boolean bl2 = false;
if (licenseSync != null) {
n2 = licenseSync.toRemove.size();
array3.addAll(licenseSync.toRemove);
for (n = 0; n < n2; ++n) {
iFileInfo = (LicenseInfo)licenseSync.toRemove.get(n);
iFileInfo.file.delete();
bl = true;
}
n2 = licenseSync.toAdd.size();
array.addAll(licenseSync.toAdd);
for (n = 0; n < n2; ++n) {
iFileInfo = (LicenseInfo)licenseSync.toAdd.get(n);
this.saveToStation(iFileInfo);
bl2 = true;
bl = true;
}
n2 = licenseSync.toUpdate.size();
array2.addAll(licenseSync.toUpdate);
for (n = 0; n < n2; ++n) {
iFileInfo = (LicenseInfo)licenseSync.toUpdate.get(n);
this.saveToStation(iFileInfo);
bl2 = true;
bl = true;
}
}
if (licenseSync2 != null) {
n2 = licenseSync2.toAdd.size();
array.addAll(licenseSync2.toAdd);
for (n = 0; n < n2; ++n) {
iFileInfo = (CertificateInfo)licenseSync2.toAdd.get(n);
this.saveToStation(iFileInfo);
bl = true;
}
n2 = licenseSync2.toUpdate.size();
array2.addAll(licenseSync2.toUpdate);
for (n = 0; n < n2; ++n) {
iFileInfo = (CertificateInfo)licenseSync2.toUpdate.get(n);
this.saveToStation(iFileInfo);
bl = true;
}
}
if (bl) {
if (bl2) {
BWidget bWidget = UiUtil.buildUpdateDescription(lex.getText("LicensePlatformServicePlugin.sync.successMessage"), lex.getText("LicensePlatformServicePlugin.sync.restartMessage"), (IFileInfo[])array.trim(), (IFileInfo[])array2.trim(), (IFileInfo[])array3.trim());
if (4 == BDialog.confirm((BWidget)this, (String)lex.getText("LicensePlatformServicePlugin.sync.successTitle"), (Object)bWidget, (int)12)) {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get(this.getCurrentValue());
bSystemPlatformService.lease(Integer.MAX_VALUE);
bSystemPlatformService.restartStation();
return;
}
} else {
BWidget bWidget = UiUtil.buildUpdateDescription(lex.getText("LicensePlatformServicePlugin.sync.successMessage"), null, (IFileInfo[])array.trim(), (IFileInfo[])array2.trim(), (IFileInfo[])array3.trim());
BDialog.message((BWidget)this, (String)lex.getText("LicensePlatformServicePlugin.sync.successTitle"), (Object)bWidget);
}
this.loadValue(this.getCurrentValue());
} else {
BDialog.message((BWidget)this, (String)lex.getText("LicensePlatformServicePlugin.sync.currentTitle"), (Object)lex.getText("LicensePlatformServicePlugin.sync.currentMessage"));
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private class CertificateTransfer
implements BFileInfoList.ListTransfer {
private CertificateTransfer() {
}
public void processFile(BIFile bIFile) throws Exception {
CertificateInfo[] certificateInfoArray = new CertificateInfo[]{new CertificateInfo(bIFile)};
CertificateInfo[] certificateInfoArray2 = (CertificateInfo[])BLicensePlatformServicePlugin.this.certModel.getInfo();
LicenseSync licenseSync = PortalLicenseUtil.syncCertificates(certificateInfoArray2, certificateInfoArray);
BLicensePlatformServicePlugin.this.sync(null, licenseSync);
}
}
private class LicenseTransfer
implements BFileInfoList.ListTransfer {
private LicenseTransfer() {
}
public void processFile(BIFile bIFile) throws Exception {
LicenseInfo[] licenseInfoArray = PortalLicenseUtil.getLicenseInfo(bIFile, BLicensePlatformServicePlugin.this.hostId, BLicensePlatformServicePlugin.this.brandId);
LicenseInfo[] licenseInfoArray2 = (LicenseInfo[])BLicensePlatformServicePlugin.this.licenseModel.getInfo();
LicenseSync licenseSync = PortalLicenseUtil.syncLicenses(BLicensePlatformServicePlugin.this.hostId, licenseInfoArray2, licenseInfoArray);
BLicensePlatformServicePlugin.this.sync(licenseSync, null);
}
}
private class AddCertCommand
extends AsyncCommand {
public AddCertCommand(BList bList) {
super((BWidget)bList, TYPE.getModule(), "LicensePlatformServicePlugin.addCert");
}
public void doInvokeAsync() {
block5: {
try {
BIFile[] bIFileArray;
BIFile bIFile = BFileSystem.INSTANCE.findFile(CertificateInfo.CERTS_PATH);
if (bIFile == null) {
bIFile = BFileSystem.INSTANCE.getSysHome();
}
if ((bIFileArray = BFileChooserDialog.chooseFiles(this.getOwner(), BImage.make((String)lex.getText("LicensePlatformServicePlugin.addCertDialog.icon")), lex.getText("LicensePlatformServicePlugin.addCertDialog.title"), lex.getText("LicensePlatformServicePlugin.addCertDialog.message", new Object[]{BLicensePlatformServicePlugin.this.hostNameLabel.getText()}), bIFile, certFilter, certFilter)).length <= 0) break block5;
try {
CertificateInfo[] certificateInfoArray = CertificateInfo.make(bIFileArray);
CertificateInfo[] certificateInfoArray2 = (CertificateInfo[])BLicensePlatformServicePlugin.this.certModel.getInfo();
LicenseSync licenseSync = PortalLicenseUtil.syncCertificates(certificateInfoArray2, certificateInfoArray);
BLicensePlatformServicePlugin.this.sync(null, licenseSync);
}
catch (Exception exception) {
throw new LocalizableRuntimeException("platform", "LicensePlatformServicePlugin.addCertException", (Throwable)exception);
}
BLicensePlatformServicePlugin.this.loadValue(BLicensePlatformServicePlugin.this.getCurrentValue());
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
}
}
}
private class ImportCommand
extends AsyncCommand {
public ImportCommand(BList bList) {
super((BWidget)bList, TYPE.getModule(), "LicensePlatformServicePlugin.importLicense");
}
private void importFile() throws Exception {
BIFile bIFile = BFileSystem.INSTANCE.findFile(LicenseInfo.LICENSES_PATH);
if (bIFile == null) {
bIFile = BFileSystem.INSTANCE.getSysHome();
}
Object[] objectArray = BFileChooserDialog.chooseFiles(this.getOwner(), BImage.make((String)lex.getText("LicensePlatformServicePlugin.importFileDialog.icon")), lex.getText("LicensePlatformServicePlugin.importFileDialog.title"), lex.getText("LicensePlatformServicePlugin.importFileDialog.message", new Object[]{BLicensePlatformServicePlugin.this.hostNameLabel.getText()}), bIFile, licenseFilter, licenseFilter, new LicenseListModel());
Array array = new Array(objectArray);
if ((array = array.filter((IFilter)new LicenseValidator())).size() == 0) {
return;
}
LicenseInfo[] licenseInfoArray = PortalLicenseUtil.getLicenseInfo((BIFile[])array.trim(), BLicensePlatformServicePlugin.this.hostId, BLicensePlatformServicePlugin.this.brandId);
LicenseInfo[] licenseInfoArray2 = (LicenseInfo[])BLicensePlatformServicePlugin.this.licenseModel.getInfo();
LicenseSync licenseSync = PortalLicenseUtil.syncLicenses(BLicensePlatformServicePlugin.this.hostId, licenseInfoArray2, licenseInfoArray);
BLicensePlatformServicePlugin.this.sync(licenseSync, null);
}
public void requestLicense() {
UiUtil.requestLicense(this.getOwner().getShell(), BLicensePlatformServicePlugin.this.hostId);
}
public void getOnline() throws Exception {
int n;
LicenseInfo[] licenseInfoArray = (LicenseInfo[])BLicensePlatformServicePlugin.this.licenseModel.getInfo();
CertificateInfo[] certificateInfoArray = (CertificateInfo[])BLicensePlatformServicePlugin.this.certModel.getInfo();
LicenseInfo[] licenseInfoArray2 = null;
CertificateInfo[] certificateInfoArray2 = null;
HashSet<String> hashSet = new HashSet<String>();
for (n = 0; n < licenseInfoArray.length; ++n) {
hashSet.add(licenseInfoArray[n].vendorLicense.getVendor());
}
for (n = 0; n < certificateInfoArray.length; ++n) {
hashSet.add(certificateInfoArray[n].vendorCertificate.getVendor());
}
n = 1;
LicenseSync licenseSync = null;
LicenseSync licenseSync2 = null;
try {
licenseInfoArray2 = LicenseInfo.make(PortalLicenseUtil.getExistingLicenses(BLicensePlatformServicePlugin.this.hostId, BLicensePlatformServicePlugin.this.brandId));
licenseSync = PortalLicenseUtil.syncLicenses(BLicensePlatformServicePlugin.this.hostId, licenseInfoArray, licenseInfoArray2);
for (int i = 0; i < licenseInfoArray2.length; ++i) {
hashSet.add(licenseInfoArray2[i].vendorLicense.getVendor());
}
n = licenseSync.unchanged() && LicenseInfo.countActiveLicenses(licenseInfoArray, BAbsTime.now()) == 0 ? 1 : 0;
}
catch (Exception exception) {
// empty catch block
}
try {
String[] stringArray = new String[hashSet.size()];
hashSet.toArray(stringArray);
certificateInfoArray2 = CertificateInfo.make(PortalLicenseUtil.getCertificates(stringArray));
licenseSync2 = PortalLicenseUtil.syncCertificates(certificateInfoArray, certificateInfoArray2);
}
catch (Exception exception) {
// empty catch block
}
try {
BLicensePlatformServicePlugin.this.sync(licenseSync, licenseSync2);
}
catch (Exception exception) {
// empty catch block
}
if (n != 0) {
BRequestLicenseTool.requestLicense((BWidget)BLicensePlatformServicePlugin.this.getWbShell(), (String)BLicensePlatformServicePlugin.this.hostId);
}
}
public void doInvokeAsync() {
try {
if (Nre.bootEnv.isRemote()) {
this.importFile();
return;
}
BGridPane bGridPane = new BGridPane(1);
ToggleCommandGroup toggleCommandGroup = new ToggleCommandGroup();
BRadioButton bRadioButton = new BRadioButton(toggleCommandGroup, lex.getText("LicensePlatformServicePlugin.importType.file"), true);
bGridPane.add(null, (BValue)bRadioButton);
BRadioButton bRadioButton2 = new BRadioButton(toggleCommandGroup, lex.getText("LicensePlatformServicePlugin.importType.localDb"), false);
bGridPane.add(null, (BValue)bRadioButton2);
LicenseInfo[] licenseInfoArray = (LicenseInfo[])BLicensePlatformServicePlugin.this.licenseModel.getInfo();
LicenseInfo[] licenseInfoArray2 = BLicensePlatformServicePlugin.this.getDatabaseLicenses();
LicenseSync licenseSync = PortalLicenseUtil.syncLicenses(BLicensePlatformServicePlugin.this.hostId, licenseInfoArray, licenseInfoArray2);
if (licenseSync.unchanged()) {
bRadioButton2.setEnabled(false);
}
BRadioButton bRadioButton3 = new BRadioButton(toggleCommandGroup, lex.getText("LicensePlatformServicePlugin.importType.getOnline"), false);
BRadioButton bRadioButton4 = new BRadioButton(toggleCommandGroup, lex.getText("LicensePlatformServicePlugin.importType.requestLicense"), false);
if (PortalLicenseUtil.isApiAvailable()) {
if (PortalLicenseUtil.requestLicensesOnline()) {
bGridPane.add(null, (BValue)bRadioButton3);
} else {
bGridPane.add(null, (BValue)bRadioButton4);
}
}
if (1 == BDialog.open((BWidget)this.getOwner(), (String)lex.getText("LicensePlatformServicePlugin.importType.dlgTitle"), (Object)new BBorderPane((BWidget)bGridPane, 10.0, 10.0, 10.0, 10.0), (int)3)) {
if (bRadioButton.isSelected()) {
this.importFile();
} else if (bRadioButton2.isSelected()) {
BLicensePlatformServicePlugin.this.sync(licenseSync, null);
} else if (bRadioButton3.isSelected()) {
this.getOnline();
} else if (bRadioButton4.isSelected()) {
this.requestLicense();
}
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
}
}
private class ExportCommand
extends AsyncCommand {
public ExportCommand(BList bList) {
super((BWidget)bList, TYPE.getModule(), "LicensePlatformServicePlugin.exportLicense");
}
public void doInvokeAsync() {
try {
BDirectory bDirectory = BFileSystem.INSTANCE.getSysHome();
FilePath filePath = BFileChooserDialog.chooseFilePath(this.getOwner(), BImage.make((String)lex.getText("LicensePlatformServicePlugin.exportDialog.icon")), lex.getText("LicensePlatformServicePlugin.exportDialog.title"), lex.getText("LicensePlatformServicePlugin.exportDialog.message"), (BIFile)bDirectory, larFilter, larPathFilter, new LicenseListModel(), "licenses.lar");
if (filePath != null) {
BLicenseArchiveFile bLicenseArchiveFile = (BLicenseArchiveFile)BFileSystem.INSTANCE.findFile(filePath);
if (bLicenseArchiveFile == null) {
bLicenseArchiveFile = (BLicenseArchiveFile)BFileSystem.INSTANCE.makeFile(filePath);
} else if (8 == BDialog.confirm((BWidget)this.getOwner(), (String)lex.getText("LicensePlatformServicePlugin.replaceFileDialog.title"), (Object)lex.getText("LicensePlatformServicePlugin.replaceFileDialog.message", new Object[]{filePath.getName()}))) {
return;
}
if (filePath.getParent().getBody().equals(LicenseInfo.LICENSES_PATH.getBody())) {
BLicensePlatformServicePlugin.this.licenseModel.reload();
}
int[] nArray = BLicensePlatformServicePlugin.this.licenseModel.getSelection().getItems();
VendorLicense[] vendorLicenseArray = new VendorLicense[nArray.length];
for (int i = 0; i < nArray.length; ++i) {
vendorLicenseArray[i] = ((LicenseInfo)((BLicensePlatformServicePlugin)BLicensePlatformServicePlugin.this).licenseModel.getInfo((int)nArray[i])).vendorLicense;
}
bLicenseArchiveFile.writeLicenses(vendorLicenseArray);
BDialog.message((BWidget)this.getOwner(), (String)lex.getText("LicensePlatformServicePlugin.fileWrittenDialog.title"), (Object)lex.getText("LicensePlatformServicePlugin.fileWrittenDialog.message", new Object[]{filePath.getName()}));
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
}
}
public static class LicenseListModel
extends BFileChooserListView.ListModel {
public int getColumnCount() {
return 2;
}
public String getColumnName(int n) {
switch (n) {
case 0: {
return UiLexicon.bajaui.getText("fileChooser.name");
}
case 1: {
return lex.getText("LicensePlatformServicePlugin.hostIdLabel");
}
}
return "";
}
public Object getValueAt(int n, int n2) {
BIFile bIFile = (BIFile)this.kids[n];
switch (n2) {
case 0: {
return super.getValueAt(n, n2);
}
case 1: {
try {
if (bIFile.getExtension() == null || !(bIFile instanceof BLicenseFile)) {
return "";
}
LicenseInfo licenseInfo = new LicenseInfo(bIFile);
return licenseInfo.vendorLicense.getHostId();
}
catch (Exception exception) {
return "";
}
}
}
return null;
}
}
private class LicenseValidator
implements IFileFilter,
IFilter {
private LicenseValidator() {
}
public boolean accept(Object object) {
if (object instanceof BIFile) {
return this.accept((BIFile)object);
}
return false;
}
public boolean accept(BIFile bIFile) {
try {
if (bIFile instanceof BLicenseFile) {
LicenseInfo licenseInfo = new LicenseInfo(bIFile);
if (BLicensePlatformServicePlugin.this.hostId.equals(licenseInfo.vendorLicense.getHostId())) {
if (BLicensePlatformServicePlugin.this.brandId != null && licenseInfo.vendorLicense.getBrandId() != null && !BLicensePlatformServicePlugin.this.brandId.equals(licenseInfo.vendorLicense.getBrandId())) {
BDialog.error((BWidget)BLicensePlatformServicePlugin.this, (String)lex.getText("LicensePlatformServicePlugin.cantChangeBrand.title"), (Object)lex.getText("LicensePlatformServicePlugin.cantChangeBrand.message", new Object[]{licenseInfo}));
return false;
}
if (licenseInfo.allowsLocalWbAccess()) {
return true;
}
BDialog.error((BWidget)BLicensePlatformServicePlugin.this, (String)lex.getText("LicensePlatformServicePlugin.noAccess.title"), (Object)lex.getText("LicensePlatformServicePlugin.noAccess.message", new Object[]{licenseInfo}));
return false;
}
BDialog.error((BWidget)BLicensePlatformServicePlugin.this, (String)lex.getText("LicensePlatformServicePlugin.badHostId.title"), (Object)lex.getText("LicensePlatformServicePlugin.badHostId.message", new Object[]{licenseInfo}));
return false;
}
if (bIFile instanceof BLicenseArchiveFile) {
VendorLicense[] vendorLicenseArray = ((BLicenseArchiveFile)bIFile).getLicenses(BLicensePlatformServicePlugin.this.hostId);
int n = 0;
for (int i = 0; i < vendorLicenseArray.length; ++i) {
if (BLicensePlatformServicePlugin.this.brandId != null && vendorLicenseArray[i].getBrandId() != null && !BLicensePlatformServicePlugin.this.brandId.equals(vendorLicenseArray[i].getBrandId())) continue;
LicenseInfo licenseInfo = new LicenseInfo(vendorLicenseArray[i], bIFile);
if (!licenseInfo.allowsLocalWbAccess()) {
BDialog.error((BWidget)BLicensePlatformServicePlugin.this, (String)lex.getText("LicensePlatformServicePlugin.noAccess.title"), (Object)lex.getText("LicensePlatformServicePlugin.noAccess.message", new Object[]{licenseInfo}));
return false;
}
++n;
}
if (n == 0) {
BDialog.error((BWidget)BLicensePlatformServicePlugin.this, (String)lex.getText("LicensePlatformServicePlugin.noHostLicenses.title"), (Object)lex.getText("LicensePlatformServicePlugin.noHostLicenses.message"));
return false;
}
return true;
}
return false;
}
catch (Exception exception) {
throw new LocalizableRuntimeException("platform", "LicensePlatformServicePlugin.addLicenseException", (Throwable)exception);
}
}
public String getDescription(Context context) {
return "TODO";
}
}
private class FileListController
extends CommandBindings.ListController {
public FileListController(CommandBindings commandBindings) {
super(commandBindings);
}
public void focusGained(BFocusEvent bFocusEvent) {
BLicensePlatformServicePlugin.this.setTransferWidget((BTransferWidget)this.getList());
if (this.getList() == BLicensePlatformServicePlugin.this.certs) {
BLicensePlatformServicePlugin.this.licenses.getSelection().deselectAll();
} else {
BLicensePlatformServicePlugin.this.certs.getSelection().deselectAll();
}
}
}
}
@@ -0,0 +1,58 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.license.LicenseUtil
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.license;
import com.tridium.platform.license.BVendorLicenseSummary;
import com.tridium.sys.license.LicenseUtil;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BVendorLicenseSummaryFE
extends BWbFieldEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BVendorLicenseSummaryFE == null ? (class$com$tridium$platform$ui$license$BVendorLicenseSummaryFE = BVendorLicenseSummaryFE.class$("com.tridium.platform.ui.license.BVendorLicenseSummaryFE")) : class$com$tridium$platform$ui$license$BVendorLicenseSummaryFE));
protected BTextField text = new BTextField("", 41, false);
static /* synthetic */ Class class$com$tridium$platform$ui$license$BVendorLicenseSummaryFE;
public Type getType() {
return TYPE;
}
public BVendorLicenseSummaryFE() {
this.setContent((BWidget)this.text);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BVendorLicenseSummary bVendorLicenseSummary = (BVendorLicenseSummary)bObject;
this.text.setText(this.getLexicon().getText("VendorLicenseSummaryFE.text", new Object[]{LicenseUtil.formatDate((long)bVendorLicenseSummary.getLicenseGenerated()), LicenseUtil.formatDate((long)bVendorLicenseSummary.getLicenseExpires())}));
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
return bObject;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,93 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.gx.BInsets
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BWidget
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BScrollPane
* javax.baja.ui.pane.BSplitPane
* javax.baja.ui.text.BTextEditor
* javax.baja.ui.transfer.BTransferWidget
* javax.baja.workbench.view.BWbView
*/
package com.tridium.platform.ui.license;
import com.tridium.platform.license.BLicenseArchiveFile;
import com.tridium.platform.ui.license.BWorkbenchLicenseTree;
import com.tridium.platform.ui.util.BButtonPane;
import javax.baja.gx.BInsets;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
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.BBorder;
import javax.baja.ui.BWidget;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.ui.pane.BSplitPane;
import javax.baja.ui.text.BTextEditor;
import javax.baja.ui.transfer.BTransferWidget;
import javax.baja.workbench.view.BWbView;
public class BWorkbenchLicenseManager
extends BWbView {
public static final Action handleTreeValueUpdated = BWorkbenchLicenseManager.newAction((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BWorkbenchLicenseManager == null ? (class$com$tridium$platform$ui$license$BWorkbenchLicenseManager = BWorkbenchLicenseManager.class$("com.tridium.platform.ui.license.BWorkbenchLicenseManager")) : class$com$tridium$platform$ui$license$BWorkbenchLicenseManager));
private BTextEditor details;
private BWorkbenchLicenseTree tree = new BWorkbenchLicenseTree();
static /* synthetic */ Class class$com$tridium$platform$ui$license$BWorkbenchLicenseManager;
public void handleTreeValueUpdated() {
this.invoke(handleTreeValueUpdated, null, null);
}
public Type getType() {
return TYPE;
}
public BWorkbenchLicenseManager() {
this.linkTo(null, (BComponent)this.tree, (Slot)BWorkbenchLicenseTree.valueUpdated, (Slot)handleTreeValueUpdated);
this.details = new BTextEditor("", false);
BScrollPane bScrollPane = new BScrollPane((BWidget)this.details);
BSplitPane bSplitPane = new BSplitPane((BWidget)new BBorderPane((BWidget)new BScrollPane((BWidget)this.tree), BBorder.inset, BInsets.DEFAULT), (BWidget)new BBorderPane((BWidget)bScrollPane, BBorder.inset, BInsets.DEFAULT));
bSplitPane.setDividerPosition(33.0);
this.setContent((BWidget)new BEdgePane(null, (BWidget)new BButtonPane(this.tree.getCommands(), true, false), null, null, (BWidget)new BBorderPane((BWidget)new BBorderPane((BWidget)bSplitPane, 10.0, 0.0, 4.0, 0.0), 4.0, 10.0, 4.0, 10.0)));
this.setTransferWidget((BTransferWidget)this.tree);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
if (bObject instanceof BLicenseArchiveFile) {
this.tree.importLicenseArchive((BLicenseArchiveFile)bObject, context);
} else {
this.tree.load(context);
}
}
public void doHandleTreeValueUpdated(Context context) throws Exception {
this.details.setText(this.tree.getDetailsText());
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,639 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.file.types.text.BLicenseFile
* com.tridium.sys.license.dom.CertificateDatabase
* com.tridium.sys.license.dom.LicenseDatabase
* com.tridium.sys.license.dom.VendorCertificate
* com.tridium.sys.license.dom.VendorLicense
* 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.nre.util.Array
* javax.baja.space.Mark
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Topic
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.enums.BHalign
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.transfer.TransferContext
* javax.baja.ui.transfer.TransferFormat
* javax.baja.ui.tree.BTree
* javax.baja.ui.tree.TreeModel
* javax.baja.ui.tree.TreeNode
* javax.baja.ui.util.UiLexicon
* javax.baja.util.Lexicon
*/
package com.tridium.platform.ui.license;
import com.tridium.file.types.text.BLicenseFile;
import com.tridium.platform.license.BEnvLicenseSummary;
import com.tridium.platform.license.BLicenseArchiveFile;
import com.tridium.platform.license.LicenseInfo;
import com.tridium.platform.license.PortalLicenseUtil;
import com.tridium.platform.ui.util.AsyncCommand;
import com.tridium.platform.ui.util.BBox;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.platform.ui.util.BFileChooserDialog;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.platform.ui.util.ExtPathFilter;
import com.tridium.platform.ui.util.FavoriteDirectory;
import com.tridium.platform.ui.util.IFilePathFilter;
import com.tridium.sys.license.dom.CertificateDatabase;
import com.tridium.sys.license.dom.LicenseDatabase;
import com.tridium.sys.license.dom.VendorCertificate;
import com.tridium.sys.license.dom.VendorLicense;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeMap;
import java.util.TreeSet;
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.nre.util.Array;
import javax.baja.space.Mark;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Topic;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
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.file.ExtFileFilter;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.transfer.TransferContext;
import javax.baja.ui.transfer.TransferFormat;
import javax.baja.ui.tree.BTree;
import javax.baja.ui.tree.TreeModel;
import javax.baja.ui.tree.TreeNode;
import javax.baja.ui.util.UiLexicon;
import javax.baja.util.Lexicon;
public class BWorkbenchLicenseTree
extends BTree {
public static final Action handleSelectionModified = BWorkbenchLicenseTree.newAction((int)0, null);
public static final Topic valueUpdated = BWorkbenchLicenseTree.newTopic((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$license$BWorkbenchLicenseTree == null ? (class$com$tridium$platform$ui$license$BWorkbenchLicenseTree = BWorkbenchLicenseTree.class$("com.tridium.platform.ui.license.BWorkbenchLicenseTree")) : class$com$tridium$platform$ui$license$BWorkbenchLicenseTree));
private static final BIcon HOST_ICON = BIcon.std((String)"host.png");
private static final BIcon LICENSE_ICON = BIcon.std((String)"file.png");
private static final IFileFilter LAR_FILTER = new ExtFileFilter("TODO", "lar");
private static final IFilePathFilter LAR_PATH_FILTER = new ExtPathFilter("lar");
private static final IFileFilter LICENSE_FILTER = new ExtFileFilter("TODO", "license,lar");
private static final Lexicon LEX = Lexicon.make((String)"platform");
private Command importFile = new ImportFile();
private Command exportFile = new ExportFile();
private Command delete = new Delete();
private SyncOnline syncOnline = new SyncOnline();
static /* synthetic */ Class class$com$tridium$platform$ui$license$BWorkbenchLicenseTree;
static /* synthetic */ Class class$com$tridium$sys$license$dom$VendorLicense;
static /* synthetic */ Class class$com$tridium$platform$license$BEnvLicenseSummary;
public void handleSelectionModified() {
this.invoke(handleSelectionModified, null, null);
}
public void fireValueUpdated(BValue bValue) {
this.fire(valueUpdated, bValue, null);
}
public Type getType() {
return TYPE;
}
public BWorkbenchLicenseTree() {
this.setModel(new Model());
this.setMultipleSelection(true);
this.linkTo(null, (BComponent)this, (Slot)BTree.selectionModified, (Slot)handleSelectionModified);
}
public String getDetailsText() throws Exception {
TreeNode[] treeNodeArray = this.getSelection().getNodes();
if (treeNodeArray.length == 1 && treeNodeArray[0] instanceof LicenseNode) {
return ((LicenseNode)treeNodeArray[0]).getContents();
}
return "";
}
public void importLicenseArchive(BLicenseArchiveFile bLicenseArchiveFile, Context context) throws Exception {
LicenseDatabase.LOCAL_INSTANCE.importFile((BIFile)bLicenseArchiveFile);
this.load(context);
BDialog.message((BWidget)this, (Object)LEX.getText("WorkbenchLicenseTree.importFile.success"));
}
public void load(Context context) throws Exception {
((Model)this.getModel()).load(context);
}
public void reload() throws Exception {
((Model)this.getModel()).reload();
}
public Command[] getCommands() {
if (PortalLicenseUtil.requestLicensesOnline()) {
return new Command[]{this.importFile, this.exportFile, this.delete, this.syncOnline};
}
return new Command[]{this.importFile, this.exportFile, this.delete};
}
public int dragOver(TransferContext transferContext) {
if (transferContext.isCopy() && transferContext.getEnvelope().supports(TransferFormat.mark)) {
Mark mark = (Mark)transferContext.getEnvelope().getData(TransferFormat.mark);
BObject[] bObjectArray = mark.getValues();
for (int i = 0; i < bObjectArray.length; ++i) {
if (!(bObjectArray[i] instanceof BLicenseFile) && !(bObjectArray[i] instanceof BLicenseArchiveFile)) continue;
return 16;
}
}
return 0;
}
public CommandArtifact drop(TransferContext transferContext) throws Exception {
if (transferContext.isCopy() && transferContext.getEnvelope().supports(TransferFormat.mark)) {
Mark mark = (Mark)transferContext.getEnvelope().getData(TransferFormat.mark);
BObject[] bObjectArray = mark.getValues();
boolean bl = false;
for (int i = 0; i < bObjectArray.length; ++i) {
if (!(bObjectArray[i] instanceof BLicenseFile) && !(bObjectArray[i] instanceof BLicenseArchiveFile)) continue;
LicenseDatabase.LOCAL_INSTANCE.importFile((BIFile)bObjectArray[i]);
bl = true;
}
if (bl) {
this.load((Context)transferContext);
BDialog.message((BWidget)this, (Object)LEX.getText("WorkbenchLicenseTree.importFile.success"));
}
}
return null;
}
public void doHandleSelectionModified() {
TreeNode[] treeNodeArray = this.getSelection().getNodes();
this.delete.setEnabled(treeNodeArray.length > 0);
this.fireValueUpdated(null);
}
private String[] getSelectedHostIds() {
TreeNode[] treeNodeArray = this.getSelection().getNodes();
HashSet<String> hashSet = new HashSet<String>();
for (int i = 0; i < treeNodeArray.length; ++i) {
if (treeNodeArray[i] instanceof HostNode) {
hashSet.add(((HostNode)treeNodeArray[i]).getHostId());
continue;
}
hashSet.add(((LicenseNode)treeNodeArray[i]).getHostId());
}
String[] stringArray = new String[hashSet.size()];
hashSet.toArray(stringArray);
return stringArray;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private class SyncOnline
extends AsyncCommand {
public boolean canceled = false;
public SyncOnline() {
super((BWidget)BWorkbenchLicenseTree.this, LEX.getText("WorkbenchLicenseTree.syncOnline.label"), null, null, LEX.getText("WorkbenchLicenseTree.syncOnline.description"));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public void doInvokeAsync() {
block21: {
try {
TreeNode[] treeNodeArray = BWorkbenchLicenseTree.this.getSelection().getNodes();
int n = 0;
int n2 = 0;
if (treeNodeArray.length == 0) {
if (4 != BDialog.confirm((BWidget)BWorkbenchLicenseTree.this, (String)LEX.getText("WorkbenchLicenseTree.syncAll.confirmTitle"), (Object)LEX.getText("WorkbenchLicenseTree.syncAll.confirmMessage"))) {
return;
}
this.canceled = false;
BLabel bLabel = new BLabel(LEX.getText("WorkbenchLicenseTree.syncAll.working", new Object[]{"0"}));
bLabel.setHalign(BHalign.left);
BDialog bDialog = new BDialog(this.getOwner(), LEX.getText("WorkbenchLicenseTree.syncAll.workingTitle"), false, (BWidget)new BEdgePane((BWidget)new BBox(300.0, 0.0), (BWidget)new BBorderPane((BWidget)new BButtonPane(new Command[]{new CancelSync()}), 0.0, 10.0, 10.0, 10.0), null, null, (BWidget)new BBorderPane((BWidget)bLabel, 10.0, 10.0, 10.0, 10.0)));
bDialog.setBoundsCenteredOnOwner();
bDialog.open();
try {
Array array = new Array(class$com$tridium$sys$license$dom$VendorLicense == null ? (class$com$tridium$sys$license$dom$VendorLicense = BWorkbenchLicenseTree.class$("com.tridium.sys.license.dom.VendorLicense")) : class$com$tridium$sys$license$dom$VendorLicense);
VendorCertificate[] vendorCertificateArray = LicenseDatabase.LOCAL_INSTANCE.iterator();
while (vendorCertificateArray.hasNext()) {
if (this.canceled) {
array.clear();
break;
}
array.add(vendorCertificateArray.next());
if (array.size() < 100) continue;
VendorLicense[] vendorLicenseArray = PortalLicenseUtil.getPortalUpdates((VendorLicense[])array.trim());
for (int i = 0; i < vendorLicenseArray.length; ++i) {
if (!LicenseDatabase.LOCAL_INSTANCE.add(vendorLicenseArray[i])) continue;
bLabel.setText(LEX.getText("WorkbenchLicenseTree.syncAll.working", new Object[]{String.valueOf(++n)}));
}
array.clear();
}
if (array.size() > 0) {
vendorCertificateArray = PortalLicenseUtil.getPortalUpdates((VendorLicense[])array.trim());
for (int i = 0; i < vendorCertificateArray.length; ++i) {
if (!LicenseDatabase.LOCAL_INSTANCE.add((VendorLicense)vendorCertificateArray[i])) continue;
bLabel.setText(LEX.getText("WorkbenchLicenseTree.syncAll.working", new Object[]{String.valueOf(++n)}));
}
}
vendorCertificateArray = PortalLicenseUtil.getPortalUpdates(CertificateDatabase.LOCAL_INSTANCE.getCertificates());
for (int i = 0; i < vendorCertificateArray.length; ++i) {
if (!CertificateDatabase.LOCAL_INSTANCE.add(vendorCertificateArray[i])) continue;
bLabel.setText(LEX.getText("WorkbenchLicenseTree.syncAll.cert.working", new Object[]{String.valueOf(++n2)}));
}
}
finally {
bDialog.close();
}
if (n > 0 || n2 > 0) {
BWorkbenchLicenseTree.this.reload();
}
BDialog.message((BWidget)this.getOwner(), (String)LEX.getText("WorkbenchLicenseTree.syncOnline.completeTitle"), (Object)new BEdgePane((BWidget)new BBox(300.0, 1.0), null, null, null, (BWidget)new BLabel(LEX.getText("WorkbenchLicenseTree.syncOnline.completeMessage", new Object[]{String.valueOf(n), String.valueOf(n2)}), BHalign.left)));
break block21;
}
Array array = new Array(class$com$tridium$platform$license$BEnvLicenseSummary == null ? (class$com$tridium$platform$license$BEnvLicenseSummary = BWorkbenchLicenseTree.class$("com.tridium.platform.license.BEnvLicenseSummary")) : class$com$tridium$platform$license$BEnvLicenseSummary);
for (int i = 0; i < treeNodeArray.length; ++i) {
TreeNode treeNode;
if (treeNodeArray[i] instanceof HostNode) {
treeNode = (HostNode)treeNodeArray[i];
LicenseNode[] licenseNodeArray = treeNode.getChildren();
for (int j = 0; j < licenseNodeArray.length; ++j) {
array.add((Object)BEnvLicenseSummary.make(licenseNodeArray[j].getVendorLicense()));
}
continue;
}
treeNode = (LicenseNode)treeNodeArray[i];
array.add((Object)BEnvLicenseSummary.make(treeNode.getVendorLicense()));
}
VendorLicense[] vendorLicenseArray = PortalLicenseUtil.getPortalUpdates((BEnvLicenseSummary[])array.trim());
for (int i = 0; i < vendorLicenseArray.length; ++i) {
if (!LicenseDatabase.LOCAL_INSTANCE.add(vendorLicenseArray[i])) continue;
++n;
}
VendorCertificate[] vendorCertificateArray = PortalLicenseUtil.getPortalUpdates(CertificateDatabase.LOCAL_INSTANCE.getCertificates());
for (int i = 0; i < vendorCertificateArray.length; ++i) {
if (!CertificateDatabase.LOCAL_INSTANCE.add(vendorCertificateArray[i])) continue;
++n2;
}
if (n > 0 || n2 > 0) {
BWorkbenchLicenseTree.this.reload();
}
BDialog.message((BWidget)this.getOwner(), (String)LEX.getText("WorkbenchLicenseTree.syncOnline.completeTitle"), (Object)LEX.getText("WorkbenchLicenseTree.syncOnline.completeMessage", new Object[]{String.valueOf(n), String.valueOf(n2)}));
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
}
}
}
private class CancelSync
extends Command {
public CancelSync() {
super((BWidget)BWorkbenchLicenseTree.this, UiLexicon.bajaui().getText("cancel"), null, null, null);
}
public CommandArtifact doInvoke() {
((BWorkbenchLicenseTree)BWorkbenchLicenseTree.this).syncOnline.canceled = true;
return null;
}
}
private class Delete
extends Command {
public Delete() {
super((BWidget)BWorkbenchLicenseTree.this, LEX.getText("WorkbenchLicenseTree.delete.label"), null, null, LEX.getText("WorkbenchLicenseTree.delete.description"));
this.setEnabled(false);
}
public CommandArtifact doInvoke() throws Exception {
TreeNode[] treeNodeArray = BWorkbenchLicenseTree.this.getSelection().getNodes();
if (treeNodeArray.length > 0 && 4 == BDialog.confirm((BWidget)BWorkbenchLicenseTree.this, (String)LEX.getText("WorkbenchLicenseTree.delete.confirmTitle"), (Object)LEX.getText("WorkbenchLicenseTree.delete.confirmMessage"))) {
for (int i = 0; i < treeNodeArray.length; ++i) {
if (treeNodeArray[i] instanceof HostNode) {
for (int j = 0; j < treeNodeArray[i].getChildCount(); ++j) {
LicenseDatabase.LOCAL_INSTANCE.remove(((LicenseNode)treeNodeArray[i].getChild(j)).getVendorLicense());
}
continue;
}
LicenseDatabase.LOCAL_INSTANCE.remove(((LicenseNode)treeNodeArray[i]).getVendorLicense());
}
BWorkbenchLicenseTree.this.getSelection().deselectAll();
BWorkbenchLicenseTree.this.reload();
}
return null;
}
}
private class ExportFile
extends Command {
public ExportFile() {
super((BWidget)BWorkbenchLicenseTree.this, LEX.getText("WorkbenchLicenseTree.exportFile.label"), null, null, LEX.getText("WorkbenchLicenseTree.exportFile.description"));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public CommandArtifact doInvoke() throws Exception {
TreeNode[] treeNodeArray = BWorkbenchLicenseTree.this.getSelection().getNodes();
if (treeNodeArray.length == 0 && 8 == BDialog.confirm((BWidget)BWorkbenchLicenseTree.this, (String)LEX.getText("WorkbenchLicenseTree.exportFile.confirmTitle"), (Object)LEX.getText("WorkbenchLicenseTree.exportFile.confirmMessage"))) {
return null;
}
BDirectory bDirectory = FavoriteDirectory.loadByPath(TYPE.toString(), "larDir", null);
FilePath filePath = BFileChooserDialog.chooseFilePath((BWidget)BWorkbenchLicenseTree.this, null, LEX.getText("WorkbenchLicenseTree.exportFile.title"), LEX.getText("WorkbenchLicenseTree.exportFile.message"), (BIFile)bDirectory, LAR_FILTER, LAR_PATH_FILTER, null, "licenses.lar");
if (filePath == null) {
return null;
}
BIFile bIFile = BFileSystem.INSTANCE.findFile(filePath);
if (bIFile == null) {
bIFile = BFileSystem.INSTANCE.makeFile(filePath);
} else if (8 == BDialog.confirm((BWidget)BWorkbenchLicenseTree.this, (String)LEX.getText("WorkbenchLicenseTree.exportFile.replaceTitle"), (Object)LEX.getText("WorkbenchLicenseTree.exportFile.replaceMessage", new Object[]{filePath.getName()}))) {
return null;
}
FavoriteDirectory.savePath(TYPE.toString(), "larDir", (BDirectory)bIFile.getNavParent());
OutputStream outputStream = bIFile.getOutputStream();
try {
if (treeNodeArray.length == 0) {
LicenseDatabase.LOCAL_INSTANCE.exportLicenses(outputStream);
} else {
LicenseDatabase.LOCAL_INSTANCE.exportLicenses(BWorkbenchLicenseTree.this.getSelectedHostIds(), outputStream);
}
BDialog.message((BWidget)BWorkbenchLicenseTree.this, (Object)LEX.getText("WorkbenchLicenseTree.exportFile.success"));
}
finally {
try {
outputStream.close();
}
catch (Exception exception) {}
}
return null;
}
}
private class ImportFile
extends Command {
public ImportFile() {
super((BWidget)BWorkbenchLicenseTree.this, LEX.getText("WorkbenchLicenseTree.importFile.label"), null, null, LEX.getText("WorkbenchLicenseTree.importFile.description"));
}
public CommandArtifact doInvoke() throws Exception {
BIFile bIFile = BFileChooserDialog.chooseFile((BWidget)BWorkbenchLicenseTree.this, null, LEX.getText("WorkbenchLicenseTree.importFile.title"), LEX.getText("WorkbenchLicenseTree.importFile.message"), (BIFile)FavoriteDirectory.loadByPath(TYPE.toString(), "larDir", null), LICENSE_FILTER, LICENSE_FILTER);
if (bIFile == null) {
return null;
}
LicenseDatabase.LOCAL_INSTANCE.importFile(bIFile);
BWorkbenchLicenseTree.this.reload();
BDialog.message((BWidget)BWorkbenchLicenseTree.this, (Object)LEX.getText("WorkbenchLicenseTree.importFile.success"));
return null;
}
}
private class LicenseNode
extends TreeNode {
private VendorLicense vendorLicense;
private Context cx;
public LicenseNode(HostNode hostNode, VendorLicense vendorLicense, Context context) {
super((TreeNode)hostNode);
this.update(vendorLicense);
this.cx = context;
}
public String getText() {
return LicenseInfo.getSummaryText(this.vendorLicense, this.cx);
}
public boolean update(VendorLicense vendorLicense) {
if (this.vendorLicense == null || !vendorLicense.getSignature().equals(this.vendorLicense.getSignature())) {
this.vendorLicense = vendorLicense;
return true;
}
return false;
}
public BImage getIcon() {
return BImage.make((BIcon)LICENSE_ICON);
}
public int getChildCount() {
return 0;
}
public TreeNode getChild(int n) {
throw new ArrayIndexOutOfBoundsException();
}
public VendorLicense getVendorLicense() {
return this.vendorLicense;
}
public String getHostId() {
return this.getVendorLicense().getHostId();
}
public String getContents() throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
this.vendorLicense.save((OutputStream)byteArrayOutputStream);
return byteArrayOutputStream.toString();
}
}
private class HostNode
extends TreeNode {
private String hostId;
private LicenseNode[] children = null;
private Context cx;
public HostNode(TreeModel treeModel, String string, Context context) {
super(treeModel);
this.hostId = string;
this.cx = context;
}
public String getHostId() {
return this.hostId;
}
public String getText() {
return this.getHostId();
}
public BImage getIcon() {
return BImage.make((BIcon)HOST_ICON);
}
public int getChildCount() {
return this.getChildren().length;
}
public TreeNode getChild(int n) {
return this.getChildren()[n];
}
public synchronized boolean update() throws Exception {
if (this.children == null) {
return false;
}
TreeMap<String, LicenseNode> treeMap = new TreeMap<String, LicenseNode>();
TreeSet<String> treeSet = new TreeSet<String>();
boolean bl = false;
boolean bl2 = false;
for (int i = 0; i < this.children.length; ++i) {
treeSet.add(this.children[i].getText());
treeMap.put(this.children[i].getText(), this.children[i]);
}
VendorLicense[] vendorLicenseArray = LicenseDatabase.LOCAL_INSTANCE.getLicenses(this.hostId);
for (int i = 0; i < vendorLicenseArray.length; ++i) {
String string = LicenseInfo.getSummaryText(vendorLicenseArray[i], this.cx);
LicenseNode licenseNode = (LicenseNode)((Object)treeMap.get(string));
if (licenseNode == null) {
treeMap.put(string, new LicenseNode(this, vendorLicenseArray[i], this.cx));
bl = true;
bl2 = true;
continue;
}
bl = licenseNode.update(vendorLicenseArray[i]) || bl;
treeSet.remove(licenseNode.getText());
}
Iterator iterator = treeSet.iterator();
while (iterator.hasNext()) {
treeMap.remove(iterator.next());
bl2 = true;
bl = true;
}
if (bl2) {
this.children = new LicenseNode[treeMap.size()];
treeMap.values().toArray(this.children);
}
return bl;
}
public LicenseNode[] getChildren() {
try {
if (this.children == null) {
VendorLicense[] vendorLicenseArray = LicenseDatabase.LOCAL_INSTANCE.getLicenses(this.hostId);
this.children = new LicenseNode[vendorLicenseArray.length];
for (int i = 0; i < vendorLicenseArray.length; ++i) {
this.children[i] = new LicenseNode(this, vendorLicenseArray[i], this.cx);
}
}
return this.children;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
}
private class Model
extends TreeModel {
private HostNode[] hostNodes = new HostNode[0];
private Context cx;
private Model() {
}
public synchronized void load(Context context) throws Exception {
int n;
this.cx = context;
String[] stringArray = LicenseDatabase.LOCAL_INSTANCE.getHostIds();
TreeMap<String, HostNode> treeMap = new TreeMap<String, HostNode>();
boolean bl = false;
boolean bl2 = false;
TreeSet<String> treeSet = new TreeSet<String>();
for (n = 0; n < this.hostNodes.length; ++n) {
treeMap.put(this.hostNodes[n].getHostId(), this.hostNodes[n]);
treeSet.add(this.hostNodes[n].getHostId());
}
for (n = 0; n < stringArray.length; ++n) {
HostNode hostNode = (HostNode)((Object)treeMap.get(stringArray[n]));
if (hostNode == null) {
treeMap.put(stringArray[n], new HostNode(this, stringArray[n], context));
bl2 = true;
continue;
}
treeSet.remove(stringArray[n]);
bl = hostNode.update() || bl;
}
Iterator iterator = treeSet.iterator();
while (iterator.hasNext()) {
treeMap.remove(iterator.next());
bl2 = true;
}
if (bl2) {
bl = true;
this.hostNodes = new HostNode[treeMap.size()];
treeMap.values().toArray(this.hostNodes);
}
if (bl) {
this.updateTree();
BWorkbenchLicenseTree.this.fireValueUpdated(null);
}
}
public synchronized void reload() throws Exception {
this.load(this.cx);
}
public int getRootCount() {
return this.hostNodes.length;
}
public TreeNode getRoot(int n) {
return this.hostNodes[n];
}
public Context getContext() {
return this.cx;
}
}
}
@@ -0,0 +1,248 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.fox.sys.file.BFoxFileSpace
* com.tridium.fox.sys.file.BFoxFileStore
* com.tridium.sys.license.dom.LicenseDatabase
* com.tridium.sys.license.dom.VendorLicense
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
* javax.baja.nre.util.ByteBuffer
* javax.baja.sys.BajaRuntimeException
* javax.baja.ui.list.ListModel
* javax.baja.util.Version
*/
package com.tridium.platform.ui.license;
import com.tridium.fox.sys.file.BFoxFileSpace;
import com.tridium.fox.sys.file.BFoxFileStore;
import com.tridium.platform.fox.BLicenseChannel;
import com.tridium.platform.license.CertificateInfo;
import com.tridium.platform.license.IFileInfo;
import com.tridium.platform.license.LicenseInfo;
import com.tridium.platform.license.PortalLicenseUtil;
import com.tridium.sys.license.dom.LicenseDatabase;
import com.tridium.sys.license.dom.VendorLicense;
import java.io.InputStream;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.ByteBuffer;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.ui.list.ListModel;
import javax.baja.util.Version;
public class FileInfoListModel
extends ListModel {
private Array kids = new Array(class$com$tridium$platform$license$IFileInfo == null ? (class$com$tridium$platform$license$IFileInfo = FileInfoListModel.class$("com.tridium.platform.license.IFileInfo")) : class$com$tridium$platform$license$IFileInfo);
private FilePath directoryPath;
private String ext;
private BFileSpace space;
private Class elementClass;
static /* synthetic */ Class class$com$tridium$platform$license$IFileInfo;
public FileInfoListModel(FilePath filePath, String string, Class clazz) {
this.directoryPath = filePath;
this.ext = string;
this.elementClass = clazz;
}
public int getItemCount() {
return this.kids.size();
}
public Object getItem(int n) {
return this.getFileName(n);
}
public IFileInfo getInfo(int n) {
return (IFileInfo)this.kids.get(n);
}
public BIFile getFile(int n) {
return this.getInfo(n).getFile();
}
public String getFileName(int n) {
return this.getFile(n).getFileName();
}
public int getFileSize(int n) {
return (int)this.getFile(n).getSize();
}
public synchronized IFileInfo[] getInfo() {
IFileInfo[] iFileInfoArray = (IFileInfo[])java.lang.reflect.Array.newInstance(this.elementClass, this.getItemCount());
for (int i = 0; i < this.getItemCount(); ++i) {
iFileInfoArray[i] = this.getInfo(i);
}
return iFileInfoArray;
}
public FilePath getFilePath(int n) {
return this.directoryPath.merge(this.getFileName(n));
}
public InputStream getFileContentStream(int n) {
BLicenseChannel bLicenseChannel = this.getChannel();
if (bLicenseChannel != null) {
try {
return bLicenseChannel.read((BFoxFileStore)this.getFile(n).getStore());
}
catch (Exception exception) {
// empty catch block
}
}
try {
return this.getFile(n).getInputStream();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void deleteFiles(int[] nArray) {
try {
BIFile[] bIFileArray = new BIFile[nArray.length];
for (int i = 0; i < bIFileArray.length; ++i) {
this.getFile(nArray[i]).delete();
}
this.reload();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void deleteFile(int n) {
try {
this.getFile(n).delete();
this.kids.remove(n);
this.updateList();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public String getFileContents(int n) {
BLicenseChannel bLicenseChannel = this.getChannel();
if (bLicenseChannel != null) {
try {
ByteBuffer byteBuffer = new ByteBuffer();
byteBuffer.readToEnd(bLicenseChannel.read((BFoxFileStore)this.getFile(n).getStore()));
return new String(byteBuffer.toByteArray());
}
catch (Exception exception) {
// empty catch block
}
}
try {
return new String(this.getFile(n).read());
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void reload() {
this.loadValue(this.space);
}
public synchronized void loadValue(BFileSpace bFileSpace) {
BDirectory bDirectory;
this.kids.clear();
this.space = bFileSpace;
BIFile[] bIFileArray = null;
BLicenseChannel bLicenseChannel = this.getChannel();
if (bLicenseChannel != null) {
try {
if (this.directoryPath.equals((Object)CertificateInfo.CERTS_PATH)) {
bIFileArray = bLicenseChannel.listcertificates((BFoxFileSpace)this.space);
} else if (this.directoryPath.equals((Object)LicenseInfo.LICENSES_PATH)) {
bIFileArray = bLicenseChannel.listlicenses((BFoxFileSpace)this.space);
}
}
catch (Exception exception) {
// empty catch block
}
}
if (bIFileArray == null && (bDirectory = (BDirectory)this.space.findFile(this.directoryPath)) != null) {
bIFileArray = bDirectory.listFiles();
}
for (int i = 0; i < bIFileArray.length; ++i) {
if (bIFileArray[i].getExtension() == null || !bIFileArray[i].getExtension().equals(this.ext)) continue;
try {
InputStream inputStream;
IFileInfo iFileInfo = PortalLicenseUtil.makeFileInfo(bIFileArray[i]);
this.kids.add((Object)iFileInfo);
if (!(iFileInfo instanceof LicenseInfo)) continue;
VendorLicense vendorLicense = null;
try {
if (bLicenseChannel != null) {
inputStream = bLicenseChannel.read((BFoxFileStore)bIFileArray[i].getStore());
vendorLicense = VendorLicense.make((String)bIFileArray[i].getFileName(), (InputStream)inputStream);
}
}
catch (Exception exception) {
// empty catch block
}
if (vendorLicense == null) {
vendorLicense = VendorLicense.make((BIFile)bIFileArray[i]);
}
if ((inputStream = LicenseDatabase.LOCAL_INSTANCE.getLicense(vendorLicense.getHostId(), vendorLicense.getVendor(), vendorLicense.getBrandId())) != null && inputStream.getGenerated() >= vendorLicense.getGenerated()) continue;
LicenseDatabase.LOCAL_INSTANCE.add(vendorLicense);
continue;
}
catch (Exception exception) {
exception.printStackTrace();
}
}
this.updateList();
}
public BLicenseChannel getChannel() {
BLicenseChannel bLicenseChannel = null;
if (this.space instanceof BFoxFileSpace) {
BFoxFileSpace bFoxFileSpace = (BFoxFileSpace)this.space;
try {
Version version = (Version)bFoxFileSpace.getFoxSession().fw(404, (Object)"platform", null, null, null);
if (version != null && version.compareTo((Object)new Version("3.7.201")) != -1) {
bLicenseChannel = (BLicenseChannel)bFoxFileSpace.getFoxSession().getConnection().getChannels().get("license", BLicenseChannel.TYPE);
}
}
catch (Exception exception) {
// empty catch block
}
}
return bLicenseChannel;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,117 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* javax.baja.sys.BModule
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.BWidgetShell
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.util.Lexicon
*/
package com.tridium.platform.ui.license;
import com.tridium.platform.license.IFileInfo;
import com.tridium.platform.license.PortalLicenseUtil;
import com.tridium.ui.theme.Theme;
import java.lang.reflect.Method;
import javax.baja.sys.BModule;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.BWidgetShell;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.util.Lexicon;
public class UiUtil {
public static final Lexicon lex = Lexicon.make((String)"platform");
static /* synthetic */ Class class$javax$baja$ui$BWidgetShell;
static /* synthetic */ Class class$java$lang$String;
public static void requestLicense(BWidgetShell bWidgetShell, String string) {
if (!PortalLicenseUtil.isApiAvailable()) {
throw new UnsupportedOperationException();
}
try {
BModule bModule = Sys.loadModule((String)"portalApi");
Class clazz = bModule.loadClass("com.tridium.portal.wb.LicenseProcedure");
Method method = clazz.getMethod("requestLicense", class$javax$baja$ui$BWidgetShell == null ? (class$javax$baja$ui$BWidgetShell = UiUtil.class$("javax.baja.ui.BWidgetShell")) : class$javax$baja$ui$BWidgetShell, class$java$lang$String == null ? (class$java$lang$String = UiUtil.class$("java.lang.String")) : class$java$lang$String);
method.invoke(null, bWidgetShell, string);
}
catch (Exception exception) {
BDialog.error((BWidget)bWidgetShell, (String)"Error", (Object)"License request failed.", (Throwable)exception);
}
}
public static BWidget buildUpdateDescription(String string, IFileInfo[] iFileInfoArray, IFileInfo[] iFileInfoArray2, IFileInfo[] iFileInfoArray3) {
return UiUtil.buildUpdateDescription(string, null, iFileInfoArray, iFileInfoArray2, iFileInfoArray3);
}
public static BWidget buildUpdateDescription(String string, String string2, IFileInfo[] iFileInfoArray, IFileInfo[] iFileInfoArray2, IFileInfo[] iFileInfoArray3) {
int n;
int n2;
BLabel bLabel;
BEdgePane bEdgePane = new BEdgePane();
BLabel bLabel2 = new BLabel(string);
bLabel2.setHalign(BHalign.left);
bEdgePane.setTop((BWidget)bLabel2);
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.left);
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)bGridPane, 4.0, 4.0, 4.0, 0.0));
if (iFileInfoArray != null && iFileInfoArray.length != 0) {
bLabel = new BLabel(lex.getText("UiUtil.added"));
bLabel.setFont(Theme.label().getBoldText());
bGridPane.add(null, (BValue)bLabel);
n2 = iFileInfoArray.length;
for (n = 0; n < n2; ++n) {
bGridPane.add(null, (BValue)new BBorderPane((BWidget)new BLabel(iFileInfoArray[n].toString()), 0.0, 0.0, 0.0, 10.0));
}
}
if (iFileInfoArray2 != null && iFileInfoArray2.length != 0) {
bLabel = new BLabel(lex.getText("UiUtil.updated"));
bLabel.setFont(Theme.label().getBoldText());
bGridPane.add(null, (BValue)bLabel);
n2 = iFileInfoArray2.length;
for (n = 0; n < n2; ++n) {
bGridPane.add(null, (BValue)new BBorderPane((BWidget)new BLabel(iFileInfoArray2[n].toString()), 0.0, 0.0, 0.0, 10.0));
}
}
if (iFileInfoArray3 != null && iFileInfoArray3.length != 0) {
bLabel = new BLabel(lex.getText("UiUtil.removed"));
bLabel.setFont(Theme.label().getBoldText());
bGridPane.add(null, (BValue)bLabel);
n2 = iFileInfoArray3.length;
for (n = 0; n < n2; ++n) {
bGridPane.add(null, (BValue)new BBorderPane((BWidget)new BLabel(iFileInfoArray3[n].toString()), 0.0, 0.0, 0.0, 10.0));
}
}
if (string2 != null) {
bLabel2 = new BLabel(string2);
bLabel2.setHalign(BHalign.left);
bEdgePane.setBottom((BWidget)bLabel2);
}
return bEdgePane;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,169 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* com.tridium.workbench.fieldeditors.BBooleanFE
* javax.baja.gx.BBrush
* javax.baja.gx.BInsets
* javax.baja.naming.BOrd
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.enums.BValign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BScrollPane
* javax.baja.util.LexiconText
* javax.baja.workbench.fieldeditor.BWbFieldEditor
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.ntp.BNtpPlatformService;
import com.tridium.platform.ui.ntp.BNtpServerVectorFE;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.platform.win32.BNtpPlatformServiceWin32;
import com.tridium.ui.theme.Theme;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import javax.baja.gx.BBrush;
import javax.baja.gx.BInsets;
import javax.baja.naming.BOrd;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BBorder;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.enums.BValign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.util.LexiconText;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
import javax.baja.workbench.view.BWbComponentView;
public abstract class BNtpPlatformServiceEditor
extends BWbComponentView {
public static final Action onEnabledChanged = BNtpPlatformServiceEditor.newAction((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditor == null ? (class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditor = BNtpPlatformServiceEditor.class$("com.tridium.platform.ui.ntp.BNtpPlatformServiceEditor")) : class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditor));
protected BGridPane ledgerPane;
protected BNtpServerVectorFE serversFe;
protected BButtonPane buttonPane;
protected BBooleanFE enabledFe;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditor;
public void onEnabledChanged() {
this.invoke(onEnabledChanged, null, null);
}
public Type getType() {
return TYPE;
}
public BNtpPlatformServiceEditor() {
this.autoRegisterForComponentEvents = false;
this.ledgerPane = new BGridPane(2);
this.ledgerPane.setHalign(BHalign.left);
this.ledgerPane.setValign(BValign.top);
this.ledgerPane.setColumnGap(10.0);
this.ledgerPane.setRowGap(6.0);
this.ledgerPane.setColorRows(true);
this.enabledFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformService.enabled.label"), (BWidget)this.enabledFe);
this.linkTo(null, (BComponent)this.enabledFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.enabledFe, (Slot)BWbFieldEditor.pluginModified, (Slot)onEnabledChanged);
BWidget[] bWidgetArray = new BWidget[1];
this.serversFe = new BNtpServerVectorFE();
bWidgetArray[0] = this.serversFe;
BGridPane bGridPane = new BGridPane(bWidgetArray);
this.linkTo(null, (BComponent)this.serversFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
bGridPane.setHalign(BHalign.left);
bGridPane.setValign(BValign.top);
BBorderPane bBorderPane = new BBorderPane((BWidget)this.ledgerPane);
bBorderPane.setBorder(BBorder.solid);
bBorderPane.setLabel((BWidget)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.settings.label"), true));
bBorderPane.setMargin(BInsets.make((double)0.0, (double)0.0, (double)6.0, (double)0.0));
BBorderPane bBorderPane2 = new BBorderPane((BWidget)bGridPane);
bBorderPane2.setBorder(BBorder.solid);
bBorderPane2.setLabel((BWidget)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.timeServers.label"), true));
BBrush bBrush = Theme.scrollPane().getControlBackground();
BScrollPane bScrollPane = new BScrollPane((BWidget)new BBorderPane((BWidget)new BEdgePane((BWidget)bBorderPane, null, null, null, (BWidget)bBorderPane2)));
bScrollPane.setViewportBackground(bBrush);
this.buttonPane = new BButtonPane();
this.setContent((BWidget)new BEdgePane(null, (BWidget)new BBorderPane((BWidget)this.buttonPane, 5.0, 5.0, 0.0, 5.0), null, null, (BWidget)new BBorderPane((BWidget)bScrollPane, BBorder.inset, BInsets.DEFAULT)));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
Context context2 = context == null ? new BasicContext() : context;
BNtpPlatformService bNtpPlatformService = (BNtpPlatformService)bObject;
bNtpPlatformService.lease(Integer.MAX_VALUE);
bNtpPlatformService.poll();
this.buttonPane.removeAll();
this.buttonPane.addWorkbenchButtons((BWidget)this);
this.enabledFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformService.getEnabled()), context2);
this.serversFe.loadValue((BObject)bNtpPlatformService.getTimeServers(), context2);
this.doSetReadonly(this.isReadonly());
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpPlatformService bNtpPlatformService = (BNtpPlatformService)bObject;
this.doValidate(bNtpPlatformService, context);
boolean bl = !(bNtpPlatformService instanceof BNtpPlatformServiceWin32);
bNtpPlatformService.setEnabled(((BBoolean)this.enabledFe.saveValue()).getBoolean());
this.serversFe.saveValue(context);
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bNtpPlatformService);
if (bSystemPlatformService.getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
bNtpPlatformService.savePlatformServiceProperties();
if (bl && 4 == BDialog.confirm((BWidget)this, (String)this.getLexicon().getText("NtpPlatformService.rebootRequired.dlgTitle"), (Object)this.getLexicon().getText("NtpPlatformService.rebootRequired.dlgMessage"), (int)12)) {
bSystemPlatformService.reboot();
}
}
return bNtpPlatformService;
}
protected void doValidate(BNtpPlatformService bNtpPlatformService, Context context) throws Exception {
this.serversFe.doValidate(context);
}
protected void doSetReadonly(boolean bl) {
this.enabledFe.setReadonly(bl);
this.serversFe.setReadonly(bl);
this.serversFe.setEnabled(!bl);
}
public void doOnEnabledChanged(Context context) throws Exception {
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,156 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* javax.baja.naming.BOrd
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.util.LexiconText
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.linux.BNtpPlatformServiceLinux;
import com.tridium.platform.ui.ntp.BNtpPlatformServiceEditor;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import javax.baja.naming.BOrd;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.util.LexiconText;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BNtpPlatformServiceEditorLinux
extends BNtpPlatformServiceEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorLinux == null ? (class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorLinux = BNtpPlatformServiceEditorLinux.class$("com.tridium.platform.ui.ntp.BNtpPlatformServiceEditorLinux")) : class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorLinux));
protected BBooleanFE statsFe;
protected BBooleanFE ntpFe;
protected BBooleanFE localBackupFe;
protected BBooleanFE monitorFe;
protected BBooleanFE authFe;
protected BWbFieldEditor revokeIntervalFe;
protected BWbFieldEditor autokeyRegenIntervalFe;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorLinux;
public Type getType() {
return TYPE;
}
public BNtpPlatformServiceEditorLinux() {
this.autoRegisterForComponentEvents = false;
this.ntpFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.ntp.label"), (BWidget)this.ntpFe);
this.linkTo(null, (BComponent)this.ntpFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.localBackupFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.localBackup.label"), (BWidget)this.localBackupFe);
this.linkTo(null, (BComponent)this.localBackupFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.statsFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.stats.label"), (BWidget)this.statsFe);
this.linkTo(null, (BComponent)this.statsFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.authFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.auth.label"), (BWidget)this.authFe);
this.linkTo(null, (BComponent)this.authFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.autokeyRegenIntervalFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceLinux.autokey.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.autoKeyRegen.label"), (BWidget)this.autokeyRegenIntervalFe);
this.linkTo(null, (BComponent)this.autokeyRegenIntervalFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.revokeIntervalFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceLinux.revoke.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.autoKeyRevoke.label"), (BWidget)this.revokeIntervalFe);
this.linkTo(null, (BComponent)this.revokeIntervalFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.monitorFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.monitor.label"), (BWidget)this.monitorFe);
this.linkTo(null, (BComponent)this.monitorFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
Context context2 = context == null ? new BasicContext() : context;
BNtpPlatformServiceLinux bNtpPlatformServiceLinux = (BNtpPlatformServiceLinux)bObject;
bNtpPlatformServiceLinux.lease(Integer.MAX_VALUE);
bNtpPlatformServiceLinux.poll();
super.doLoadValue(bObject, context2);
BasicContext basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.ntp.getFacets());
this.ntpFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceLinux.getNtp()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.localBackup.getFacets());
this.localBackupFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceLinux.getLocalBackup()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.statistics.getFacets());
this.statsFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceLinux.getStatistics()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.authentication.getFacets());
this.authFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceLinux.getAuthentication()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.autokey.getFacets());
this.autokeyRegenIntervalFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceLinux.getAutokey()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.revoke.getFacets());
this.revokeIntervalFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceLinux.getRevoke()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceLinux.monitor.getFacets());
this.monitorFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceLinux.getMonitor()), (Context)basicContext);
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bNtpPlatformServiceLinux);
bSystemPlatformService.poll();
this.setReadonly(bSystemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpPlatformServiceLinux bNtpPlatformServiceLinux = (BNtpPlatformServiceLinux)bObject;
this.doValidate(bNtpPlatformServiceLinux, context);
bNtpPlatformServiceLinux.setNtp(((BBoolean)this.ntpFe.saveValue()).getBoolean());
bNtpPlatformServiceLinux.setLocalBackup(((BBoolean)this.localBackupFe.saveValue()).getBoolean());
bNtpPlatformServiceLinux.setStatistics(((BBoolean)this.statsFe.saveValue()).getBoolean());
bNtpPlatformServiceLinux.setAutokey(((BInteger)this.autokeyRegenIntervalFe.saveValue()).getInt());
bNtpPlatformServiceLinux.setRevoke(((BInteger)this.revokeIntervalFe.saveValue()).getInt());
bNtpPlatformServiceLinux.setAuthentication(((BBoolean)this.authFe.saveValue()).getBoolean());
bNtpPlatformServiceLinux.setMonitor(((BBoolean)this.monitorFe.saveValue()).getBoolean());
return super.doSaveValue(bObject, context);
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.ntpFe.setReadonly(bl);
this.localBackupFe.setReadonly(bl);
this.statsFe.setReadonly(bl);
this.autokeyRegenIntervalFe.setReadonly(bl);
this.revokeIntervalFe.setReadonly(bl);
this.authFe.setReadonly(bl);
this.monitorFe.setReadonly(bl);
}
public BNtpPlatformServiceLinux service() {
return (BNtpPlatformServiceLinux)this.getCurrentValue();
}
public void doOnEnabledChanged(Context context) throws Exception {
boolean bl = ((BBoolean)this.enabledFe.saveValue()).getBoolean();
this.ntpFe.setEnabled(bl);
this.statsFe.setEnabled(bl);
this.autokeyRegenIntervalFe.setEnabled(bl);
this.revokeIntervalFe.setEnabled(bl);
this.authFe.setEnabled(bl);
this.monitorFe.setEnabled(bl);
this.serversFe.setEnabled(bl);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,116 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* javax.baja.naming.BOrd
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.npsdk.BNtpPlatformServiceNpsdk;
import com.tridium.platform.ui.ntp.BNtpPlatformServiceEditor;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import javax.baja.naming.BOrd;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.util.LexiconText;
public class BNtpPlatformServiceEditorNpsdk
extends BNtpPlatformServiceEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorNpsdk == null ? (class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorNpsdk = BNtpPlatformServiceEditorNpsdk.class$("com.tridium.platform.ui.ntp.BNtpPlatformServiceEditorNpsdk")) : class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorNpsdk));
protected BBooleanFE statsFe;
protected BBooleanFE ntpFe;
protected BBooleanFE localBackupFe;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorNpsdk;
public Type getType() {
return TYPE;
}
public BNtpPlatformServiceEditorNpsdk() {
this.autoRegisterForComponentEvents = false;
this.ntpFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.ntp.label"), (BWidget)this.ntpFe);
this.linkTo(null, (BComponent)this.ntpFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.localBackupFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.localBackup.label"), (BWidget)this.localBackupFe);
this.linkTo(null, (BComponent)this.localBackupFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.statsFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.stats.label"), (BWidget)this.statsFe);
this.linkTo(null, (BComponent)this.statsFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
Context context2 = context == null ? new BasicContext() : context;
BNtpPlatformServiceNpsdk bNtpPlatformServiceNpsdk = (BNtpPlatformServiceNpsdk)bObject;
bNtpPlatformServiceNpsdk.lease(Integer.MAX_VALUE);
bNtpPlatformServiceNpsdk.poll();
super.doLoadValue(bObject, context2);
BasicContext basicContext = new BasicContext(context2, BNtpPlatformServiceNpsdk.ntp.getFacets());
this.ntpFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceNpsdk.getNtp()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceNpsdk.localBackup.getFacets());
this.localBackupFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceNpsdk.getLocalBackup()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceNpsdk.statistics.getFacets());
this.statsFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceNpsdk.getStatistics()), (Context)basicContext);
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bNtpPlatformServiceNpsdk);
bSystemPlatformService.poll();
this.setReadonly(bSystemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpPlatformServiceNpsdk bNtpPlatformServiceNpsdk = (BNtpPlatformServiceNpsdk)bObject;
this.doValidate(bNtpPlatformServiceNpsdk, context);
bNtpPlatformServiceNpsdk.setNtp(((BBoolean)this.ntpFe.saveValue()).getBoolean());
bNtpPlatformServiceNpsdk.setLocalBackup(((BBoolean)this.localBackupFe.saveValue()).getBoolean());
bNtpPlatformServiceNpsdk.setStatistics(((BBoolean)this.statsFe.saveValue()).getBoolean());
return super.doSaveValue(bObject, context);
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.ntpFe.setReadonly(bl);
this.localBackupFe.setReadonly(bl);
this.statsFe.setReadonly(bl);
}
public BNtpPlatformServiceNpsdk service() {
return (BNtpPlatformServiceNpsdk)this.getCurrentValue();
}
public void doOnEnabledChanged(Context context) throws Exception {
boolean bl = ((BBoolean)this.enabledFe.saveValue()).getBoolean();
this.ntpFe.setEnabled(bl);
this.statsFe.setEnabled(bl);
this.serversFe.setEnabled(bl);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,126 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* javax.baja.naming.BOrd
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.qnx.BNtpPlatformServiceQnx;
import com.tridium.platform.ui.ntp.BNtpPlatformServiceEditor;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import javax.baja.naming.BOrd;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.util.LexiconText;
public class BNtpPlatformServiceEditorQnx
extends BNtpPlatformServiceEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorQnx == null ? (class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorQnx = BNtpPlatformServiceEditorQnx.class$("com.tridium.platform.ui.ntp.BNtpPlatformServiceEditorQnx")) : class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorQnx));
protected BBooleanFE statsFe;
protected BBooleanFE ntpFe;
protected BBooleanFE localBackupFe;
protected BBooleanFE syncAtBootFe;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorQnx;
public Type getType() {
return TYPE;
}
public BNtpPlatformServiceEditorQnx() {
this.autoRegisterForComponentEvents = false;
this.ntpFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.ntp.label"), (BWidget)this.ntpFe);
this.linkTo(null, (BComponent)this.ntpFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.syncAtBootFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformService.syncAtBoot.label"), (BWidget)this.syncAtBootFe);
this.linkTo(null, (BComponent)this.syncAtBootFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.localBackupFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.localBackup.label"), (BWidget)this.localBackupFe);
this.linkTo(null, (BComponent)this.localBackupFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.statsFe = new BBooleanFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServicePosix.stats.label"), (BWidget)this.statsFe);
this.linkTo(null, (BComponent)this.statsFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
Context context2 = context == null ? new BasicContext() : context;
BNtpPlatformServiceQnx bNtpPlatformServiceQnx = (BNtpPlatformServiceQnx)bObject;
bNtpPlatformServiceQnx.lease(Integer.MAX_VALUE);
bNtpPlatformServiceQnx.poll();
super.doLoadValue(bObject, context2);
BasicContext basicContext = new BasicContext(context2, BNtpPlatformServiceQnx.ntp.getFacets());
this.ntpFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceQnx.getNtp()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceQnx.syncAtBoot.getFacets());
this.syncAtBootFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceQnx.getSyncAtBoot()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceQnx.localBackup.getFacets());
this.localBackupFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceQnx.getLocalBackup()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceQnx.statistics.getFacets());
this.statsFe.loadValue((BObject)BBoolean.make((boolean)bNtpPlatformServiceQnx.getStatistics()), (Context)basicContext);
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bNtpPlatformServiceQnx);
bSystemPlatformService.poll();
this.setReadonly(bSystemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpPlatformServiceQnx bNtpPlatformServiceQnx = (BNtpPlatformServiceQnx)bObject;
this.doValidate(bNtpPlatformServiceQnx, context);
bNtpPlatformServiceQnx.setNtp(((BBoolean)this.ntpFe.saveValue()).getBoolean());
bNtpPlatformServiceQnx.setSyncAtBoot(((BBoolean)this.syncAtBootFe.saveValue()).getBoolean());
bNtpPlatformServiceQnx.setLocalBackup(((BBoolean)this.localBackupFe.saveValue()).getBoolean());
bNtpPlatformServiceQnx.setStatistics(((BBoolean)this.statsFe.saveValue()).getBoolean());
return super.doSaveValue(bObject, context);
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.ntpFe.setReadonly(bl);
this.localBackupFe.setReadonly(bl);
this.statsFe.setReadonly(bl);
this.syncAtBootFe.setReadonly(bl);
}
public BNtpPlatformServiceQnx service() {
return (BNtpPlatformServiceQnx)this.getCurrentValue();
}
public void doOnEnabledChanged(Context context) throws Exception {
boolean bl = ((BBoolean)this.enabledFe.saveValue()).getBoolean();
this.ntpFe.setReadonly(!bl);
this.statsFe.setReadonly(!bl);
this.localBackupFe.setReadonly(!bl);
this.serversFe.setReadonly(!bl);
this.syncAtBootFe.setReadonly(!bl);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,169 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.naming.BOrd
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.util.LexiconText
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.ui.ntp.BNtpPlatformServiceEditor;
import com.tridium.platform.ui.util.BLimitedFrozenEnumFE;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.platform.win32.BNtpPlatformServiceWin32;
import com.tridium.platform.win32.BNtpSyncPolicyWin32;
import javax.baja.data.BIDataValue;
import javax.baja.naming.BOrd;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.util.LexiconText;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BNtpPlatformServiceEditorWin32
extends BNtpPlatformServiceEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorWin32 == null ? (class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorWin32 = BNtpPlatformServiceEditorWin32.class$("com.tridium.platform.ui.ntp.BNtpPlatformServiceEditorWin32")) : class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorWin32));
protected BLimitedFrozenEnumFE syncPolicyFe;
protected BWbFieldEditor maxPosPhaseFe;
protected BWbFieldEditor maxNegPhaseFe;
protected BWbFieldEditor minPollFe;
protected BWbFieldEditor maxPollFe;
protected BWbFieldEditor specialPollFe;
protected boolean domainMember;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpPlatformServiceEditorWin32;
public Type getType() {
return TYPE;
}
public BNtpPlatformServiceEditorWin32() {
this.autoRegisterForComponentEvents = false;
this.syncPolicyFe = new BLimitedFrozenEnumFE();
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServiceWin32.syncPolicy.label"), (BWidget)this.syncPolicyFe);
this.linkTo(null, (BComponent)this.syncPolicyFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.maxPosPhaseFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceWin32.maxPosPhaseCorrection.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServiceWin32.maxPosPhaseCorrection.label"), (BWidget)this.maxPosPhaseFe);
this.linkTo(null, (BComponent)this.maxPosPhaseFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.maxNegPhaseFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceWin32.maxNegPhaseCorrection.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServiceWin32.maxNegPhaseCorrection.label"), (BWidget)this.maxNegPhaseFe);
this.linkTo(null, (BComponent)this.maxNegPhaseFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.minPollFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceWin32.minPollInterval.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServiceWin32.minPollInterval.label"), (BWidget)this.minPollFe);
this.linkTo(null, (BComponent)this.minPollFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.maxPollFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceWin32.maxPollInterval.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServiceWin32.maxPollInterval.label"), (BWidget)this.maxPollFe);
this.linkTo(null, (BComponent)this.maxPollFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.specialPollFe = BWbFieldEditor.makeFor((BObject)BInteger.DEFAULT, (Context)BNtpPlatformServiceWin32.specialPollInterval.getFacets());
LabelUtil.addLabelWidgetPair(this.ledgerPane, LexiconText.make((Type)TYPE, (String)"NtpPlatformServiceWin32.specialPollInterval.label"), (BWidget)this.specialPollFe);
this.linkTo(null, (BComponent)this.specialPollFe, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
Context context2 = context == null ? new BasicContext() : context;
super.doLoadValue(bObject, context2);
BNtpPlatformServiceWin32 bNtpPlatformServiceWin32 = (BNtpPlatformServiceWin32)bObject;
bNtpPlatformServiceWin32.lease(Integer.MAX_VALUE);
bNtpPlatformServiceWin32.poll();
this.domainMember = bNtpPlatformServiceWin32.getDomainMember();
this.loadSyncPolicyFe(bNtpPlatformServiceWin32.getEnabled(), bNtpPlatformServiceWin32.getSyncPolicy(), context2);
BasicContext basicContext = new BasicContext(context2, BNtpPlatformServiceWin32.maxPosPhaseCorrection.getFacets());
this.maxPosPhaseFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceWin32.getMaxPosPhaseCorrection()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceWin32.maxNegPhaseCorrection.getFacets());
this.maxNegPhaseFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceWin32.getMaxNegPhaseCorrection()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceWin32.minPollInterval.getFacets());
this.minPollFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceWin32.getMinPollInterval()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceWin32.maxPollInterval.getFacets());
this.maxPollFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceWin32.getMaxPollInterval()), (Context)basicContext);
basicContext = new BasicContext(context2, BNtpPlatformServiceWin32.specialPollInterval.getFacets());
this.specialPollFe.loadValue((BObject)BInteger.make((int)bNtpPlatformServiceWin32.getSpecialPollInterval()), (Context)basicContext);
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bNtpPlatformServiceWin32);
bSystemPlatformService.poll();
this.setReadonly(bSystemPlatformService.getLocalDaemonAccess() == BDaemonAccessLevel.restricted);
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpPlatformServiceWin32 bNtpPlatformServiceWin32 = (BNtpPlatformServiceWin32)bObject;
this.doValidate(bNtpPlatformServiceWin32, context);
bNtpPlatformServiceWin32.setSyncPolicy((BNtpSyncPolicyWin32)this.syncPolicyFe.saveValue());
bNtpPlatformServiceWin32.setMaxPosPhaseCorrection(((BInteger)this.maxPosPhaseFe.saveValue()).getInt());
bNtpPlatformServiceWin32.setMaxNegPhaseCorrection(((BInteger)this.maxNegPhaseFe.saveValue()).getInt());
bNtpPlatformServiceWin32.setMinPollInterval(((BInteger)this.minPollFe.saveValue()).getInt());
bNtpPlatformServiceWin32.setMaxPollInterval(((BInteger)this.maxPollFe.saveValue()).getInt());
bNtpPlatformServiceWin32.setSpecialPollInterval(((BInteger)this.specialPollFe.saveValue()).getInt());
return super.doSaveValue(bObject, context);
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.syncPolicyFe.setReadonly(bl);
this.maxPosPhaseFe.setReadonly(bl);
this.maxNegPhaseFe.setReadonly(bl);
this.minPollFe.setReadonly(bl);
this.maxPollFe.setReadonly(bl);
this.specialPollFe.setReadonly(bl);
}
public BNtpPlatformServiceWin32 service() {
return (BNtpPlatformServiceWin32)this.getCurrentValue();
}
protected void loadSyncPolicyFe(boolean bl, BNtpSyncPolicyWin32 bNtpSyncPolicyWin32, Context context) {
BEnumRange bEnumRange;
Context context2;
Object object = context2 = context == null ? new BasicContext() : context;
if (bl) {
if (this.domainMember) {
bEnumRange = BEnumRange.make(null, (int[])new int[]{2, 1, 3}, (String[])new String[]{BNtpSyncPolicyWin32.domain.getTag(), BNtpSyncPolicyWin32.ntp.getTag(), BNtpSyncPolicyWin32.both.getTag()});
if (bNtpSyncPolicyWin32 == null || bNtpSyncPolicyWin32 == BNtpSyncPolicyWin32.none) {
bNtpSyncPolicyWin32 = BNtpSyncPolicyWin32.domain;
}
} else {
bEnumRange = BEnumRange.make(null, (int[])new int[]{1}, (String[])new String[]{BNtpSyncPolicyWin32.ntp.getTag()});
bNtpSyncPolicyWin32 = BNtpSyncPolicyWin32.ntp;
}
} else {
bEnumRange = BEnumRange.make(null, (int[])new int[]{0}, (String[])new String[]{BNtpSyncPolicyWin32.none.getTag()});
bNtpSyncPolicyWin32 = BNtpSyncPolicyWin32.none;
}
this.syncPolicyFe.loadValue((BObject)bNtpSyncPolicyWin32, (Context)new BasicContext(context2, BFacets.make((String)"range", (BIDataValue)bEnumRange)));
}
public void doOnEnabledChanged(Context context) throws Exception {
this.loadSyncPolicyFe(((BBoolean)this.enabledFe.saveValue()).getBoolean(), null, context);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,159 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Action
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BFocusEvent
* javax.baja.ui.event.BKeyEvent
* javax.baja.ui.event.BMouseEvent
* javax.baja.ui.event.BMouseWheelEvent
* javax.baja.util.LexiconText
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.ntp.BNtpServer;
import com.tridium.platform.ui.util.BCoordinatedGridPane;
import com.tridium.platform.ui.util.LabelUtil;
import javax.baja.sys.Action;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BFocusEvent;
import javax.baja.ui.event.BKeyEvent;
import javax.baja.ui.event.BMouseEvent;
import javax.baja.ui.event.BMouseWheelEvent;
import javax.baja.util.LexiconText;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BNtpServerFE
extends BWbFieldEditor {
public static final Action propagateFocusEvent = BNtpServerFE.newAction((int)4, (BValue)new BFocusEvent(), null);
public static final Action propagateKeyEvent = BNtpServerFE.newAction((int)4, (BValue)new BKeyEvent(), null);
public static final Action propagateMouseEvent = BNtpServerFE.newAction((int)4, (BValue)new BMouseEvent(), null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpServerFE == null ? (class$com$tridium$platform$ui$ntp$BNtpServerFE = BNtpServerFE.class$("com.tridium.platform.ui.ntp.BNtpServerFE")) : class$com$tridium$platform$ui$ntp$BNtpServerFE));
protected BCoordinatedGridPane grid = new BCoordinatedGridPane(1);
protected BTextField addressFe;
protected boolean readonlyInitialized = false;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpServerFE;
public void propagateFocusEvent(BFocusEvent bFocusEvent) {
this.invoke(propagateFocusEvent, (BValue)bFocusEvent, null);
}
public void propagateKeyEvent(BKeyEvent bKeyEvent) {
this.invoke(propagateKeyEvent, (BValue)bKeyEvent, null);
}
public void propagateMouseEvent(BMouseEvent bMouseEvent) {
this.invoke(propagateMouseEvent, (BValue)bMouseEvent, null);
}
public Type getType() {
return TYPE;
}
public BNtpServerFE() {
this.grid.setHalign(BHalign.left);
this.grid.setColumnAlign(BHalign.center);
this.addressFe = new BTextField("", 32);
this.grid.add(null, (BValue)this.addressFe);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.setContent((BWidget)this.grid);
}
public void doValidate(Context context) throws Exception {
if (this.addressFe.getText().trim().length() == 0) {
throw new LocalizableRuntimeException("platform", "NtpServerFE.nullAddress");
}
}
public String getServerPropertyName(Context context) throws Exception {
return ((BNtpServer)this.getCurrentValue()).getPropertyName(this.addressFe.getText());
}
public BWidget makeHeader() {
BCoordinatedGridPane bCoordinatedGridPane = new BCoordinatedGridPane(1);
bCoordinatedGridPane.setHalign(BHalign.left);
bCoordinatedGridPane.setColumnAlign(BHalign.center);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.address.label"), true));
return bCoordinatedGridPane;
}
public void useHeader(BWidget bWidget) {
if (bWidget != null) {
this.grid.setMaster((BCoordinatedGridPane)bWidget);
}
}
public void doPropagateFocusEvent(BFocusEvent bFocusEvent) {
this.fireFocusEvent(new BFocusEvent(bFocusEvent.getId(), (BWidget)this, bFocusEvent.isTemporary()));
}
public void doPropagateKeyEvent(BKeyEvent bKeyEvent) {
this.fireKeyEvent(new BKeyEvent(bKeyEvent.getId(), (BWidget)this, bKeyEvent.getModifiers(), bKeyEvent.getKeyCode(), bKeyEvent.getKeyChar()));
}
public void doPropagateMouseEvent(BMouseEvent bMouseEvent) {
if (bMouseEvent instanceof BMouseWheelEvent) {
this.fireMouseEvent((BMouseEvent)new BMouseWheelEvent(bMouseEvent.getId(), (BWidget)this, bMouseEvent.getModifiers(), bMouseEvent.getX(), bMouseEvent.getY(), bMouseEvent.getClickCount(), bMouseEvent.isPopupTrigger(), ((BMouseWheelEvent)bMouseEvent).getWheelRotation()));
} else {
this.fireMouseEvent(new BMouseEvent(bMouseEvent.getId(), (BWidget)this, bMouseEvent.getModifiers(), bMouseEvent.getX(), bMouseEvent.getY(), bMouseEvent.getClickCount(), bMouseEvent.isPopupTrigger()));
}
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BComplex bComplex;
BNtpServer bNtpServer = (BNtpServer)bObject;
if (!this.readonlyInitialized && (bComplex = bNtpServer.getParent()) != null) {
this.setReadonly((bComplex.loadSlots().getFlags((Slot)bNtpServer.getPropertyInParent()) & 1) > 0);
}
this.addressFe.setText(bNtpServer.getAddress());
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpServer bNtpServer = (BNtpServer)bObject;
bNtpServer.setAddress(this.addressFe.getText());
return bNtpServer;
}
protected void doSetReadonly(boolean bl) {
this.readonlyInitialized = true;
this.addressFe.setEditable(!bl);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,254 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* com.tridium.workbench.fieldeditors.BIntegerFE
* javax.baja.data.BIDataValue
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.linux.BNtpServerLinux;
import com.tridium.platform.posix.BNtpModePosix;
import com.tridium.platform.ui.ntp.BNtpServerFE;
import com.tridium.platform.ui.util.BCoordinatedGridPane;
import com.tridium.platform.ui.util.BLimitedFrozenEnumFE;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import com.tridium.workbench.fieldeditors.BIntegerFE;
import javax.baja.data.BIDataValue;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.util.LexiconText;
public class BNtpServerLinuxFE
extends BNtpServerFE {
public static final Action setEnabledStates = BNtpServerLinuxFE.newAction((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpServerLinuxFE == null ? (class$com$tridium$platform$ui$ntp$BNtpServerLinuxFE = BNtpServerLinuxFE.class$("com.tridium.platform.ui.ntp.BNtpServerLinuxFE")) : class$com$tridium$platform$ui$ntp$BNtpServerLinuxFE));
protected BBooleanFE autoKeyFe;
protected BBooleanFE preferredFe;
protected BBooleanFE burstFe;
protected BLimitedFrozenEnumFE peerModeFe;
protected BIntegerFE minPollIntervalFe;
protected BIntegerFE maxPollIntervalFe;
protected BTextField keyFe;
protected String additionalArgs;
protected final BFacets PEER_MODE_FACETS = BFacets.make((String)"range", (BIDataValue)BEnumRange.make(null, (int[])new int[]{2, 1, 3, 4}, (String[])new String[]{BNtpModePosix.server.getTag(), BNtpModePosix.peer.getTag(), BNtpModePosix.broadcast.getTag(), BNtpModePosix.manycastclient.getTag()}));
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpServerLinuxFE;
public void setEnabledStates() {
this.invoke(setEnabledStates, null, null);
}
public Type getType() {
return TYPE;
}
public BNtpServerLinuxFE() {
this.grid = new BCoordinatedGridPane(8);
this.grid.setHalign(BHalign.left);
this.grid.setColumnAlign(BHalign.center);
this.addressFe = new BTextField("", 32);
this.grid.add(null, (BValue)this.addressFe);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.peerModeFe = new BLimitedFrozenEnumFE();
this.grid.add(null, (BValue)this.peerModeFe);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.pluginModified, (Slot)setEnabledStates);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.actionPerformed, (Slot)setEnabledStates);
this.autoKeyFe = new BBooleanFE();
this.grid.add(null, (BValue)this.autoKeyFe);
this.linkTo((BComponent)this.autoKeyFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.autoKeyFe, (Slot)BBooleanFE.pluginModified, (Slot)setEnabledStates);
this.linkTo((BComponent)this.autoKeyFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.autoKeyFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.autoKeyFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.autoKeyFe, (Slot)BBooleanFE.actionPerformed, (Slot)setEnabledStates);
this.keyFe = new BTextField("", 6);
this.grid.add(null, (BValue)this.keyFe);
this.linkTo((BComponent)this.keyFe, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.keyFe, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.keyFe, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.keyFe, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.keyFe, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.burstFe = new BBooleanFE();
this.grid.add(null, (BValue)this.burstFe);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.preferredFe = new BBooleanFE();
this.grid.add(null, (BValue)this.preferredFe);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.minPollIntervalFe = new BIntegerFE();
this.grid.add(null, (BValue)this.minPollIntervalFe);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.mouseEvent, (Slot)propagateMouseEvent);
this.maxPollIntervalFe = new BIntegerFE();
this.grid.add(null, (BValue)this.maxPollIntervalFe);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.mouseEvent, (Slot)propagateMouseEvent);
this.setContent((BWidget)this.grid);
}
public BWidget makeHeader() {
BCoordinatedGridPane bCoordinatedGridPane = new BCoordinatedGridPane(8);
bCoordinatedGridPane.setHalign(BHalign.left);
bCoordinatedGridPane.setColumnAlign(BHalign.center);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.address.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.peerMode.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.autoKey.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.manualKey.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.burst.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.prefer.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.minPollInterval.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.maxPollInterval.label"), true));
return bCoordinatedGridPane;
}
public String getServerPropertyName(Context context) throws Exception {
BNtpServerLinux bNtpServerLinux = (BNtpServerLinux)this.getCurrentValue();
return bNtpServerLinux.getPropertyName(bNtpServerLinux.getServerString((BNtpModePosix)this.peerModeFe.saveValue(context), this.addressFe.getText().trim(), ((BBoolean)this.autoKeyFe.saveValue(context)).getBoolean(), this.keyFe.getText().trim().length() != 0 ? Integer.valueOf(this.keyFe.getText()) : 0, ((BBoolean)this.burstFe.saveValue(context)).getBoolean(), ((BBoolean)this.preferredFe.saveValue(context)).getBoolean(), ((BInteger)this.minPollIntervalFe.saveValue(context)).getInt(), ((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt(), this.additionalArgs));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BComplex bComplex;
BNtpServerLinux bNtpServerLinux = (BNtpServerLinux)bObject;
if (!this.readonlyInitialized && (bComplex = bNtpServerLinux.getParent()) != null) {
this.setReadonly((bComplex.loadSlots().getFlags((Slot)bNtpServerLinux.getPropertyInParent()) & 1) > 0);
}
this.peerModeFe.loadValue((BObject)bNtpServerLinux.getPeerMode(), (Context)this.PEER_MODE_FACETS);
this.addressFe.setText(bNtpServerLinux.getAddress());
this.autoKeyFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerLinux.getUseAutokey()));
this.keyFe.setText(bNtpServerLinux.getUseKey() != 0 ? String.valueOf(bNtpServerLinux.getUseKey()) : "");
this.burstFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerLinux.getUseBurst()));
this.preferredFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerLinux.getServerPreferred()));
bComplex = new BasicContext(context, BNtpServerLinux.minPollInterval.getFacets());
this.minPollIntervalFe.loadValue((BObject)BInteger.make((int)bNtpServerLinux.getMinPollInterval()), (Context)bComplex);
bComplex = new BasicContext(context, BNtpServerLinux.maxPollInterval.getFacets());
this.maxPollIntervalFe.loadValue((BObject)BInteger.make((int)bNtpServerLinux.getMaxPollInterval()), (Context)bComplex);
this.additionalArgs = bNtpServerLinux.getAdditionalArgs();
this.doSetEnabledStates();
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpServerLinux bNtpServerLinux = (BNtpServerLinux)bObject;
bNtpServerLinux.setPeerMode((BNtpModePosix)this.peerModeFe.saveValue(context));
bNtpServerLinux.setAddress(this.addressFe.getText());
bNtpServerLinux.setUseAutokey(((BBoolean)this.autoKeyFe.saveValue(context)).getBoolean());
bNtpServerLinux.setUseKey(this.keyFe.getText().trim().length() != 0 ? Integer.valueOf(this.keyFe.getText()) : 0);
bNtpServerLinux.setUseBurst(((BBoolean)this.burstFe.saveValue(context)).getBoolean());
bNtpServerLinux.setServerPreferred(((BBoolean)this.preferredFe.saveValue(context)).getBoolean());
bNtpServerLinux.setMinPollInterval(((BInteger)this.minPollIntervalFe.saveValue(context)).getInt());
bNtpServerLinux.setMaxPollInterval(((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt());
bNtpServerLinux.setAdditionalArgs(this.additionalArgs);
return bNtpServerLinux;
}
public final void doSetEnabledStates() {
try {
this.keyFe.setEnabled(!((BBoolean)this.autoKeyFe.saveValue()).getBoolean());
BNtpModePosix bNtpModePosix = (BNtpModePosix)this.peerModeFe.saveValue();
this.preferredFe.setEnabled(bNtpModePosix != BNtpModePosix.broadcast && bNtpModePosix != BNtpModePosix.manycastclient);
}
catch (Exception exception) {
// empty catch block
}
}
public void setEnabled(boolean bl) {
super.setEnabled(bl);
this.burstFe.setEnabled(bl);
this.keyFe.setEnabled(bl);
this.autoKeyFe.setEnabled(bl);
this.peerModeFe.setEnabled(bl);
this.preferredFe.setEnabled(bl);
this.minPollIntervalFe.setEnabled(bl);
this.maxPollIntervalFe.setEnabled(bl);
this.doSetEnabledStates();
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.burstFe.setReadonly(bl);
this.keyFe.setEditable(!bl);
this.autoKeyFe.setReadonly(bl);
this.peerModeFe.setReadonly(bl);
this.preferredFe.setReadonly(bl);
this.minPollIntervalFe.setReadonly(bl);
this.maxPollIntervalFe.setReadonly(bl);
}
public void doValidate(Context context) throws Exception {
super.doValidate(context);
int n = ((BInteger)this.minPollIntervalFe.saveValue(context)).getInt();
int n2 = ((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt();
if (n < 4 || n > 16) {
throw new Exception("Invalid minPoll value for " + this.addressFe.getText() + ". Use (4-16)");
}
if (n2 < 5 || n2 > 17) {
throw new Exception("Invalid maxPoll value for " + this.addressFe.getText() + ". Use (5-17)");
}
if (n2 < n) {
throw new Exception("Invalid configuration for " + this.addressFe.getText() + ": maxPoll < minPoll");
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,223 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* com.tridium.workbench.fieldeditors.BIntegerFE
* javax.baja.data.BIDataValue
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.npsdk.BNtpServerNpsdk;
import com.tridium.platform.posix.BNtpModePosix;
import com.tridium.platform.ui.ntp.BNtpServerFE;
import com.tridium.platform.ui.util.BCoordinatedGridPane;
import com.tridium.platform.ui.util.BLimitedFrozenEnumFE;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import com.tridium.workbench.fieldeditors.BIntegerFE;
import javax.baja.data.BIDataValue;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.util.LexiconText;
public class BNtpServerNpsdkFE
extends BNtpServerFE {
public static final Action setEnabledStates = BNtpServerNpsdkFE.newAction((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpServerNpsdkFE == null ? (class$com$tridium$platform$ui$ntp$BNtpServerNpsdkFE = BNtpServerNpsdkFE.class$("com.tridium.platform.ui.ntp.BNtpServerNpsdkFE")) : class$com$tridium$platform$ui$ntp$BNtpServerNpsdkFE));
protected BBooleanFE preferredFe;
protected BBooleanFE burstFe;
protected BLimitedFrozenEnumFE peerModeFe;
protected BIntegerFE minPollIntervalFe;
protected BIntegerFE maxPollIntervalFe;
protected final BFacets PEER_MODE_FACETS = BFacets.make((String)"range", (BIDataValue)BEnumRange.make(null, (int[])new int[]{2, 1, 3, 4}, (String[])new String[]{BNtpModePosix.server.getTag(), BNtpModePosix.peer.getTag(), BNtpModePosix.broadcast.getTag(), BNtpModePosix.manycastclient.getTag()}));
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpServerNpsdkFE;
public void setEnabledStates() {
this.invoke(setEnabledStates, null, null);
}
public Type getType() {
return TYPE;
}
public BNtpServerNpsdkFE() {
this.grid = new BCoordinatedGridPane(8);
this.grid.setHalign(BHalign.left);
this.grid.setColumnAlign(BHalign.center);
this.addressFe = new BTextField("", 32);
this.grid.add(null, (BValue)this.addressFe);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.peerModeFe = new BLimitedFrozenEnumFE();
this.grid.add(null, (BValue)this.peerModeFe);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.pluginModified, (Slot)setEnabledStates);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.actionPerformed, (Slot)setEnabledStates);
this.burstFe = new BBooleanFE();
this.grid.add(null, (BValue)this.burstFe);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.preferredFe = new BBooleanFE();
this.grid.add(null, (BValue)this.preferredFe);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.minPollIntervalFe = new BIntegerFE();
this.grid.add(null, (BValue)this.minPollIntervalFe);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.mouseEvent, (Slot)propagateMouseEvent);
this.maxPollIntervalFe = new BIntegerFE();
this.grid.add(null, (BValue)this.maxPollIntervalFe);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.mouseEvent, (Slot)propagateMouseEvent);
this.setContent((BWidget)this.grid);
}
public BWidget makeHeader() {
BCoordinatedGridPane bCoordinatedGridPane = new BCoordinatedGridPane(8);
bCoordinatedGridPane.setHalign(BHalign.left);
bCoordinatedGridPane.setColumnAlign(BHalign.center);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.address.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.peerMode.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.burst.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.prefer.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.minPollInterval.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.maxPollInterval.label"), true));
return bCoordinatedGridPane;
}
public String getServerPropertyName(Context context) throws Exception {
BNtpServerNpsdk bNtpServerNpsdk = (BNtpServerNpsdk)this.getCurrentValue();
return bNtpServerNpsdk.getPropertyName(bNtpServerNpsdk.getServerString((BNtpModePosix)this.peerModeFe.saveValue(context), this.addressFe.getText().trim(), ((BBoolean)this.burstFe.saveValue(context)).getBoolean(), ((BBoolean)this.preferredFe.saveValue(context)).getBoolean(), ((BInteger)this.minPollIntervalFe.saveValue(context)).getInt(), ((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt()));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BComplex bComplex;
BNtpServerNpsdk bNtpServerNpsdk = (BNtpServerNpsdk)bObject;
if (!this.readonlyInitialized && (bComplex = bNtpServerNpsdk.getParent()) != null) {
this.setReadonly((bComplex.loadSlots().getFlags((Slot)bNtpServerNpsdk.getPropertyInParent()) & 1) > 0);
}
this.peerModeFe.loadValue((BObject)bNtpServerNpsdk.getPeerMode(), (Context)this.PEER_MODE_FACETS);
this.addressFe.setText(bNtpServerNpsdk.getAddress());
this.burstFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerNpsdk.getUseBurst()));
this.preferredFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerNpsdk.getServerPreferred()));
bComplex = new BasicContext(context, BNtpServerNpsdk.minPollInterval.getFacets());
this.minPollIntervalFe.loadValue((BObject)BInteger.make((int)bNtpServerNpsdk.getMinPollInterval()), (Context)bComplex);
bComplex = new BasicContext(context, BNtpServerNpsdk.maxPollInterval.getFacets());
this.maxPollIntervalFe.loadValue((BObject)BInteger.make((int)bNtpServerNpsdk.getMaxPollInterval()), (Context)bComplex);
this.doSetEnabledStates();
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpServerNpsdk bNtpServerNpsdk = (BNtpServerNpsdk)bObject;
bNtpServerNpsdk.setPeerMode((BNtpModePosix)this.peerModeFe.saveValue(context));
bNtpServerNpsdk.setAddress(this.addressFe.getText());
bNtpServerNpsdk.setUseBurst(((BBoolean)this.burstFe.saveValue(context)).getBoolean());
bNtpServerNpsdk.setServerPreferred(((BBoolean)this.preferredFe.saveValue(context)).getBoolean());
bNtpServerNpsdk.setMinPollInterval(((BInteger)this.minPollIntervalFe.saveValue(context)).getInt());
bNtpServerNpsdk.setMaxPollInterval(((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt());
return bNtpServerNpsdk;
}
public final void doSetEnabledStates() {
try {
BNtpModePosix bNtpModePosix = (BNtpModePosix)this.peerModeFe.saveValue();
this.preferredFe.setEnabled(bNtpModePosix != BNtpModePosix.broadcast && bNtpModePosix != BNtpModePosix.manycastclient);
}
catch (Exception exception) {
// empty catch block
}
}
public void setEnabled(boolean bl) {
super.setEnabled(bl);
this.burstFe.setEnabled(bl);
this.peerModeFe.setEnabled(bl);
this.preferredFe.setEnabled(bl);
this.minPollIntervalFe.setEnabled(bl);
this.maxPollIntervalFe.setEnabled(bl);
this.doSetEnabledStates();
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.burstFe.setReadonly(bl);
this.peerModeFe.setReadonly(bl);
this.preferredFe.setReadonly(bl);
this.minPollIntervalFe.setReadonly(bl);
this.maxPollIntervalFe.setReadonly(bl);
}
public void doValidate(Context context) throws Exception {
super.doValidate(context);
int n = ((BInteger)this.minPollIntervalFe.saveValue(context)).getInt();
int n2 = ((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt();
if (n < 4 || n > 16) {
throw new Exception("Invalid minPoll value for " + this.addressFe.getText() + ". Use (4-16)");
}
if (n2 < 5 || n2 > 17) {
throw new Exception("Invalid maxPoll value for " + this.addressFe.getText() + ". Use (5-17)");
}
if (n2 < n) {
throw new Exception("Invalid configuration for " + this.addressFe.getText() + ": maxPoll < minPoll");
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,214 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* com.tridium.workbench.fieldeditors.BIntegerFE
* javax.baja.data.BIDataValue
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.posix.BNtpModePosix;
import com.tridium.platform.qnx.BNtpServerQnx;
import com.tridium.platform.ui.ntp.BNtpServerFE;
import com.tridium.platform.ui.util.BCoordinatedGridPane;
import com.tridium.platform.ui.util.BLimitedFrozenEnumFE;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import com.tridium.workbench.fieldeditors.BIntegerFE;
import javax.baja.data.BIDataValue;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.util.LexiconText;
public class BNtpServerQnxFE
extends BNtpServerFE {
public static final Action setEnabledStates = BNtpServerQnxFE.newAction((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpServerQnxFE == null ? (class$com$tridium$platform$ui$ntp$BNtpServerQnxFE = BNtpServerQnxFE.class$("com.tridium.platform.ui.ntp.BNtpServerQnxFE")) : class$com$tridium$platform$ui$ntp$BNtpServerQnxFE));
protected BBooleanFE preferredFe;
protected BBooleanFE burstFe;
protected BLimitedFrozenEnumFE peerModeFe;
protected BIntegerFE minPollIntervalFe;
protected BIntegerFE maxPollIntervalFe;
protected final BFacets PEER_MODE_FACETS = BFacets.make((String)"range", (BIDataValue)BEnumRange.make(null, (int[])new int[]{2, 1}, (String[])new String[]{BNtpModePosix.server.getTag(), BNtpModePosix.peer.getTag()}));
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpServerQnxFE;
public void setEnabledStates() {
this.invoke(setEnabledStates, null, null);
}
public Type getType() {
return TYPE;
}
public BNtpServerQnxFE() {
this.grid = new BCoordinatedGridPane(8);
this.grid.setHalign(BHalign.left);
this.grid.setColumnAlign(BHalign.center);
this.addressFe = new BTextField("", 32);
this.grid.add(null, (BValue)this.addressFe);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.peerModeFe = new BLimitedFrozenEnumFE();
this.grid.add(null, (BValue)this.peerModeFe);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.mouseEvent, (Slot)propagateMouseEvent);
this.burstFe = new BBooleanFE();
this.grid.add(null, (BValue)this.burstFe);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.burstFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.preferredFe = new BBooleanFE();
this.grid.add(null, (BValue)this.preferredFe);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.linkTo((BComponent)this.preferredFe, (Slot)BBooleanFE.actionPerformed, (Slot)actionPerformed);
this.minPollIntervalFe = new BIntegerFE();
this.grid.add(null, (BValue)this.minPollIntervalFe);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.minPollIntervalFe, (Slot)BIntegerFE.mouseEvent, (Slot)propagateMouseEvent);
this.maxPollIntervalFe = new BIntegerFE();
this.grid.add(null, (BValue)this.maxPollIntervalFe);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.maxPollIntervalFe, (Slot)BIntegerFE.mouseEvent, (Slot)propagateMouseEvent);
this.setContent((BWidget)this.grid);
}
public BWidget makeHeader() {
BCoordinatedGridPane bCoordinatedGridPane = new BCoordinatedGridPane(8);
bCoordinatedGridPane.setHalign(BHalign.left);
bCoordinatedGridPane.setColumnAlign(BHalign.center);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.address.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.peerMode.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.burst.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.prefer.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.minPollInterval.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServicePosix.maxPollInterval.label"), true));
return bCoordinatedGridPane;
}
public String getServerPropertyName(Context context) throws Exception {
BNtpServerQnx bNtpServerQnx = (BNtpServerQnx)this.getCurrentValue();
return bNtpServerQnx.getPropertyName(bNtpServerQnx.getServerString((BNtpModePosix)this.peerModeFe.saveValue(context), this.addressFe.getText().trim(), ((BBoolean)this.burstFe.saveValue(context)).getBoolean(), ((BBoolean)this.preferredFe.saveValue(context)).getBoolean(), ((BInteger)this.minPollIntervalFe.saveValue(context)).getInt(), ((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt()));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BComplex bComplex;
BNtpServerQnx bNtpServerQnx = (BNtpServerQnx)bObject;
if (!this.readonlyInitialized && (bComplex = bNtpServerQnx.getParent()) != null) {
this.setReadonly((bComplex.loadSlots().getFlags((Slot)bNtpServerQnx.getPropertyInParent()) & 1) > 0);
}
this.peerModeFe.loadValue((BObject)bNtpServerQnx.getPeerMode(), (Context)this.PEER_MODE_FACETS);
this.addressFe.setText(bNtpServerQnx.getAddress());
this.burstFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerQnx.getUseBurst()));
this.preferredFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerQnx.getServerPreferred()));
bComplex = new BasicContext(context, BNtpServerQnx.minPollInterval.getFacets());
this.minPollIntervalFe.loadValue((BObject)BInteger.make((int)bNtpServerQnx.getMinPollInterval()), (Context)bComplex);
bComplex = new BasicContext(context, BNtpServerQnx.maxPollInterval.getFacets());
this.maxPollIntervalFe.loadValue((BObject)BInteger.make((int)bNtpServerQnx.getMaxPollInterval()), (Context)bComplex);
this.doSetEnabledStates();
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpServerQnx bNtpServerQnx = (BNtpServerQnx)bObject;
bNtpServerQnx.setPeerMode((BNtpModePosix)this.peerModeFe.saveValue(context));
bNtpServerQnx.setAddress(this.addressFe.getText());
bNtpServerQnx.setUseBurst(((BBoolean)this.burstFe.saveValue(context)).getBoolean());
bNtpServerQnx.setServerPreferred(((BBoolean)this.preferredFe.saveValue(context)).getBoolean());
bNtpServerQnx.setMinPollInterval(((BInteger)this.minPollIntervalFe.saveValue(context)).getInt());
bNtpServerQnx.setMaxPollInterval(((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt());
return bNtpServerQnx;
}
public final void doSetEnabledStates() {
}
public void setEnabled(boolean bl) {
super.setEnabled(bl);
this.burstFe.setEnabled(bl);
this.peerModeFe.setEnabled(bl);
this.preferredFe.setEnabled(bl);
this.minPollIntervalFe.setEnabled(bl);
this.maxPollIntervalFe.setEnabled(bl);
this.doSetEnabledStates();
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.burstFe.setReadonly(bl);
this.peerModeFe.setReadonly(bl);
this.preferredFe.setReadonly(bl);
this.minPollIntervalFe.setReadonly(bl);
this.maxPollIntervalFe.setReadonly(bl);
}
public void doValidate(Context context) throws Exception {
super.doValidate(context);
int n = ((BInteger)this.minPollIntervalFe.saveValue(context)).getInt();
int n2 = ((BInteger)this.maxPollIntervalFe.saveValue(context)).getInt();
if (n < 4 || n > 16) {
throw new Exception("Invalid minPoll value for " + this.addressFe.getText() + ". Use (4-16)");
}
if (n2 < 5 || n2 > 17) {
throw new Exception("Invalid maxPoll value for " + this.addressFe.getText() + ". Use (5-17)");
}
if (n2 < n) {
throw new Exception("Invalid configuration for " + this.addressFe.getText() + ": maxPoll < minPoll");
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,379 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.AgentFilter
* javax.baja.gx.BImage
* javax.baja.sys.Action
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.SlotCursor
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BButton
* javax.baja.ui.BToolBar
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.enums.BButtonStyle
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BFocusEvent
* javax.baja.ui.pane.BFlowPane
* javax.baja.ui.pane.BGridPane
* javax.baja.util.BTypeSpec
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.ntp.BNtpServer;
import com.tridium.platform.ntp.BNtpServerVector;
import com.tridium.platform.ui.ntp.BNtpServerFE;
import com.tridium.platform.ui.util.CommandUtil;
import java.util.HashSet;
import javax.baja.agent.AgentFilter;
import javax.baja.gx.BImage;
import javax.baja.sys.Action;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BButton;
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.BButtonStyle;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BFocusEvent;
import javax.baja.ui.pane.BFlowPane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.util.BTypeSpec;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BNtpServerVectorFE
extends BWbFieldEditor {
public static final Action handleFocusChange = BNtpServerVectorFE.newAction((int)4, (BValue)new BFocusEvent(), null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpServerVectorFE == null ? (class$com$tridium$platform$ui$ntp$BNtpServerVectorFE = BNtpServerVectorFE.class$("com.tridium.platform.ui.ntp.BNtpServerVectorFE")) : class$com$tridium$platform$ui$ntp$BNtpServerVectorFE));
private BNtpServerFE feFactory = null;
private BNtpServerVector vector = null;
private BWidget header = null;
private BGridPane contentPane;
private BWbFieldEditor focusedEditor = null;
private boolean readonlyInitialized = false;
private Command addCommand;
private Command deleteCommand;
private Command upCommand;
private Command downCommand;
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpServerVectorFE;
static /* synthetic */ Class class$com$tridium$platform$ntp$BNtpServer;
static /* synthetic */ Class class$javax$baja$workbench$fieldeditor$BWbFieldEditor;
public void handleFocusChange(BFocusEvent bFocusEvent) {
this.invoke(handleFocusChange, (BValue)bFocusEvent, null);
}
public Type getType() {
return TYPE;
}
public BNtpServerVectorFE() {
this(null);
}
public BNtpServerVectorFE(Type type) {
if (type != null) {
this.feFactory = (BNtpServerFE)type.getInstance();
}
BFlowPane bFlowPane = new BFlowPane(BHalign.center);
BToolBar bToolBar = new BToolBar();
bFlowPane.add(null, (BValue)bToolBar, null);
this.addCommand = new AddCommand();
BButton bButton = new BButton(this.addCommand);
bToolBar.add("add", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
this.deleteCommand = new DeleteCommand();
bButton = new BButton(this.deleteCommand);
bToolBar.add("delete", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
this.upCommand = new UpCommand();
bButton = new BButton(this.upCommand);
bToolBar.add("up", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
this.downCommand = new DownCommand();
bButton = new BButton(this.downCommand);
bToolBar.add("down", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
BGridPane bGridPane = new BGridPane(1);
this.contentPane = new BGridPane(1);
bGridPane.add(null, (BValue)this.contentPane);
bGridPane.add(null, (BValue)bFlowPane);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.center);
this.setContent((BWidget)bGridPane);
}
public void doValidate(Context context) throws Exception {
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
int n = this.header == null ? 0 : 1;
HashSet<String> hashSet = new HashSet<String>();
for (int i = n; i < bWidgetArray.length; ++i) {
BNtpServerFE bNtpServerFE = (BNtpServerFE)bWidgetArray[i];
bNtpServerFE.doValidate(context);
String string = bNtpServerFE.getServerPropertyName(context);
if (hashSet.contains(string)) {
throw new LocalizableRuntimeException("platform", "NtpServerVectorFE.duplicateServer");
}
hashSet.add(string);
}
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
try {
BComplex bComplex;
this.vector = (BNtpServerVector)bObject;
this.vector.lease(Integer.MAX_VALUE);
if (context != null && context.getFacet("fieldEditor") != null) {
this.feFactory = (BNtpServerFE)BTypeSpec.make((String)context.getFacet("fieldEditor").toString()).getInstance();
}
if (!this.readonlyInitialized && (bComplex = this.vector.getParent()) != null) {
this.setReadonly((bComplex.loadSlots().getFlags((Slot)this.vector.getPropertyInParent()) & 1) > 0);
}
this.contentPane.removeAll();
this.header = this.getFeFactory().makeHeader();
if (this.header != null) {
this.contentPane.add(null, (BValue)this.header, 0);
}
bComplex = this.vector.loadSlots().getProperties();
while (bComplex.next(class$com$tridium$platform$ntp$BNtpServer == null ? BNtpServerVectorFE.class$("com.tridium.platform.ntp.BNtpServer") : class$com$tridium$platform$ntp$BNtpServer)) {
this.addElement((BNtpServer)bComplex.get());
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpServerVector bNtpServerVector = (BNtpServerVector)bObject;
bNtpServerVector.lease();
bNtpServerVector.removeAll();
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
int n = this.header == null ? 0 : 1;
String[] stringArray = new String[bWidgetArray.length - n];
for (int i = n; i < bWidgetArray.length; ++i) {
BNtpServer bNtpServer = (BNtpServer)((BWbFieldEditor)bWidgetArray[i]).saveValue(context);
stringArray[i - n] = bNtpServer.getServerString();
}
bNtpServerVector.sync(stringArray);
return bNtpServerVector;
}
protected void doSetReadonly(boolean bl) {
int n;
this.readonlyInitialized = true;
super.doSetReadonly(bl);
this.deleteCommand.setEnabled(!bl && this.focusedEditor != null);
this.addCommand.setEnabled(!bl);
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
for (int i = n = this.header == null ? 0 : 1; i < bWidgetArray.length; ++i) {
((BWbFieldEditor)bWidgetArray[i]).setReadonly(bl);
}
}
protected BNtpServerFE getFeFactory() {
if (this.feFactory == null) {
this.feFactory = (BNtpServerFE)Sys.getRegistry().getAgents(this.vector.getElementType()).filter(AgentFilter.is((Type)BNtpServerFE.TYPE)).getDefault().getInstance();
}
return this.feFactory;
}
public void addElement(BNtpServer bNtpServer) {
BNtpServerFE bNtpServerFE = (BNtpServerFE)this.getFeFactory().getType().getInstance();
if (this.header != null) {
bNtpServerFE.useHeader(this.header);
}
if (bNtpServer != null) {
bNtpServerFE.loadValue((BObject)bNtpServer);
}
this.contentPane.add(null, (BValue)bNtpServerFE, 0);
bNtpServerFE.setReadonly(this.isReadonly());
this.getContent().relayout();
this.getContent().computePreferredSize();
this.linkTo(null, (BComponent)bNtpServerFE, (Slot)BWbFieldEditor.focusEvent, (Slot)handleFocusChange);
this.linkTo(null, (BComponent)bNtpServerFE, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.setModified();
}
public void doHandleFocusChange(BFocusEvent bFocusEvent) {
try {
if (this.isReadonly()) {
return;
}
if (bFocusEvent.getId() == 1005) {
if (this.focusedEditor == bFocusEvent.getWidget()) {
this.focusedEditor = null;
}
} else if (bFocusEvent.getId() == 1004) {
this.focusedEditor = (BWbFieldEditor)bFocusEvent.getWidget();
}
this.setArrowCommandEnabledStates();
this.deleteCommand.setEnabled(this.focusedEditor != null);
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public static Property[] getDynamicPropertiesArray(BObject bObject, boolean bl) {
if (bl) {
bObject.asComplex().loadSlots();
}
Property[] propertyArray = bObject.asComplex().getPropertiesArray();
for (int i = 0; i < propertyArray.length; ++i) {
if (propertyArray[i].isFrozen()) continue;
Property[] propertyArray2 = new Property[propertyArray.length - i];
System.arraycopy(propertyArray, i, propertyArray2, 0, propertyArray2.length);
return propertyArray2;
}
return new Property[0];
}
private void setArrowCommandEnabledStates() {
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
if (bWidgetArray.length > 1 && this.focusedEditor != null) {
int n = this.header == null ? 0 : 1;
this.upCommand.setEnabled(bWidgetArray[n] != this.focusedEditor);
this.downCommand.setEnabled(bWidgetArray[bWidgetArray.length - 1] != this.focusedEditor);
} else {
this.upCommand.setEnabled(false);
this.downCommand.setEnabled(false);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private class DownCommand
extends Command {
public DownCommand() {
super((BWidget)BNtpServerVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"arrowDown.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
try {
Property[] propertyArray = BNtpServerVectorFE.getDynamicPropertiesArray((BObject)BNtpServerVectorFE.this.contentPane, true);
for (int i = 0; i < propertyArray.length; ++i) {
if (BNtpServerVectorFE.this.focusedEditor != BNtpServerVectorFE.this.contentPane.get(propertyArray[i])) continue;
Property property = propertyArray[i];
propertyArray[i] = propertyArray[i + 1];
propertyArray[i + 1] = property;
BNtpServerVectorFE.this.contentPane.reorder(propertyArray);
BNtpServerVectorFE.this.setModified();
BNtpServerVectorFE.this.setArrowCommandEnabledStates();
return null;
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
}
private class UpCommand
extends Command {
public UpCommand() {
super((BWidget)BNtpServerVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"arrowUp.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
try {
Property[] propertyArray = BNtpServerVectorFE.getDynamicPropertiesArray((BObject)BNtpServerVectorFE.this.contentPane, true);
for (int i = 0; i < propertyArray.length; ++i) {
if (BNtpServerVectorFE.this.focusedEditor != BNtpServerVectorFE.this.contentPane.get(propertyArray[i])) continue;
Property property = propertyArray[i];
propertyArray[i] = propertyArray[i - 1];
propertyArray[i - 1] = property;
BNtpServerVectorFE.this.contentPane.reorder(propertyArray);
BNtpServerVectorFE.this.setModified();
BNtpServerVectorFE.this.setArrowCommandEnabledStates();
return null;
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
}
private class AddCommand
extends Command {
public AddCommand() {
super((BWidget)BNtpServerVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"add.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
BNtpServerVectorFE.this.addElement((BNtpServer)BNtpServerVectorFE.this.vector.getElementType().getInstance());
BNtpServerVectorFE.this.setArrowCommandEnabledStates();
return null;
}
}
private class DeleteCommand
extends Command {
public DeleteCommand() {
super((BWidget)BNtpServerVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"delete.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
if (BNtpServerVectorFE.this.focusedEditor == null) {
return null;
}
try {
SlotCursor slotCursor = BNtpServerVectorFE.this.contentPane.loadSlots().getProperties();
while (slotCursor.next(class$javax$baja$workbench$fieldeditor$BWbFieldEditor == null ? BNtpServerVectorFE.class$("javax.baja.workbench.fieldeditor.BWbFieldEditor") : class$javax$baja$workbench$fieldeditor$BWbFieldEditor)) {
if (slotCursor.get() != BNtpServerVectorFE.this.focusedEditor) continue;
BNtpServerVectorFE.this.contentPane.remove(slotCursor.property());
BNtpServerVectorFE.this.focusedEditor = null;
BNtpServerVectorFE.this.deleteCommand.setEnabled(false);
BNtpServerVectorFE.this.addCommand.setEnabled(true);
BNtpServerVectorFE.this.setModified();
BNtpServerVectorFE.this.setArrowCommandEnabledStates();
BNtpServerVectorFE.this.relayout();
return null;
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
}
}
@@ -0,0 +1,152 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.workbench.fieldeditors.BBooleanFE
* javax.baja.data.BIDataValue
* javax.baja.sys.BBoolean
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.util.LexiconText
*/
package com.tridium.platform.ui.ntp;
import com.tridium.platform.ntp.BNtpMode;
import com.tridium.platform.ui.ntp.BNtpServerFE;
import com.tridium.platform.ui.util.BCoordinatedGridPane;
import com.tridium.platform.ui.util.BLimitedFrozenEnumFE;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.platform.win32.BNtpServerWin32;
import com.tridium.workbench.fieldeditors.BBooleanFE;
import javax.baja.data.BIDataValue;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.util.LexiconText;
public class BNtpServerWin32FE
extends BNtpServerFE {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$ntp$BNtpServerWin32FE == null ? (class$com$tridium$platform$ui$ntp$BNtpServerWin32FE = BNtpServerWin32FE.class$("com.tridium.platform.ui.ntp.BNtpServerWin32FE")) : class$com$tridium$platform$ui$ntp$BNtpServerWin32FE));
protected BBooleanFE specialPollFe;
protected BBooleanFE fallbackFe;
protected BLimitedFrozenEnumFE peerModeFe;
protected static final BFacets PEER_MODE_FACETS = BFacets.make((String)"range", (BIDataValue)BEnumRange.make(null, (int[])new int[]{0, 1, 3}, (String[])new String[]{BNtpMode.unspecified.getTag(), BNtpMode.symmetricActive.getTag(), BNtpMode.client.getTag()}));
static /* synthetic */ Class class$com$tridium$platform$ui$ntp$BNtpServerWin32FE;
public Type getType() {
return TYPE;
}
public BNtpServerWin32FE() {
this.grid = new BCoordinatedGridPane(4);
this.grid.setHalign(BHalign.left);
this.grid.setColumnAlign(BHalign.center);
this.addressFe = new BTextField("", 32);
this.grid.add(null, (BValue)this.addressFe);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo((BComponent)this.addressFe, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.specialPollFe = new BBooleanFE();
this.grid.add(null, (BValue)this.specialPollFe);
this.linkTo((BComponent)this.specialPollFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.specialPollFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.specialPollFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.fallbackFe = new BBooleanFE();
this.grid.add(null, (BValue)this.fallbackFe);
this.linkTo((BComponent)this.fallbackFe, (Slot)BBooleanFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.fallbackFe, (Slot)BBooleanFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.fallbackFe, (Slot)BBooleanFE.mouseEvent, (Slot)propagateMouseEvent);
this.peerModeFe = new BLimitedFrozenEnumFE();
this.grid.add(null, (BValue)this.peerModeFe);
this.peerModeFe.loadValue((BObject)BNtpMode.unspecified, (Context)PEER_MODE_FACETS);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.pluginModified, (Slot)setModified);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.focusEvent, (Slot)propagateFocusEvent);
this.linkTo((BComponent)this.peerModeFe, (Slot)BLimitedFrozenEnumFE.mouseEvent, (Slot)propagateMouseEvent);
this.setContent((BWidget)this.grid);
}
public BWidget makeHeader() {
BCoordinatedGridPane bCoordinatedGridPane = new BCoordinatedGridPane(4);
bCoordinatedGridPane.setHalign(BHalign.left);
bCoordinatedGridPane.setColumnAlign(BHalign.center);
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformService.address.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServiceWin32.useSpecialPollInterval.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServiceWin32.fallback.label"), true));
bCoordinatedGridPane.add(null, (BValue)LabelUtil.makeLabel(LexiconText.make((String)"platform", (String)"NtpPlatformServiceWin32.peerMode.label"), true));
return bCoordinatedGridPane;
}
public String getServerPropertyName(Context context) throws Exception {
BNtpServerWin32 bNtpServerWin32 = (BNtpServerWin32)this.getCurrentValue();
return bNtpServerWin32.getPropertyName(bNtpServerWin32.getServerString(this.addressFe.getText(), ((BBoolean)this.specialPollFe.saveValue(context)).getBoolean(), ((BBoolean)this.fallbackFe.saveValue(context)).getBoolean(), (BNtpMode)this.peerModeFe.saveValue(context)));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BComplex bComplex;
BNtpServerWin32 bNtpServerWin32 = (BNtpServerWin32)bObject;
if (!this.readonlyInitialized && (bComplex = bNtpServerWin32.getParent()) != null) {
this.setReadonly((bComplex.loadSlots().getFlags((Slot)bNtpServerWin32.getPropertyInParent()) & 1) > 0);
}
this.addressFe.setText(bNtpServerWin32.getAddress());
this.specialPollFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerWin32.getUseSpecialPollInterval()));
this.fallbackFe.loadValue((BObject)BBoolean.make((boolean)bNtpServerWin32.getFallbackOnly()));
this.peerModeFe.loadValue((BObject)bNtpServerWin32.getPeerMode(), (Context)PEER_MODE_FACETS);
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BNtpServerWin32 bNtpServerWin32 = (BNtpServerWin32)bObject;
bNtpServerWin32.setAddress(this.addressFe.getText());
bNtpServerWin32.setUseSpecialPollInterval(((BBoolean)this.specialPollFe.saveValue(context)).getBoolean());
bNtpServerWin32.setFallbackOnly(((BBoolean)this.fallbackFe.saveValue(context)).getBoolean());
bNtpServerWin32.setPeerMode((BNtpMode)this.peerModeFe.saveValue(context));
return bNtpServerWin32;
}
public void setEnabled(boolean bl) {
super.setEnabled(bl);
this.specialPollFe.setEnabled(bl);
this.fallbackFe.setEnabled(bl);
this.peerModeFe.setEnabled(bl);
}
protected void doSetReadonly(boolean bl) {
super.doSetReadonly(bl);
this.specialPollFe.setReadonly(bl);
this.fallbackFe.setReadonly(bl);
this.peerModeFe.setReadonly(bl);
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,377 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BFileSystem
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.file.FileUtil
* javax.baja.file.IFileFilter
* javax.baja.gx.BImage
* javax.baja.nre.util.Array
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.table.TableModel
* javax.baja.util.Lexicon
*/
package com.tridium.platform.ui.pki;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.pki.PemCertInfo;
import com.tridium.platform.ui.util.BCommandBoundTable;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.BFileChooserDialog;
import com.tridium.platform.ui.util.BIndentPane;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.platform.ui.util.FavoriteDirectory;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.file.IFileFilter;
import javax.baja.gx.BImage;
import javax.baja.nre.util.Array;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.table.TableModel;
import javax.baja.util.Lexicon;
public class BCACertsTable
extends BCommandBoundTable
implements CommandBindings.Support {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$pki$BCACertsTable == null ? (class$com$tridium$platform$ui$pki$BCACertsTable = BCACertsTable.class$("com.tridium.platform.ui.pki.BCACertsTable")) : class$com$tridium$platform$ui$pki$BCACertsTable));
public static final Lexicon LEX = Lexicon.make((String)"platform");
public static final ExtFileFilter PEM_FILTER = new ExtFileFilter("", "pem,crt,cer");
protected BDirectory dir;
protected FilePath dirPath;
protected BFileSpace space;
public static final int COL_SOURCE = 0;
public static final int COL_ISSUER = 1;
public static final int COL_SUBJECT = 2;
public static final int COL_START = 3;
public static final int COL_END = 4;
public static final int COL_ALG = 5;
protected boolean readonly = false;
static /* synthetic */ Class class$com$tridium$platform$ui$pki$BCACertsTable;
static /* synthetic */ Class class$com$tridium$platform$pki$PemCertInfo;
static /* synthetic */ Class class$java$lang$String;
public Type getType() {
return TYPE;
}
public BCACertsTable() {
throw new UnsupportedOperationException();
}
public BCACertsTable(FilePath filePath, BFileSpace bFileSpace, CommandBindings.TableController tableController) throws Exception {
super(new CACertModel(), tableController);
this.dirPath = filePath;
this.space = bFileSpace;
this.dir = this.initDir(filePath);
this.initCommands();
}
public BCACertsTable(FilePath filePath, BFileSpace bFileSpace) throws Exception {
super(new CACertModel());
this.dirPath = filePath;
this.space = bFileSpace;
this.dir = this.initDir(filePath);
this.initCommands();
}
public void load() throws Exception {
this.caCertModel().load(this.dir);
}
protected void initCommands() {
this.getCommandBindings().setSupport(this);
this.addCommand(new ImportCommand(), BCommandEnablePolicy.always);
this.addCommand(new ExportCommand(), BCommandEnablePolicy.anySelection);
ViewCommand viewCommand = new ViewCommand();
this.addCommand(viewCommand, BCommandEnablePolicy.singleSelection);
this.setDoubleClickCommand(viewCommand);
this.addCommand(new DeleteCommand(), BCommandEnablePolicy.anySelection);
}
protected CACertModel caCertModel() {
return (CACertModel)this.getModel();
}
protected BDirectory initDir(FilePath filePath) throws Exception {
if (this.space instanceof BDaemonFileSpace) {
BDirectory bDirectory = (BDirectory)this.space.findFile(filePath);
if (bDirectory == null) {
this.initDir(filePath.getParent());
BDaemonFileSpace bDaemonFileSpace = (BDaemonFileSpace)this.space;
DaemonFileUtil.transfer(bDaemonFileSpace.getDaemonSession(), FileTransferMessage.makeMkDir(filePath, bDaemonFileSpace), null);
bDirectory = (BDirectory)this.space.findFile(filePath);
}
return bDirectory;
}
return this.space.makeDir(this.dirPath);
}
protected Object beginFileTransfer() {
if (this.space instanceof BDaemonFileSpace) {
return new FileTransferMessage((BDaemonFileSpace)this.space);
}
return null;
}
protected void installCertFile(BIFile bIFile, Object object) throws Exception {
FilePath filePath = this.dir.getFilePath().merge(FileUtil.getBase((String)bIFile.getFileName()) + ".pem");
if (this.space instanceof BDaemonFileSpace) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
fileTransferMessage.addFile(bIFile, filePath);
} else {
BIFile bIFile2 = this.dir.getFileSpace().makeFile(filePath);
FileUtil.pipe((BIFile)bIFile, (BIFile)bIFile2);
}
}
protected void deleteCertFile(BIFile bIFile, Object object) throws Exception {
if (this.space instanceof BDaemonFileSpace) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
fileTransferMessage.addDelete(bIFile.getFilePath());
} else {
bIFile.delete();
}
}
protected void commitFileTransfer(Object object) throws Exception {
if (object != null) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
DaemonFileUtil.transfer(fileTransferMessage.getTargetFileSpace().getDaemonSession(), (FileTransferMessage)object, null);
}
}
public boolean isReadonly() {
return this.readonly;
}
public void setReadonly(boolean bl) {
this.readonly = bl;
this.setCommandEnabledStates();
}
public void setBoundCommandEnabled(Command command, boolean bl) {
if (this.readonly && (command instanceof ImportCommand || command instanceof DeleteCommand)) {
command.setEnabled(false);
} else {
command.setEnabled(bl);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
protected class ExportCommand
extends Command {
public ExportCommand() {
super((BWidget)BCACertsTable.this, LEX, "CACertsTable.export");
}
public CommandArtifact doInvoke() {
try {
BDirectory bDirectory = FavoriteDirectory.loadByPath(BCACertsTable.this.getType().toString(), "exportDir", null);
BDirectory bDirectory2 = (BDirectory)BFileChooserDialog.chooseFile(this.getOwner(), null, LEX.getText("CACertsTable.export.dlgTitle"), LEX.getText("CACertsTable.export.dlgMessage"), (BIFile)bDirectory, IFileFilter.directory, null, null);
if (bDirectory2 != null) {
int[] nArray = BCACertsTable.this.getSelection().getRows();
for (int i = 0; i < nArray.length; ++i) {
BIFile bIFile = BCACertsTable.this.caCertModel().cert((int)nArray[i]).file;
BIFile bIFile2 = BFileSystem.INSTANCE.makeFile(bDirectory2.getFilePath().merge(bIFile.getFileName()));
FileUtil.pipe((BIFile)bIFile, (BIFile)bIFile2);
}
FavoriteDirectory.savePath(BCACertsTable.this.getType().toString(), "exportDir", bDirectory2.getFilePath().getParent());
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class ViewCommand
extends Command {
public ViewCommand() {
super((BWidget)BCACertsTable.this, LEX, "CACertsTable.view");
}
public CommandArtifact doInvoke() {
return null;
}
}
protected class DeleteCommand
extends Command {
public DeleteCommand() {
super((BWidget)BCACertsTable.this, LEX, "CACertsTable.delete");
}
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BCACertsTable.this, (String)LEX.getText("CACertsTable.delete.dlgTitle"), (Object)LEX.getText("CACertsTable.delete.dlgMessage"), (int)12)) {
int[] nArray = BCACertsTable.this.getSelection().getRows();
Object object = BCACertsTable.this.beginFileTransfer();
for (int i = 0; i < nArray.length; ++i) {
BCACertsTable.this.deleteCertFile(BCACertsTable.this.caCertModel().cert((int)nArray[i]).file, object);
}
BCACertsTable.this.commitFileTransfer(object);
BCACertsTable.this.caCertModel().load(BCACertsTable.this.dir);
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class ImportCommand
extends Command {
public ImportCommand() {
super((BWidget)BCACertsTable.this, LEX, "CACertsTable.import");
}
public CommandArtifact doInvoke() {
try {
BDirectory bDirectory = FavoriteDirectory.loadByPath(BCACertsTable.this.getType().toString(), "caCertDir", null);
BIFile[] bIFileArray = BFileChooserDialog.chooseFiles(this.getOwner(), BImage.make((String)LEX.getText("CACertsTable.import.dlgIcon")), LEX.getText("CACertsTable.import.dlgTitle"), LEX.getText("CACertsTable.import.dlgMessage"), (BIFile)bDirectory, (IFileFilter)PEM_FILTER, (IFileFilter)PEM_FILTER);
if (bIFileArray == null || bIFileArray.length == 0) {
return null;
}
PemCertInfo[] pemCertInfoArray = PemCertInfo.makeCertificates(bIFileArray);
Object object = BCACertsTable.this.beginFileTransfer();
Array array = new Array(class$java$lang$String == null ? (class$java$lang$String = BCACertsTable.class$("java.lang.String")) : class$java$lang$String);
for (int i = 0; i < pemCertInfoArray.length; ++i) {
if (pemCertInfoArray[i].cert == null) {
array.add((Object)pemCertInfoArray[i].file.getFileName());
continue;
}
BCACertsTable.this.installCertFile(pemCertInfoArray[i].file, object);
}
BCACertsTable.this.commitFileTransfer(object);
if (array.size() > 0) {
BIndentPane bIndentPane = new BIndentPane();
bIndentPane.add(LEX.getText("CACerts.import.invalidFile.header"));
bIndentPane.indent();
for (int i = 0; i < array.size(); ++i) {
bIndentPane.add(array.get(i).toString());
}
BDialog.warning((BWidget)this.getOwner(), (String)LEX.getText("CACertsTable.import.invalidFile.dlgTitle"), (Object)((Object)bIndentPane));
}
BCACertsTable.this.caCertModel().load(BCACertsTable.this.dir);
if (bIFileArray.length > 0) {
FavoriteDirectory.savePath(BCACertsTable.this.getType().toString(), "caCertDir", bIFileArray[0].getFilePath().getParent());
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected static class CACertModel
extends TableModel {
private Array certs = new Array(class$com$tridium$platform$pki$PemCertInfo == null ? (class$com$tridium$platform$pki$PemCertInfo = BCACertsTable.class$("com.tridium.platform.pki.PemCertInfo")) : class$com$tridium$platform$pki$PemCertInfo);
protected CACertModel() {
}
public void load(BDirectory bDirectory) throws Exception {
if (bDirectory == null) {
this.certs.clear();
} else {
this.certs = new Array((Object[])PemCertInfo.makeCertificates(bDirectory.listFiles()));
}
this.updateTable(true);
}
public int getColumnCount() {
return 6;
}
public String getColumnName(int n) {
switch (n) {
case 0: {
return LEX.getText("CACertsTable.col.source");
}
case 1: {
return LEX.getText("CACertsTable.col.issuer");
}
case 2: {
return LEX.getText("CACertsTable.col.subject");
}
case 3: {
return LEX.getText("CACertsTable.col.start");
}
case 4: {
return LEX.getText("CACertsTable.col.end");
}
case 5: {
return LEX.getText("CACertsTable.col.sig");
}
}
throw new IndexOutOfBoundsException();
}
public int getRowCount() {
return this.certs.size();
}
public PemCertInfo cert(int n) {
return (PemCertInfo)this.certs.get(n);
}
public Object getValueAt(int n, int n2) {
switch (n2) {
case 0: {
return this.cert((int)n).file.getFileName();
}
case 1: {
return this.cert(n).getIssuer();
}
case 2: {
return this.cert(n).getSubject();
}
case 3: {
return this.cert(n).getStart();
}
case 4: {
return this.cert(n).getEnd();
}
case 5: {
return this.cert(n).getSignatureAlgName();
}
}
throw new IndexOutOfBoundsException();
}
}
}
@@ -0,0 +1,699 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.file.FileUtil
* javax.baja.file.IFileFilter
* javax.baja.gx.BImage
* javax.baja.gx.Size
* javax.baja.nre.util.Array
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.table.TableModel
* javax.baja.ui.wizard.BWizard
* javax.baja.ui.wizard.BWizardHeader
* javax.baja.ui.wizard.WizardModel
* javax.baja.util.Lexicon
* javax.baja.workbench.BWbShell
*/
package com.tridium.platform.ui.pki;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.pki.ClientPrivateKeyInfo;
import com.tridium.platform.pki.PemCertInfo;
import com.tridium.platform.ui.util.BCommandBoundTable;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.BFileChooserPane;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.platform.ui.util.FavoriteDirectory;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.file.IFileFilter;
import javax.baja.gx.BImage;
import javax.baja.gx.Size;
import javax.baja.nre.util.Array;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.table.TableModel;
import javax.baja.ui.wizard.BWizard;
import javax.baja.ui.wizard.BWizardHeader;
import javax.baja.ui.wizard.WizardModel;
import javax.baja.util.Lexicon;
import javax.baja.workbench.BWbShell;
public class BClientKeysTable
extends BCommandBoundTable
implements CommandBindings.Support {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$pki$BClientKeysTable == null ? (class$com$tridium$platform$ui$pki$BClientKeysTable = BClientKeysTable.class$("com.tridium.platform.ui.pki.BClientKeysTable")) : class$com$tridium$platform$ui$pki$BClientKeysTable));
public static final Lexicon LEX = Lexicon.make((String)"platform");
protected FilePath keyDirPath;
protected BDirectory keyDir;
protected FilePath certDirPath;
protected BDirectory certDir;
protected BFileSpace space;
protected boolean readonly = false;
public static final ExtFileFilter KEY_FILTER = new ExtFileFilter("", "p12,pks,pem");
public static final ExtFileFilter CERT_FILTER = new ExtFileFilter("", "pem,crt,cer");
protected static final int COL_KEY_FILE = 0;
protected static final int COL_CERT_FILE = 1;
static /* synthetic */ Class class$com$tridium$platform$ui$pki$BClientKeysTable;
static /* synthetic */ Class class$com$tridium$platform$pki$ClientPrivateKeyInfo;
public Type getType() {
return TYPE;
}
public BClientKeysTable() {
throw new UnsupportedOperationException();
}
public BClientKeysTable(FilePath filePath, FilePath filePath2, BFileSpace bFileSpace, CommandBindings.TableController tableController) throws Exception {
this.setModel(new Model());
this.setController(tableController);
this.keyDirPath = filePath;
this.certDirPath = filePath2;
this.space = bFileSpace;
this.keyDir = this.initDir(filePath);
this.certDir = this.initDir(filePath2);
this.initCommands();
}
public BClientKeysTable(FilePath filePath, FilePath filePath2, BFileSpace bFileSpace) throws Exception {
this.setModel(new Model());
this.keyDirPath = filePath;
this.certDirPath = filePath2;
this.space = bFileSpace;
this.keyDir = this.initDir(filePath);
this.certDir = this.initDir(filePath2);
this.initCommands();
}
public void load() throws Exception {
this.keysModel().load();
}
protected Model keysModel() {
return (Model)this.getModel();
}
protected void initCommands() {
this.getCommandBindings().setSupport(this);
this.addCommand(new ImportCommand(), BCommandEnablePolicy.always);
this.addCommand(new BackupCommand(), BCommandEnablePolicy.singleSelection);
ViewCommand viewCommand = new ViewCommand();
this.addCommand(viewCommand, BCommandEnablePolicy.singleSelection);
this.setDoubleClickCommand(viewCommand);
this.addCommand(new DeleteCommand(), BCommandEnablePolicy.anySelection);
}
protected BDirectory initDir(FilePath filePath) throws Exception {
if (this.space instanceof BDaemonFileSpace) {
BDirectory bDirectory = (BDirectory)this.space.findFile(filePath);
if (bDirectory == null) {
this.initDir(filePath.getParent());
BDaemonFileSpace bDaemonFileSpace = (BDaemonFileSpace)this.space;
DaemonFileUtil.transfer(bDaemonFileSpace.getDaemonSession(), FileTransferMessage.makeMkDir(filePath, bDaemonFileSpace), null);
bDirectory = (BDirectory)this.space.findFile(filePath);
}
return bDirectory;
}
return this.space.makeDir(filePath);
}
protected Object beginFileTransfer() {
if (this.space instanceof BDaemonFileSpace) {
return new FileTransferMessage((BDaemonFileSpace)this.space);
}
return null;
}
protected void install(ClientPrivateKeyInfo clientPrivateKeyInfo, Object object) throws Exception {
FilePath filePath = this.keyDir.getFilePath().merge(clientPrivateKeyInfo.keyFile.getFileName());
FilePath filePath2 = null;
if (clientPrivateKeyInfo.certFile != null && clientPrivateKeyInfo.certFile != clientPrivateKeyInfo.keyFile) {
filePath2 = this.certDir.getFilePath().merge(clientPrivateKeyInfo.getNormalCertFilename());
}
if (this.space instanceof BDaemonFileSpace) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
fileTransferMessage.addFile(clientPrivateKeyInfo.keyFile, filePath);
if (filePath2 != null) {
fileTransferMessage.addFile(clientPrivateKeyInfo.certFile, filePath2);
}
} else {
BIFile bIFile = this.keyDir.getFileSpace().makeFile(filePath);
FileUtil.pipe((BIFile)clientPrivateKeyInfo.keyFile, (BIFile)bIFile);
if (filePath2 != null) {
bIFile = this.certDir.getFileSpace().makeFile(filePath2);
FileUtil.pipe((BIFile)clientPrivateKeyInfo.certFile, (BIFile)bIFile);
}
}
}
protected void delete(ClientPrivateKeyInfo clientPrivateKeyInfo, Object object) throws Exception {
if (this.space instanceof BDaemonFileSpace) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
fileTransferMessage.addDelete(clientPrivateKeyInfo.keyFile.getFilePath());
if (clientPrivateKeyInfo.certFile != null) {
fileTransferMessage.addDelete(clientPrivateKeyInfo.certFile.getFilePath());
}
} else {
clientPrivateKeyInfo.keyFile.delete();
if (clientPrivateKeyInfo.certFile != null) {
clientPrivateKeyInfo.certFile.delete();
}
}
}
protected void commitFileTransfer(Object object) throws Exception {
if (object != null) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
DaemonFileUtil.transfer(fileTransferMessage.getTargetFileSpace().getDaemonSession(), (FileTransferMessage)object, null);
}
}
public void setReadonly(boolean bl) {
this.readonly = bl;
this.setCommandEnabledStates();
}
public boolean isReadonly() {
return this.readonly;
}
public void setBoundCommandEnabled(Command command, boolean bl) {
if (this.readonly && (command instanceof ImportCommand || command instanceof DeleteCommand)) {
command.setEnabled(false);
} else {
command.setEnabled(bl);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
protected class CertFileStep
extends ImportWizardStep
implements BFileChooserPane.Listener {
private int mode = 0;
private BFileChooserPane chooser;
public CertFileStep(ImportWizardModel importWizardModel) {
super(importWizardModel);
this.chooser = new BFileChooserPane((BIFile)FavoriteDirectory.loadByPath(BClientKeysTable.this.getType().toString(), "clientCertDir", null), (IFileFilter)CERT_FILTER, (IFileFilter)CERT_FILTER, null, null, false, false, null);
this.setContent((BWidget)this.chooser);
this.chooser.addListener(this);
}
public String getStepName() {
return "certFile";
}
public int getMode() {
return this.mode;
}
public void enter() {
this.chooser.notifyFileSelected();
}
public boolean exit(int n) {
if (this.chooser.getSelectedFile() != null) {
FavoriteDirectory.savePath(BClientKeysTable.this.getType().toString(), "clientCertDir", this.chooser.getSelectedFile().getFilePath().getParent());
}
if (n == 4) {
this.wizardModel.getKeyInfo().certFile = this.chooser.getSelectedFile();
}
return true;
}
public void fileSelected(boolean bl) {
if (bl) {
try {
bl = PemCertInfo.getPEMCertificate(this.chooser.getSelectedFile(), new int[0]) != null;
}
catch (Exception exception) {
bl = false;
}
}
this.mode = bl ? 5 : 1;
this.wizardModel.update(this.mode);
}
}
protected class KeyFileStep
extends ImportWizardStep
implements BFileChooserPane.Listener {
private int mode = 0;
private BFileChooserPane chooser;
private ClientPrivateKeyInfo info;
public KeyFileStep(ImportWizardModel importWizardModel) {
super(importWizardModel);
this.chooser = new BFileChooserPane((BIFile)FavoriteDirectory.loadByPath(BClientKeysTable.this.getType().toString(), "clientKeyDir", null), (IFileFilter)KEY_FILTER, (IFileFilter)KEY_FILTER, null, null, false, false, null);
this.setContent((BWidget)this.chooser);
this.chooser.addListener(this);
this.nextStep = new CertFileStep(importWizardModel);
this.nextStep.priorStep = this;
}
public String getStepName() {
return "keyFile";
}
public int getMode() {
return this.mode;
}
public void enter() {
this.chooser.notifyFileSelected();
}
public boolean exit(int n) {
FavoriteDirectory.savePath(BClientKeysTable.this.getType().toString(), "clientKeyDir", this.chooser.getSelectedFile().getFilePath().getParent());
this.wizardModel.setKeyInfo(this.info);
return true;
}
public void fileSelected(boolean bl) {
this.info = null;
if (bl) {
try {
this.info = new ClientPrivateKeyInfo(this.chooser.getSelectedFile());
if (this.info.hasKey) {
this.mode = this.info.certFile == null ? 2 : 4;
this.wizardModel.update(this.mode);
return;
}
}
catch (Exception exception) {
// empty catch block
}
}
this.mode = 0;
this.wizardModel.update(0);
}
}
protected abstract class ImportWizardStep {
protected BEdgePane contentPane;
protected BEdgePane stepPane;
protected ImportWizardStep priorStep = null;
protected ImportWizardStep nextStep = null;
protected ImportWizardStep lastStep = this;
protected ImportWizardStep stepAfterSection = null;
protected ImportWizardModel wizardModel;
public ImportWizardStep(ImportWizardModel importWizardModel) {
this.wizardModel = importWizardModel;
this.contentPane = new BEdgePane(null, null, null, null, null);
this.stepPane = new BEdgePane((BWidget)new BWizardHeader(this.getIcon(), LEX.get("ClientKeysTable.importWizard." + this.getStepName() + ".title", ""), LEX.get("ClientKeysTable.importWizard." + this.getStepName() + ".desc", "")), null, null, null, (BWidget)new BBorderPane((BWidget)this.contentPane, 5.0, 10.0, 4.0, 10.0));
}
public BWidget getWidget() {
return this.stepPane;
}
public final BImage getIcon() {
String string = LEX.get("ClientKeysTable.importWizard." + this.getStepName() + ".stepIcon", null);
return string == null ? null : BImage.make((String)string);
}
public abstract String getStepName();
protected void checkMode() {
}
public void sendDaemonMessages() {
}
protected void setContent(BWidget bWidget) {
this.contentPane.setCenter(bWidget);
bWidget.relayout();
this.contentPane.relayout();
}
public boolean showCancelPrompt() {
return true;
}
public int getMode() {
int n = 0;
ImportWizardStep importWizardStep = this.priorStep;
while (importWizardStep != null && importWizardStep.isSkipped()) {
importWizardStep = importWizardStep.priorStep;
}
if (importWizardStep != null) {
n = 1;
}
importWizardStep = this.nextStep;
while (importWizardStep != null && importWizardStep.isSkipped()) {
importWizardStep = importWizardStep.nextStep;
}
n = importWizardStep == null ? (n |= 4) : (n |= 2);
return n;
}
public void enter() {
}
public boolean checkBack() {
return true;
}
public boolean checkNext() {
return true;
}
public boolean exit(int n) {
return true;
}
public boolean cancel() {
return true;
}
public boolean isSkipped() {
return false;
}
public void setStepAfterSection(ImportWizardStep importWizardStep) {
this.stepAfterSection = importWizardStep;
this.lastStep.nextStep = importWizardStep;
if (importWizardStep != null) {
importWizardStep.priorStep = this.lastStep;
}
}
public void setPriorStep(ImportWizardStep importWizardStep) {
this.priorStep = importWizardStep;
}
}
protected class ImportWizardModel
extends WizardModel {
protected BWidget owner;
protected Context context;
protected BWbShell shell;
protected boolean noChanges = false;
protected boolean canceled;
protected ImportWizardStep currentStep = null;
protected ClientPrivateKeyInfo keyInfo = null;
public ImportWizardModel(BWidget bWidget, Context context) throws Exception {
this.context = context;
this.owner = bWidget;
this.shell = BWbShell.getWbShell((BWidget)bWidget);
this.currentStep = new KeyFileStep(this);
}
public ClientPrivateKeyInfo getKeyInfo() {
return this.keyInfo;
}
public void setKeyInfo(ClientPrivateKeyInfo clientPrivateKeyInfo) {
this.keyInfo = clientPrivateKeyInfo;
}
public Context getContext() {
return this.context;
}
public BWidget getOwner() {
return this.owner;
}
public BWbShell getWbShell() {
return this.shell;
}
public boolean hasNoChanges() {
return this.noChanges;
}
public String getTitle() {
return LEX.getText("ClientKeysTable.importWizard.title");
}
public boolean cancel() {
if ((!this.getCurrentStep().showCancelPrompt() || BDialog.confirm((BWidget)this.getWizard(), (String)LEX.getText("ClientKeysTable.importWizard.cancel.title"), (Object)LEX.getText("ClientKeysTable.importWizard.cancel.message")) == 4) && this.getCurrentStep().cancel()) {
this.keyInfo = null;
return true;
}
return false;
}
public void setWizard(BWizard bWizard) {
super.setWizard(bWizard);
this.owner = bWizard;
}
public boolean hasNoSteps() {
ImportWizardStep importWizardStep = this.currentStep;
while (importWizardStep != null && importWizardStep.isSkipped()) {
importWizardStep = importWizardStep.nextStep;
}
return importWizardStep == null;
}
public void init() {
ImportWizardStep importWizardStep = this.currentStep;
while (importWizardStep != null && importWizardStep.isSkipped()) {
importWizardStep = importWizardStep.nextStep;
}
if (importWizardStep != null) {
this.update(importWizardStep);
importWizardStep.enter();
}
}
public void back() {
try {
if (!this.getCurrentStep().checkBack()) {
return;
}
ImportWizardStep importWizardStep = this.getCurrentStep().priorStep;
if (importWizardStep != null && this.getCurrentStep().exit(1)) {
while (importWizardStep != null && importWizardStep.isSkipped()) {
importWizardStep = importWizardStep.priorStep;
}
if (importWizardStep != null) {
this.update(importWizardStep);
importWizardStep.enter();
}
}
}
catch (Throwable throwable) {
BDialog.error((BWidget)this.getWizard(), (String)LEX.getText("ClientKeysTable.importWizard.error.dlgTitle"), (Object)LEX.getText("ClientKeysTable.importWizard.error.dlgMessage"), (Throwable)throwable);
}
}
public void next() {
if (!this.getCurrentStep().checkNext()) {
return;
}
new Thread(){
public void run() {
try {
ImportWizardStep importWizardStep;
if (ImportWizardModel.this.owner != null) {
ImportWizardModel.this.owner.enterBusy();
}
if ((importWizardStep = ImportWizardModel.this.getCurrentStep().nextStep) != null && ImportWizardModel.this.getCurrentStep().exit(2)) {
while (importWizardStep != null && importWizardStep.isSkipped()) {
importWizardStep = importWizardStep.nextStep;
}
if (importWizardStep != null) {
importWizardStep.enter();
ImportWizardModel.this.update(importWizardStep);
}
}
}
catch (Throwable throwable) {
BDialog.error((BWidget)ImportWizardModel.this.getWizard(), (String)LEX.getText("ClientKeysTable.importWizard.error.dlgTitle"), (Object)LEX.getText("ClientKeysTable.importWizard.error.dlgMessage"), (Throwable)throwable);
}
finally {
if (ImportWizardModel.this.owner != null) {
ImportWizardModel.this.owner.exitBusy();
}
}
}
}.start();
}
public boolean finish() {
return this.getCurrentStep().exit(4);
}
public ImportWizardStep getCurrentStep() {
return this.currentStep;
}
public void update(ImportWizardStep importWizardStep) {
this.currentStep = importWizardStep;
this.update(importWizardStep.getWidget(), importWizardStep.getMode());
}
public Size getPreferredSizeOfSteps() {
return new Size(680.0, 480.0);
}
}
protected class ImportCommand
extends Command {
public ImportCommand() {
super((BWidget)BClientKeysTable.this, LEX, "ClientKeysTable.import");
}
public CommandArtifact doInvoke() {
try {
ImportWizardModel importWizardModel = new ImportWizardModel(this.getOwner(), null);
BWizard.open((BWidget)this.getOwner(), (WizardModel)importWizardModel);
ClientPrivateKeyInfo clientPrivateKeyInfo = importWizardModel.getKeyInfo();
if (clientPrivateKeyInfo != null) {
Object object = BClientKeysTable.this.beginFileTransfer();
BClientKeysTable.this.install(clientPrivateKeyInfo, object);
BClientKeysTable.this.commitFileTransfer(object);
BClientKeysTable.this.keysModel().load();
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class BackupCommand
extends Command {
public BackupCommand() {
super((BWidget)BClientKeysTable.this, LEX, "ClientKeysTable.backup");
}
public CommandArtifact doInvoke() {
return null;
}
}
protected class ViewCommand
extends Command {
public ViewCommand() {
super((BWidget)BClientKeysTable.this, LEX, "ClientKeysTable.view");
}
public CommandArtifact doInvoke() {
return null;
}
}
protected class DeleteCommand
extends Command {
public DeleteCommand() {
super((BWidget)BClientKeysTable.this, LEX, "ClientKeysTable.delete");
}
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BClientKeysTable.this, (String)LEX.getText("ClientKeysTable.delete.dlgTitle"), (Object)LEX.getText("ClientKeysTable.delete.dlgMessage"), (int)12)) {
int[] nArray = BClientKeysTable.this.getSelection().getRows();
Object object = BClientKeysTable.this.beginFileTransfer();
for (int i = 0; i < nArray.length; ++i) {
BClientKeysTable.this.delete(BClientKeysTable.this.keysModel().keyInfo(nArray[i]), object);
}
BClientKeysTable.this.commitFileTransfer(object);
BClientKeysTable.this.keysModel().load();
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class Model
extends TableModel {
private Array keys = new Array(class$com$tridium$platform$pki$ClientPrivateKeyInfo == null ? (class$com$tridium$platform$pki$ClientPrivateKeyInfo = BClientKeysTable.class$("com.tridium.platform.pki.ClientPrivateKeyInfo")) : class$com$tridium$platform$pki$ClientPrivateKeyInfo);
protected Model() {
}
public void load() throws Exception {
if (BClientKeysTable.this.keyDir == null) {
this.keys.clear();
} else {
this.keys = new Array((Object[])ClientPrivateKeyInfo.make(BClientKeysTable.this.keyDir.listFiles(), BClientKeysTable.this.certDir));
}
this.updateTable(true);
}
public int getColumnCount() {
return 2;
}
public String getColumnName(int n) {
switch (n) {
case 0: {
return LEX.getText("ClientKeysTable.col.keyFile");
}
case 1: {
return LEX.getText("ClientKeysTable.col.certFile");
}
}
throw new IndexOutOfBoundsException();
}
public int getRowCount() {
return this.keys.size();
}
public ClientPrivateKeyInfo keyInfo(int n) {
return (ClientPrivateKeyInfo)this.keys.get(n);
}
public Object getValueAt(int n, int n2) {
switch (n2) {
case 0: {
return this.keyInfo((int)n).keyFile.getFileName();
}
case 1: {
return this.keyInfo((int)n).certFile == null ? null : this.keyInfo((int)n).certFile.getFileName();
}
}
throw new IndexOutOfBoundsException();
}
}
}
@@ -0,0 +1,164 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* javax.baja.file.BFileSpace
* javax.baja.gx.BBrush
* javax.baja.gx.BInsets
* javax.baja.naming.BOrd
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BScrollPane
* javax.baja.ui.pane.BTabbedPane
* javax.baja.ui.table.BTable
* javax.baja.ui.util.BTitlePane
* javax.baja.util.Lexicon
* javax.baja.util.LexiconText
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui.pki;
import com.tridium.platform.pki.ClientPrivateKeyInfo;
import com.tridium.platform.pki.PemCertInfo;
import com.tridium.platform.ui.pki.BCACertsTable;
import com.tridium.platform.ui.pki.BClientKeysTable;
import com.tridium.platform.ui.pki.BServerCertsTable;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.ui.theme.Theme;
import javax.baja.file.BFileSpace;
import javax.baja.gx.BBrush;
import javax.baja.gx.BInsets;
import javax.baja.naming.BOrd;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BBorder;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.ui.pane.BTabbedPane;
import javax.baja.ui.table.BTable;
import javax.baja.ui.util.BTitlePane;
import javax.baja.util.Lexicon;
import javax.baja.util.LexiconText;
import javax.baja.workbench.view.BWbComponentView;
public class BPKICertificateManager
extends BWbComponentView {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$pki$BPKICertificateManager == null ? (class$com$tridium$platform$ui$pki$BPKICertificateManager = BPKICertificateManager.class$("com.tridium.platform.ui.pki.BPKICertificateManager")) : class$com$tridium$platform$ui$pki$BPKICertificateManager));
protected BLabel caDesription;
protected BEdgePane caCertsPane;
protected BButtonPane caCertsButtons;
protected BLabel serverCertsDesription;
protected BEdgePane serverCertsPane;
protected BButtonPane serverCertsButtons;
protected BLabel clientKeysDesription;
protected BEdgePane clientKeysPane;
protected BButtonPane clientKeysButtons;
protected BTabbedPane tabbedPane = new BTabbedPane();
protected static final Lexicon LEX = Lexicon.make((String)"platform");
static /* synthetic */ Class class$com$tridium$platform$ui$pki$BPKICertificateManager;
public Type getType() {
return TYPE;
}
public BPKICertificateManager() {
this.caCertsButtons = new BButtonPane();
this.clientKeysButtons = new BButtonPane();
this.serverCertsButtons = new BButtonPane();
this.caDesription = new BLabel(LEX.getText("CACertsTable.description"), Theme.widget().getBoldText());
this.caCertsPane = new BEdgePane();
this.caCertsPane.setTop((BWidget)new BBorderPane(this.left((BWidget)this.caDesription)));
this.clientKeysDesription = new BLabel(LEX.getText("ClientKeysTable.description"), Theme.widget().getBoldText());
this.clientKeysPane = new BEdgePane();
this.clientKeysPane.setTop((BWidget)new BBorderPane(this.left((BWidget)this.clientKeysDesription)));
this.serverCertsDesription = new BLabel(LEX.getText("ServerCertsTable.description"), Theme.widget().getBoldText());
this.serverCertsPane = new BEdgePane();
this.serverCertsPane.setTop((BWidget)new BBorderPane(this.left((BWidget)this.serverCertsDesription)));
BBrush bBrush = Theme.scrollPane().getControlBackground();
BScrollPane bScrollPane = new BScrollPane((BWidget)new BBorderPane((BWidget)this.tabbedPane));
bScrollPane.setViewportBackground(bBrush);
this.setContent((BWidget)new BBorderPane((BWidget)bScrollPane, BBorder.inset, BInsets.DEFAULT));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BFileSpace bFileSpace = (BFileSpace)BOrd.make((String)"file:").get(bObject);
BCACertsTable bCACertsTable = new BCACertsTable(PemCertInfo.CA_CERTS_PATH, bFileSpace);
Command[] commandArray = bCACertsTable.getCommands();
this.caCertsButtons.removeAll();
for (int i = 0; i < commandArray.length; ++i) {
this.caCertsButtons.add(commandArray[i]);
}
BTitlePane bTitlePane = BTitlePane.makePane((String)LEX.getText("PKICertificateManager.caCerts"), (BTable)bCACertsTable);
BBorderPane bBorderPane = new BBorderPane((BWidget)this.caCertsButtons);
bBorderPane.setPadding(BInsets.make((double)5.0, (double)0.0, (double)5.0, (double)0.0));
bTitlePane.setBottom((BWidget)bBorderPane);
this.caCertsPane.setCenter((BWidget)new BBorderPane((BWidget)bTitlePane, BInsets.make((double)0.0, (double)7.0, (double)7.0, (double)7.0)));
bCACertsTable.load();
BServerCertsTable bServerCertsTable = new BServerCertsTable(PemCertInfo.SERVER_CERTS_PATH, bFileSpace);
commandArray = bServerCertsTable.getCommands();
this.serverCertsButtons.removeAll();
for (int i = 0; i < commandArray.length; ++i) {
this.serverCertsButtons.add(commandArray[i]);
}
BTitlePane bTitlePane2 = BTitlePane.makePane((String)LEX.getText("PKICertificateManager.serverCerts"), (BTable)bServerCertsTable);
BBorderPane bBorderPane2 = new BBorderPane((BWidget)this.serverCertsButtons);
bBorderPane2.setPadding(BInsets.make((double)5.0, (double)0.0, (double)5.0, (double)0.0));
bTitlePane2.setBottom((BWidget)bBorderPane2);
this.serverCertsPane.setCenter((BWidget)new BBorderPane((BWidget)bTitlePane2, BInsets.make((double)0.0, (double)7.0, (double)7.0, (double)7.0)));
bServerCertsTable.load();
BClientKeysTable bClientKeysTable = new BClientKeysTable(ClientPrivateKeyInfo.CLIENT_KEYS_PATH, ClientPrivateKeyInfo.CLIENT_CERTS_PATH, bFileSpace);
commandArray = bClientKeysTable.getCommands();
this.clientKeysButtons.removeAll();
for (int i = 0; i < commandArray.length; ++i) {
this.clientKeysButtons.add(commandArray[i]);
}
BTitlePane bTitlePane3 = BTitlePane.makePane((String)LEX.getText("PKICertificateManager.clientKeys"), (BTable)bClientKeysTable);
BBorderPane bBorderPane3 = new BBorderPane((BWidget)this.clientKeysButtons);
bBorderPane3.setPadding(BInsets.make((double)5.0, (double)0.0, (double)5.0, (double)0.0));
bTitlePane3.setBottom((BWidget)bBorderPane3);
this.clientKeysPane.setCenter((BWidget)new BBorderPane((BWidget)bTitlePane3, BInsets.make((double)0.0, (double)7.0, (double)7.0, (double)7.0)));
bClientKeysTable.load();
this.tabbedPane.addPane(new BLabel(LexiconText.make((Type)TYPE, (String)"PKICertificateManager.clientKeys").getText(context), Theme.widget().getBoldText()), (BWidget)this.clientKeysPane);
this.tabbedPane.addPane(new BLabel(LexiconText.make((Type)TYPE, (String)"PKICertificateManager.serverCerts").getText(context), Theme.widget().getBoldText()), (BWidget)this.serverCertsPane);
this.tabbedPane.addPane(new BLabel(LexiconText.make((Type)TYPE, (String)"PKICertificateManager.caCerts").getText(context), Theme.widget().getBoldText()), (BWidget)this.caCertsPane);
}
private BWidget left(BWidget bWidget) {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.left);
bGridPane.add(null, (BValue)bWidget);
return bGridPane;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,65 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.BIAgent
* javax.baja.naming.BISession
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.ui.pki;
import com.tridium.platform.BSessionNavNode;
import com.tridium.platform.BSessionNavNodeFactory;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BHostProperties;
import com.tridium.platform.ui.pki.BPKICertificateManager;
import javax.baja.agent.BIAgent;
import javax.baja.naming.BISession;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public class BPKINavNodeFactory
extends BSessionNavNodeFactory
implements BIAgent {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$pki$BPKINavNodeFactory == null ? (class$com$tridium$platform$ui$pki$BPKINavNodeFactory = BPKINavNodeFactory.class$("com.tridium.platform.ui.pki.BPKINavNodeFactory")) : class$com$tridium$platform$ui$pki$BPKINavNodeFactory));
static /* synthetic */ Class class$com$tridium$platform$ui$pki$BPKINavNodeFactory;
public Type getType() {
return TYPE;
}
public boolean equivalent(Object object) {
return false;
}
public String toString(Context context) {
return null;
}
public void connect() {
BDaemonSession bDaemonSession = (BDaemonSession)this.getNavSession();
BSessionNavNode[] bSessionNavNodeArray = new BSessionNavNode[]{new BSessionNavNode((BISession)bDaemonSession, BPKICertificateManager.TYPE)};
boolean bl = false;
BHostProperties bHostProperties = bDaemonSession.getHostProperties();
if (bHostProperties.supportsServlet("wifi")) {
bl = true;
}
if (bHostProperties.supportsServlet("ieee8021x") && !bHostProperties.supportsServlet("crypto")) {
bl = true;
}
this.setNavNodes(bl ? bSessionNavNodeArray : new BSessionNavNode[]{});
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,377 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BFileSystem
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.file.FileUtil
* javax.baja.file.IFileFilter
* javax.baja.gx.BImage
* javax.baja.nre.util.Array
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.table.TableModel
* javax.baja.util.Lexicon
*/
package com.tridium.platform.ui.pki;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.pki.PemCertInfo;
import com.tridium.platform.ui.util.BCommandBoundTable;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.BFileChooserDialog;
import com.tridium.platform.ui.util.BIndentPane;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.platform.ui.util.FavoriteDirectory;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.file.IFileFilter;
import javax.baja.gx.BImage;
import javax.baja.nre.util.Array;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.table.TableModel;
import javax.baja.util.Lexicon;
public class BServerCertsTable
extends BCommandBoundTable
implements CommandBindings.Support {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$pki$BServerCertsTable == null ? (class$com$tridium$platform$ui$pki$BServerCertsTable = BServerCertsTable.class$("com.tridium.platform.ui.pki.BServerCertsTable")) : class$com$tridium$platform$ui$pki$BServerCertsTable));
public static final Lexicon LEX = Lexicon.make((String)"platform");
public static final ExtFileFilter PEM_FILTER = new ExtFileFilter("", "pem,crt,cer");
protected BDirectory dir;
protected FilePath dirPath;
protected BFileSpace space;
public static final int COL_SOURCE = 0;
public static final int COL_ISSUER = 1;
public static final int COL_SUBJECT = 2;
public static final int COL_START = 3;
public static final int COL_END = 4;
public static final int COL_ALG = 5;
protected boolean readonly = false;
static /* synthetic */ Class class$com$tridium$platform$ui$pki$BServerCertsTable;
static /* synthetic */ Class class$com$tridium$platform$pki$PemCertInfo;
static /* synthetic */ Class class$java$lang$String;
public Type getType() {
return TYPE;
}
public BServerCertsTable() {
throw new UnsupportedOperationException();
}
public BServerCertsTable(FilePath filePath, BFileSpace bFileSpace, CommandBindings.TableController tableController) throws Exception {
super(new ServerCertModel(), tableController);
this.dirPath = filePath;
this.space = bFileSpace;
this.dir = this.initDir(filePath);
this.initCommands();
}
public BServerCertsTable(FilePath filePath, BFileSpace bFileSpace) throws Exception {
super(new ServerCertModel());
this.dirPath = filePath;
this.space = bFileSpace;
this.dir = this.initDir(filePath);
this.initCommands();
}
public void load() throws Exception {
this.serverCertModel().load(this.dir);
}
protected void initCommands() {
this.getCommandBindings().setSupport(this);
this.addCommand(new ImportCommand(), BCommandEnablePolicy.always);
this.addCommand(new ExportCommand(), BCommandEnablePolicy.anySelection);
ViewCommand viewCommand = new ViewCommand();
this.addCommand(viewCommand, BCommandEnablePolicy.singleSelection);
this.setDoubleClickCommand(viewCommand);
this.addCommand(new DeleteCommand(), BCommandEnablePolicy.anySelection);
}
protected ServerCertModel serverCertModel() {
return (ServerCertModel)this.getModel();
}
protected BDirectory initDir(FilePath filePath) throws Exception {
if (this.space instanceof BDaemonFileSpace) {
BDirectory bDirectory = (BDirectory)this.space.findFile(filePath);
if (bDirectory == null) {
this.initDir(filePath.getParent());
BDaemonFileSpace bDaemonFileSpace = (BDaemonFileSpace)this.space;
DaemonFileUtil.transfer(bDaemonFileSpace.getDaemonSession(), FileTransferMessage.makeMkDir(filePath, bDaemonFileSpace), null);
bDirectory = (BDirectory)this.space.findFile(filePath);
}
return bDirectory;
}
return this.space.makeDir(this.dirPath);
}
protected Object beginFileTransfer() {
if (this.space instanceof BDaemonFileSpace) {
return new FileTransferMessage((BDaemonFileSpace)this.space);
}
return null;
}
protected void installCertFile(BIFile bIFile, Object object) throws Exception {
FilePath filePath = this.dir.getFilePath().merge(FileUtil.getBase((String)bIFile.getFileName()) + ".pem");
if (this.space instanceof BDaemonFileSpace) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
fileTransferMessage.addFile(bIFile, filePath);
} else {
BIFile bIFile2 = this.dir.getFileSpace().makeFile(filePath);
FileUtil.pipe((BIFile)bIFile, (BIFile)bIFile2);
}
}
protected void deleteCertFile(BIFile bIFile, Object object) throws Exception {
if (this.space instanceof BDaemonFileSpace) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
fileTransferMessage.addDelete(bIFile.getFilePath());
} else {
bIFile.delete();
}
}
protected void commitFileTransfer(Object object) throws Exception {
if (object != null) {
FileTransferMessage fileTransferMessage = (FileTransferMessage)object;
DaemonFileUtil.transfer(fileTransferMessage.getTargetFileSpace().getDaemonSession(), (FileTransferMessage)object, null);
}
}
public boolean isReadonly() {
return this.readonly;
}
public void setReadonly(boolean bl) {
this.readonly = bl;
this.setCommandEnabledStates();
}
public void setBoundCommandEnabled(Command command, boolean bl) {
if (this.readonly && (command instanceof ImportCommand || command instanceof DeleteCommand)) {
command.setEnabled(false);
} else {
command.setEnabled(bl);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
protected class ExportCommand
extends Command {
public ExportCommand() {
super((BWidget)BServerCertsTable.this, LEX, "ServerCertsTable.export");
}
public CommandArtifact doInvoke() {
try {
BDirectory bDirectory = FavoriteDirectory.loadByPath(BServerCertsTable.this.getType().toString(), "exportDir", null);
BDirectory bDirectory2 = (BDirectory)BFileChooserDialog.chooseFile(this.getOwner(), null, LEX.getText("ServerCertsTable.export.dlgTitle"), LEX.getText("ServerCertsTable.export.dlgMessage"), (BIFile)bDirectory, IFileFilter.directory, null, null);
if (bDirectory2 != null) {
int[] nArray = BServerCertsTable.this.getSelection().getRows();
for (int i = 0; i < nArray.length; ++i) {
BIFile bIFile = BServerCertsTable.this.serverCertModel().cert((int)nArray[i]).file;
BIFile bIFile2 = BFileSystem.INSTANCE.makeFile(bDirectory2.getFilePath().merge(bIFile.getFileName()));
FileUtil.pipe((BIFile)bIFile, (BIFile)bIFile2);
}
FavoriteDirectory.savePath(BServerCertsTable.this.getType().toString(), "exportDir", bDirectory2.getFilePath().getParent());
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class DeleteCommand
extends Command {
public DeleteCommand() {
super((BWidget)BServerCertsTable.this, LEX, "ServerCertsTable.delete");
}
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BServerCertsTable.this, (String)LEX.getText("ServerCertsTable.delete.dlgTitle"), (Object)LEX.getText("ServerCertsTable.delete.dlgMessage"), (int)12)) {
int[] nArray = BServerCertsTable.this.getSelection().getRows();
Object object = BServerCertsTable.this.beginFileTransfer();
for (int i = 0; i < nArray.length; ++i) {
BServerCertsTable.this.deleteCertFile(BServerCertsTable.this.serverCertModel().cert((int)nArray[i]).file, object);
}
BServerCertsTable.this.commitFileTransfer(object);
BServerCertsTable.this.serverCertModel().load(BServerCertsTable.this.dir);
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class ImportCommand
extends Command {
public ImportCommand() {
super((BWidget)BServerCertsTable.this, LEX, "ServerCertsTable.import");
}
public CommandArtifact doInvoke() {
try {
BDirectory bDirectory = FavoriteDirectory.loadByPath(BServerCertsTable.this.getType().toString(), "serverCertDir", null);
BIFile[] bIFileArray = BFileChooserDialog.chooseFiles(this.getOwner(), BImage.make((String)LEX.getText("ServerCertsTable.import.dlgIcon")), LEX.getText("ServerCertsTable.import.dlgTitle"), LEX.getText("ServerCertsTable.import.dlgMessage"), (BIFile)bDirectory, (IFileFilter)PEM_FILTER, (IFileFilter)PEM_FILTER);
if (bIFileArray == null || bIFileArray.length == 0) {
return null;
}
PemCertInfo[] pemCertInfoArray = PemCertInfo.makeCertificates(bIFileArray);
Object object = BServerCertsTable.this.beginFileTransfer();
Array array = new Array(class$java$lang$String == null ? (class$java$lang$String = BServerCertsTable.class$("java.lang.String")) : class$java$lang$String);
for (int i = 0; i < pemCertInfoArray.length; ++i) {
if (pemCertInfoArray[i].cert == null) {
array.add((Object)pemCertInfoArray[i].file.getFileName());
continue;
}
BServerCertsTable.this.installCertFile(pemCertInfoArray[i].file, object);
}
BServerCertsTable.this.commitFileTransfer(object);
if (array.size() > 0) {
BIndentPane bIndentPane = new BIndentPane();
bIndentPane.add(LEX.getText("ServerCertsTable.import.invalidFile.header"));
bIndentPane.indent();
for (int i = 0; i < array.size(); ++i) {
bIndentPane.add(array.get(i).toString());
}
BDialog.warning((BWidget)this.getOwner(), (String)LEX.getText("ServerCertsTable.import.invalidFile.dlgTitle"), (Object)((Object)bIndentPane));
}
BServerCertsTable.this.serverCertModel().load(BServerCertsTable.this.dir);
if (bIFileArray.length > 0) {
FavoriteDirectory.savePath(BServerCertsTable.this.getType().toString(), "serverCertDir", bIFileArray[0].getFilePath().getParent());
}
}
catch (Exception exception) {
CommandUtil.error(this, exception);
}
return null;
}
}
protected class ViewCommand
extends Command {
public ViewCommand() {
super((BWidget)BServerCertsTable.this, LEX, "ServerCertsTable.view");
}
public CommandArtifact doInvoke() {
return null;
}
}
protected static class ServerCertModel
extends TableModel {
private Array certs = new Array(class$com$tridium$platform$pki$PemCertInfo == null ? (class$com$tridium$platform$pki$PemCertInfo = BServerCertsTable.class$("com.tridium.platform.pki.PemCertInfo")) : class$com$tridium$platform$pki$PemCertInfo);
protected ServerCertModel() {
}
public void load(BDirectory bDirectory) throws Exception {
if (bDirectory == null) {
this.certs.clear();
} else {
this.certs = new Array((Object[])PemCertInfo.makeCertificates(bDirectory.listFiles()));
}
this.updateTable(true);
}
public int getColumnCount() {
return 6;
}
public String getColumnName(int n) {
switch (n) {
case 0: {
return LEX.getText("ServerCertsTable.col.source");
}
case 1: {
return LEX.getText("ServerCertsTable.col.issuer");
}
case 2: {
return LEX.getText("ServerCertsTable.col.subject");
}
case 3: {
return LEX.getText("ServerCertsTable.col.start");
}
case 4: {
return LEX.getText("ServerCertsTable.col.end");
}
case 5: {
return LEX.getText("ServerCertsTable.col.sig");
}
}
throw new IndexOutOfBoundsException();
}
public int getRowCount() {
return this.certs.size();
}
public PemCertInfo cert(int n) {
return (PemCertInfo)this.certs.get(n);
}
public Object getValueAt(int n, int n2) {
switch (n2) {
case 0: {
return this.cert((int)n).file.getFileName();
}
case 1: {
return this.cert(n).getIssuer();
}
case 2: {
return this.cert(n).getSubject();
}
case 3: {
return this.cert(n).getStart();
}
case 4: {
return this.cert(n).getEnd();
}
case 5: {
return this.cert(n).getSignatureAlgName();
}
}
throw new IndexOutOfBoundsException();
}
}
}
@@ -0,0 +1,285 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.util.ValidatingTextController
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.event.BFocusEvent
* javax.baja.ui.event.BKeyEvent
* javax.baja.ui.event.BMouseEvent
* javax.baja.ui.event.BMouseWheelEvent
* javax.baja.ui.text.TextController
* javax.baja.workbench.CannotSaveException
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.tcpip;
import com.tridium.ui.util.ValidatingTextController;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.event.BFocusEvent;
import javax.baja.ui.event.BKeyEvent;
import javax.baja.ui.event.BMouseEvent;
import javax.baja.ui.event.BMouseWheelEvent;
import javax.baja.ui.text.TextController;
import javax.baja.workbench.CannotSaveException;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BIpHostFE
extends BWbFieldEditor {
public static final Action propagateFocusEvent = BIpHostFE.newAction((int)4, (BValue)new BFocusEvent(), null);
public static final Action propagateKeyEvent = BIpHostFE.newAction((int)4, (BValue)new BKeyEvent(), null);
public static final Action propagateMouseEvent = BIpHostFE.newAction((int)4, (BValue)new BMouseEvent(), null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$tcpip$BIpHostFE == null ? (class$com$tridium$platform$ui$tcpip$BIpHostFE = BIpHostFE.class$("com.tridium.platform.ui.tcpip.BIpHostFE")) : class$com$tridium$platform$ui$tcpip$BIpHostFE));
private boolean isIpv6 = false;
private BTextField field;
private static final String HEX = "0123456789abcdefABCDEF";
static /* synthetic */ Class class$com$tridium$platform$ui$tcpip$BIpHostFE;
public void propagateFocusEvent(BFocusEvent bFocusEvent) {
this.invoke(propagateFocusEvent, (BValue)bFocusEvent, null);
}
public void propagateKeyEvent(BKeyEvent bKeyEvent) {
this.invoke(propagateKeyEvent, (BValue)bKeyEvent, null);
}
public void propagateMouseEvent(BMouseEvent bMouseEvent) {
this.invoke(propagateMouseEvent, (BValue)bMouseEvent, null);
}
public Type getType() {
return TYPE;
}
public BIpHostFE() {
this(false);
}
public BIpHostFE(boolean bl) {
this.isIpv6 = bl;
this.field = this.isIpv6 ? new BTextField("", 45) : new BTextField("", 15);
this.field.setController((TextController)(this.isIpv6 ? new Ipv6Controller() : new Controller()));
this.linkTo("lk0", (BComponent)this.field, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo("lk1", (BComponent)this.field, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
this.linkTo("lk2", (BComponent)this.field, (Slot)BTextField.focusEvent, (Slot)propagateFocusEvent);
this.linkTo("lk3", (BComponent)this.field, (Slot)BTextField.keyEvent, (Slot)propagateKeyEvent);
this.linkTo("lk4", (BComponent)this.field, (Slot)BTextField.mouseEvent, (Slot)propagateMouseEvent);
this.setContent((BWidget)this.field);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
BString bString = (BString)bObject;
this.field.setText(bString.toString());
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
String string = this.field.getText();
StringBuffer stringBuffer = new StringBuffer();
int n = 0;
if (string.trim().length() == 0) {
return BString.DEFAULT;
}
if (this.isIpv6) {
int n2 = 0;
int n3 = 0;
if (string.indexOf("::") != string.lastIndexOf("::")) {
throw new CannotSaveException("improper IPv6 address format: ambiguous expansion");
}
for (int n4 = 0; n4 < string.length(); n4 = (int)((short)(n4 + 1))) {
char c = string.charAt(n4);
if (c == ':') {
if (n2 >= 7) {
throw new CannotSaveException("improper IPv6 address format: too many colons");
}
if (n3 > 0) {
stringBuffer.append(Integer.toHexString(Integer.parseInt(string.substring(n, n4), 16)));
}
stringBuffer.append(':');
n3 = 0;
n2 = (short)(n2 + 1);
continue;
}
if (HEX.indexOf(c) != -1) {
if (n3 == 0) {
n = n4;
}
if (n3 >= 4) {
throw new CannotSaveException("improper IPv6 address format: exceeded field width");
}
n3 = (short)(n3 + 1);
continue;
}
throw new CannotSaveException("improper IPv6 address format: illegal character");
}
if (n3 > 0) {
stringBuffer.append(Integer.toHexString(Integer.parseInt(string.substring(n, string.length()), 16)));
}
if (n2 < 2 || stringBuffer.indexOf("::") == -1 && n2 < 7 || n3 == 0 && stringBuffer.lastIndexOf(":") == stringBuffer.length() - 1 && stringBuffer.indexOf("::") != stringBuffer.length() - 2) {
throw new CannotSaveException("improper IPv6 address format: not enough colons or trailing colon");
}
} else {
int n5 = 0;
int n6 = 0;
int n7 = 0;
for (int i = 0; i < string.length(); ++i) {
char c = string.charAt(i);
if (c == '.') {
if (n6 == 0 || n5 >= 3) {
throw new CannotSaveException("improper IPv4 address format: leading dot, double dot, or too many dots");
}
stringBuffer.append(Integer.parseInt(string.substring(n, i)));
stringBuffer.append('.');
n6 = 0;
n7 = 0;
++n5;
continue;
}
if (Character.isDigit(c)) {
if (n6 == 0) {
n = i;
}
if (n6 >= 3) {
throw new CannotSaveException("improper IPv4 address format: too many digits");
}
++n6;
if ((n7 = n7 * 10 + Integer.valueOf(new String("" + c))) <= 255) continue;
throw new CannotSaveException("improper IPv4 address format: value > 255");
}
throw new CannotSaveException("improper IPv4 address format");
}
stringBuffer.append(Integer.parseInt(string.substring(n, string.length())));
if (n5 != 3 || n6 == 0) {
throw new CannotSaveException("improper IPv4 address format: too few dots or trailing dot");
}
}
return BString.make((String)stringBuffer.toString());
}
public void setEnabled(boolean bl) {
this.field.setEditable(bl);
}
protected void doSetReadonly(boolean bl) {
this.setEnabled(!bl);
}
public void doPropagateFocusEvent(BFocusEvent bFocusEvent) {
this.fireFocusEvent(new BFocusEvent(bFocusEvent.getId(), (BWidget)this, bFocusEvent.isTemporary()));
}
public void doPropagateKeyEvent(BKeyEvent bKeyEvent) {
this.fireKeyEvent(new BKeyEvent(bKeyEvent.getId(), (BWidget)this, bKeyEvent.getModifiers(), bKeyEvent.getKeyCode(), bKeyEvent.getKeyChar()));
}
public void doPropagateMouseEvent(BMouseEvent bMouseEvent) {
if (bMouseEvent instanceof BMouseWheelEvent) {
this.fireMouseEvent((BMouseEvent)new BMouseWheelEvent(bMouseEvent.getId(), (BWidget)this, bMouseEvent.getModifiers(), bMouseEvent.getX(), bMouseEvent.getY(), bMouseEvent.getClickCount(), bMouseEvent.isPopupTrigger(), ((BMouseWheelEvent)bMouseEvent).getWheelRotation()));
} else {
this.fireMouseEvent(new BMouseEvent(bMouseEvent.getId(), (BWidget)this, bMouseEvent.getModifiers(), bMouseEvent.getX(), bMouseEvent.getY(), bMouseEvent.getClickCount(), bMouseEvent.isPopupTrigger()));
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private class Ipv6Controller
extends Controller {
private Ipv6Controller() {
}
protected boolean valid(String string) {
if (string.trim().length() == 0) {
return true;
}
int n = 0;
int n2 = 0;
if (string.indexOf("::") != string.lastIndexOf("::")) {
return false;
}
for (int n3 = 0; n3 < string.length(); n3 = (int)((short)(n3 + 1))) {
char c = string.charAt(n3);
if (c == ':') {
if (n >= 7) {
return false;
}
n2 = 0;
n = (short)(n + 1);
continue;
}
if (BIpHostFE.HEX.indexOf(c) != -1) {
if (n2 >= 4) {
return false;
}
n2 = (short)(n2 + 1);
continue;
}
return false;
}
return true;
}
}
private class Controller
extends ValidatingTextController {
private Controller() {
}
protected boolean valid(String string) {
if (string.trim().length() == 0) {
return true;
}
int n = 0;
int n2 = 0;
int n3 = 0;
for (int i = 0; i < string.length(); ++i) {
char c = string.charAt(i);
if (c == '.') {
if (n2 == 0 || n >= 3) {
return false;
}
n2 = 0;
n3 = 0;
++n;
continue;
}
if (Character.isDigit(c)) {
if (n2 >= 3) {
return false;
}
++n2;
if ((n3 = n3 * 10 + Integer.valueOf(new String("" + c))) <= 255) continue;
return false;
}
return false;
}
return true;
}
}
}
@@ -0,0 +1,354 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.gx.BImage
* javax.baja.naming.SlotPath
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BFacets
* javax.baja.sys.BIcon
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.SlotCursor
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BButton
* javax.baja.ui.BToolBar
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.enums.BButtonStyle
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BFocusEvent
* javax.baja.ui.pane.BFlowPane
* javax.baja.ui.pane.BGridPane
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.platform.ui.tcpip;
import com.tridium.platform.ui.tcpip.BIpHostFE;
import com.tridium.platform.ui.util.CommandUtil;
import javax.baja.data.BIDataValue;
import javax.baja.gx.BImage;
import javax.baja.naming.SlotPath;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BButton;
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.BButtonStyle;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BFocusEvent;
import javax.baja.ui.pane.BFlowPane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BIpHostVectorFE
extends BWbFieldEditor {
public static final Action handleFocusChange = BIpHostVectorFE.newAction((int)4, (BValue)new BFocusEvent(), null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$tcpip$BIpHostVectorFE == null ? (class$com$tridium$platform$ui$tcpip$BIpHostVectorFE = BIpHostVectorFE.class$("com.tridium.platform.ui.tcpip.BIpHostVectorFE")) : class$com$tridium$platform$ui$tcpip$BIpHostVectorFE));
private boolean isIpv6 = false;
private BGridPane contentPane;
private BWbFieldEditor focusedEditor = null;
private Command addCommand;
private Command deleteCommand;
private Command upCommand;
private Command downCommand;
private int maxHosts = 2;
public static final String MAX_HOSTS = "maxHosts";
static /* synthetic */ Class class$com$tridium$platform$ui$tcpip$BIpHostVectorFE;
static /* synthetic */ Class class$javax$baja$sys$BString;
static /* synthetic */ Class class$javax$baja$workbench$fieldeditor$BWbFieldEditor;
public void handleFocusChange(BFocusEvent bFocusEvent) {
this.invoke(handleFocusChange, (BValue)bFocusEvent, null);
}
public Type getType() {
return TYPE;
}
public BIpHostVectorFE() {
this(false);
}
public BIpHostVectorFE(boolean bl) {
this.isIpv6 = bl;
BFlowPane bFlowPane = new BFlowPane(BHalign.center);
BToolBar bToolBar = new BToolBar();
bFlowPane.add(null, (BValue)bToolBar, null);
this.addCommand = new AddCommand();
BButton bButton = new BButton(this.addCommand);
bToolBar.add("add", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
this.deleteCommand = new DeleteCommand();
bButton = new BButton(this.deleteCommand);
bToolBar.add("delete", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
this.upCommand = new UpCommand();
bButton = new BButton(this.upCommand);
bToolBar.add("up", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
this.downCommand = new DownCommand();
bButton = new BButton(this.downCommand);
bToolBar.add("down", (BValue)bButton, null);
bButton.setButtonStyle(BButtonStyle.toolBar);
BGridPane bGridPane = new BGridPane(1);
this.contentPane = new BGridPane(1);
bGridPane.add(null, (BValue)this.contentPane);
bGridPane.add(null, (BValue)bFlowPane);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.center);
this.setContent((BWidget)bGridPane);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
try {
this.maxHosts = context == null ? 2 : context.getFacets().geti(MAX_HOSTS, 2);
BVector bVector = (BVector)bObject;
this.contentPane.removeAll();
SlotCursor slotCursor = bVector.loadSlots().getProperties();
while (slotCursor.next(class$javax$baja$sys$BString == null ? BIpHostVectorFE.class$("javax.baja.sys.BString") : class$javax$baja$sys$BString)) {
this.addElement((BValue)((BString)slotCursor.get()));
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BVector bVector = (BVector)bObject;
bVector.removeAll();
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
for (int i = 0; i < bWidgetArray.length; ++i) {
BString bString = (BString)((BWbFieldEditor)bWidgetArray[i]).saveValue(context);
if (bString.toString().trim().length() == 0) {
throw new LocalizableRuntimeException("platform", "IpHostVectorFE.emptyDnsHost");
}
String string = SlotPath.escape((String)bString.toString());
if (bVector.getProperty(string) != null) {
throw new LocalizableRuntimeException("platform", "IpHostVectorFE.duplicate", new Object[]{bString});
}
bVector.add(string, (BValue)bString, 1, (Context)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"platform:IpHostFE")));
}
return bVector;
}
public void setEnabled(boolean bl) {
super.setEnabled(bl);
this.deleteCommand.setEnabled(bl && this.focusedEditor != null);
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
this.addCommand.setEnabled(bl && bWidgetArray.length < this.maxHosts);
for (int i = 0; i < bWidgetArray.length; ++i) {
bWidgetArray[i].setEnabled(bl);
}
}
protected void doSetReadonly(boolean bl) {
this.setEnabled(!bl);
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
for (int i = 0; i < bWidgetArray.length; ++i) {
((BWbFieldEditor)bWidgetArray[i]).setReadonly(bl);
}
}
public void addElements(BValue[] bValueArray) {
for (int i = 0; i < bValueArray.length; ++i) {
this.addElement(bValueArray[i]);
}
}
public void addElement(BValue bValue) {
BIpHostFE bIpHostFE = new BIpHostFE(this.isIpv6);
bIpHostFE.loadValue((BObject)bValue);
this.contentPane.add(null, (BValue)bIpHostFE, 0);
bIpHostFE.setEnabled(this.isEnabled());
this.getContent().relayout();
this.getContent().computePreferredSize();
this.linkTo(null, (BComponent)bIpHostFE, (Slot)BWbFieldEditor.focusEvent, (Slot)handleFocusChange);
this.linkTo(null, (BComponent)bIpHostFE, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
this.setModified();
this.setEnabled(this.isEnabled());
}
public void doHandleFocusChange(BFocusEvent bFocusEvent) {
try {
if (!this.isEnabled()) {
return;
}
if (bFocusEvent.getId() == 1005) {
if (this.focusedEditor == bFocusEvent.getWidget()) {
this.focusedEditor = null;
}
} else if (bFocusEvent.getId() == 1004) {
this.focusedEditor = (BWbFieldEditor)bFocusEvent.getWidget();
}
this.setArrowCommandEnabledStates();
this.deleteCommand.setEnabled(this.focusedEditor != null);
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public static Property[] getDynamicPropertiesArray(BObject bObject, boolean bl) {
if (bl) {
bObject.asComplex().loadSlots();
}
Property[] propertyArray = bObject.asComplex().getPropertiesArray();
for (int i = 0; i < propertyArray.length; ++i) {
if (propertyArray[i].isFrozen()) continue;
Property[] propertyArray2 = new Property[propertyArray.length - i];
System.arraycopy(propertyArray, i, propertyArray2, 0, propertyArray2.length);
return propertyArray2;
}
return new Property[0];
}
private void setArrowCommandEnabledStates() {
BWidget[] bWidgetArray = this.contentPane.getChildWidgets();
if (bWidgetArray.length > 1 && this.focusedEditor != null) {
this.upCommand.setEnabled(bWidgetArray[0] != this.focusedEditor);
this.downCommand.setEnabled(bWidgetArray[bWidgetArray.length - 1] != this.focusedEditor);
} else {
this.upCommand.setEnabled(false);
this.downCommand.setEnabled(false);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private class DownCommand
extends Command {
public DownCommand() {
super((BWidget)BIpHostVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"arrowDown.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
try {
Property[] propertyArray = BIpHostVectorFE.getDynamicPropertiesArray((BObject)BIpHostVectorFE.this.contentPane, true);
for (int i = 0; i < propertyArray.length; ++i) {
if (BIpHostVectorFE.this.focusedEditor != BIpHostVectorFE.this.contentPane.get(propertyArray[i])) continue;
Property property = propertyArray[i];
propertyArray[i] = propertyArray[i + 1];
propertyArray[i + 1] = property;
BIpHostVectorFE.this.contentPane.reorder(propertyArray);
BIpHostVectorFE.this.setModified();
BIpHostVectorFE.this.setArrowCommandEnabledStates();
return null;
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
}
private class UpCommand
extends Command {
public UpCommand() {
super((BWidget)BIpHostVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"arrowUp.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
try {
Property[] propertyArray = BIpHostVectorFE.getDynamicPropertiesArray((BObject)BIpHostVectorFE.this.contentPane, true);
for (int i = 0; i < propertyArray.length; ++i) {
if (BIpHostVectorFE.this.focusedEditor != BIpHostVectorFE.this.contentPane.get(propertyArray[i])) continue;
Property property = propertyArray[i];
propertyArray[i] = propertyArray[i - 1];
propertyArray[i - 1] = property;
BIpHostVectorFE.this.contentPane.reorder(propertyArray);
BIpHostVectorFE.this.setModified();
BIpHostVectorFE.this.setArrowCommandEnabledStates();
return null;
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
}
private class AddCommand
extends Command {
public AddCommand() {
super((BWidget)BIpHostVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"add.png")), null, "");
}
public CommandArtifact doInvoke() {
BIpHostVectorFE.this.addElement((BValue)BString.DEFAULT);
BIpHostVectorFE.this.setArrowCommandEnabledStates();
this.setEnabled(BIpHostVectorFE.this.contentPane.getChildWidgets().length < BIpHostVectorFE.this.maxHosts);
return null;
}
}
private class DeleteCommand
extends Command {
public DeleteCommand() {
super((BWidget)BIpHostVectorFE.this, "", BImage.make((BIcon)BIcon.std((String)"delete.png")), null, "");
this.setEnabled(false);
}
public CommandArtifact doInvoke() {
if (BIpHostVectorFE.this.focusedEditor == null) {
return null;
}
try {
SlotCursor slotCursor = BIpHostVectorFE.this.contentPane.loadSlots().getProperties();
while (slotCursor.next(class$javax$baja$workbench$fieldeditor$BWbFieldEditor == null ? BIpHostVectorFE.class$("javax.baja.workbench.fieldeditor.BWbFieldEditor") : class$javax$baja$workbench$fieldeditor$BWbFieldEditor)) {
if (slotCursor.get() != BIpHostVectorFE.this.focusedEditor) continue;
BIpHostVectorFE.this.contentPane.remove(slotCursor.property());
BIpHostVectorFE.this.focusedEditor = null;
BIpHostVectorFE.this.deleteCommand.setEnabled(false);
BIpHostVectorFE.this.addCommand.setEnabled(true);
BIpHostVectorFE.this.setModified();
BIpHostVectorFE.this.setArrowCommandEnabledStates();
BIpHostVectorFE.this.relayout();
return null;
}
}
catch (Throwable throwable) {
CommandUtil.error(this, throwable);
}
return null;
}
}
}
@@ -0,0 +1,574 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.IPAddressUtil
* com.tridium.ui.theme.Theme
* javax.baja.data.BIDataValue
* javax.baja.gx.BFont
* javax.baja.gx.BImage
* javax.baja.gx.BInsets
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BFacets
* javax.baja.sys.BIcon
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BCheckBox
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.enums.BValign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BTabbedPane
* javax.baja.util.LexiconText
* javax.baja.workbench.CannotSaveException
* javax.baja.workbench.view.BWbView
*/
package com.tridium.platform.ui.tcpip;
import com.tridium.nre.util.IPAddressUtil;
import com.tridium.platform.tcpip.BTcpIpAdapterSettings;
import com.tridium.platform.ui.tcpip.BIpHostFE;
import com.tridium.platform.ui.tcpip.BIpHostVectorFE;
import com.tridium.platform.ui.util.LabelUtil;
import com.tridium.ui.theme.Theme;
import javax.baja.data.BIDataValue;
import javax.baja.gx.BFont;
import javax.baja.gx.BImage;
import javax.baja.gx.BInsets;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIcon;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BBorder;
import javax.baja.ui.BCheckBox;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.enums.BValign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BTabbedPane;
import javax.baja.util.LexiconText;
import javax.baja.workbench.CannotSaveException;
import javax.baja.workbench.view.BWbView;
public final class BTcpIpAdapterEditor
extends BWbView {
public static final Action setEnabledStates = BTcpIpAdapterEditor.newAction((int)0, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$tcpip$BTcpIpAdapterEditor == null ? (class$com$tridium$platform$ui$tcpip$BTcpIpAdapterEditor = BTcpIpAdapterEditor.class$("com.tridium.platform.ui.tcpip.BTcpIpAdapterEditor")) : class$com$tridium$platform$ui$tcpip$BTcpIpAdapterEditor));
private BLabel interfaceIdLabel = null;
private BLabel interfaceDescLabel = null;
private BLabel macAddressLabel = null;
private boolean canDisableAdapter = false;
private boolean canUseDhcp = false;
private BCheckBox dhcpEnabledCheckBox = null;
private BCheckBox adapterEnabledCheckBox = null;
private BTextField domainTextField = null;
private BIpHostFE gatewayFE = null;
private BIpHostVectorFE dnsHostEditor = null;
private BIpHostFE ipAddressFE = null;
private BIpHostFE subnetMaskFE = null;
private BLabel dhcpHostLabel = null;
private BLabel dhcpLeaseGrantedLabel = null;
private BLabel dhcpLeaseExpiresLabel = null;
private boolean isIPv6Readonly = true;
private BLabel ipv6DhcpHostLabel = null;
private BLabel ipv6DhcpLeaseGrantedLabel = null;
private BLabel ipv6DhcpLeaseExpiresLabel = null;
private BLabel ipv6SupportedLabel = null;
private BTextField ipv6SubnetPrefixLengthFE = null;
private boolean canDisableIpv6 = false;
private boolean isIpv6Supported = false;
private boolean isIpv6Enabled = false;
private boolean canUseIpv6Dhcp = false;
private BCheckBox ipv6EnabledCheckBox = null;
private BCheckBox ipv6DhcpEnabledCheckBox = null;
private BIpHostFE ipv6AddressFE = null;
private BIpHostFE ipv6GatewayFE = null;
private BIpHostVectorFE ipv6DnsHostEditor = null;
public static BFont BOLD_TEXT_FONT = Theme.widget().getBoldText();
static /* synthetic */ Class class$com$tridium$platform$ui$tcpip$BTcpIpAdapterEditor;
public void setEnabledStates() {
this.invoke(setEnabledStates, null, null);
}
public Type getType() {
return TYPE;
}
protected final void doLoadValue(BObject bObject, Context context) {
BBorderPane bBorderPane;
BasicContext basicContext;
BTcpIpAdapterSettings bTcpIpAdapterSettings = (BTcpIpAdapterSettings)bObject;
BEdgePane bEdgePane = new BEdgePane();
BGridPane bGridPane = new BGridPane(2);
bGridPane.setColumnAlign(BHalign.left);
bGridPane.setHalign(BHalign.left);
bGridPane.setValign(BValign.top);
bGridPane.setRowAlign(BValign.top);
bGridPane.setColumnGap(10.0);
bGridPane.setRowGap(6.0);
bGridPane.setColorRows(false);
this.canDisableAdapter = bTcpIpAdapterSettings.getCanDisableAdapter();
this.interfaceIdLabel = new BLabel(bTcpIpAdapterSettings.getAdapterId());
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.interfaceId"), (BWidget)this.interfaceIdLabel);
this.interfaceDescLabel = new BLabel(bTcpIpAdapterSettings.getDescription());
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.interfaceDesc"), (BWidget)this.interfaceDescLabel);
this.macAddressLabel = new BLabel(bTcpIpAdapterSettings.getMediaAccessControlAddress());
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.macAddress"), (BWidget)this.macAddressLabel);
this.adapterEnabledCheckBox = new BCheckBox(this.getLexicon().getText("TcpIpAdapterEditor.adapterEnabled.value"));
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.isAdapterEnabled"), (BWidget)this.adapterEnabledCheckBox);
this.adapterEnabledCheckBox.setSelected(bTcpIpAdapterSettings.getIsAdapterEnabled());
this.linkTo(null, (BComponent)this.adapterEnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
this.linkTo(null, (BComponent)this.adapterEnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setEnabledStates);
bEdgePane.setTop((BWidget)bGridPane);
BTabbedPane bTabbedPane = new BTabbedPane();
BGridPane bGridPane2 = new BGridPane(2);
bGridPane2.setHalign(BHalign.left);
bGridPane2.setValign(BValign.top);
bGridPane2.setRowAlign(BValign.top);
bGridPane2.setColumnGap(10.0);
bGridPane2.setRowGap(6.0);
bGridPane2.setColorRows(false);
this.canUseDhcp = bTcpIpAdapterSettings.getCanUseDhcp();
if (this.canUseDhcp) {
this.dhcpEnabledCheckBox = new BCheckBox(this.getLexicon().getText("TcpIpAdapterEditor.isDhcpEnabled.value"));
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.isDhcpEnabled"), (BWidget)this.dhcpEnabledCheckBox);
this.dhcpEnabledCheckBox.setSelected(bTcpIpAdapterSettings.getIsDhcpEnabled());
this.linkTo(null, (BComponent)this.dhcpEnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
this.linkTo(null, (BComponent)this.dhcpEnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setEnabledStates);
} else {
this.dhcpEnabledCheckBox = null;
}
if (bTcpIpAdapterSettings.getUsesAdapterLevelSettings()) {
this.domainTextField = new BTextField(bTcpIpAdapterSettings.getDomain(), 32);
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.domain"), (BWidget)this.domainTextField);
this.linkTo(null, (BComponent)this.domainTextField, (Slot)BTextField.textModified, (Slot)setModified);
} else {
this.domainTextField = null;
}
this.ipAddressFE = new BIpHostFE();
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipAddress"), (BWidget)this.ipAddressFE);
this.ipAddressFE.loadValue((BObject)BString.make((String)bTcpIpAdapterSettings.getIpAddress()), context);
this.linkTo(null, (BComponent)this.ipAddressFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
if (bTcpIpAdapterSettings.getUsesAdapterLevelSettings()) {
this.gatewayFE = new BIpHostFE();
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.gateway"), (BWidget)this.gatewayFE);
this.gatewayFE.loadValue((BObject)BString.make((String)bTcpIpAdapterSettings.getDefaultGateway()), context);
this.linkTo(null, (BComponent)this.gatewayFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
} else {
this.gatewayFE = null;
}
this.subnetMaskFE = new BIpHostFE();
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.subnetMask"), (BWidget)this.subnetMaskFE);
this.subnetMaskFE.loadValue((BObject)BString.make((String)bTcpIpAdapterSettings.getSubnetMask()), context);
this.linkTo(null, (BComponent)this.subnetMaskFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
if (this.canUseDhcp) {
this.dhcpHostLabel = new BLabel(bTcpIpAdapterSettings.getDhcpHost().toString().trim());
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.dhcpHost"), (BWidget)this.dhcpHostLabel);
this.dhcpLeaseGrantedLabel = new BLabel(bTcpIpAdapterSettings.getDhcpLeaseGranted());
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.dhcpLeaseGranted"), (BWidget)this.dhcpLeaseGrantedLabel);
this.dhcpLeaseExpiresLabel = new BLabel(bTcpIpAdapterSettings.getDhcpLeaseExpires());
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.dhcpLeaseExpires"), (BWidget)this.dhcpLeaseExpiresLabel);
} else {
this.dhcpHostLabel = null;
this.dhcpLeaseGrantedLabel = null;
this.dhcpLeaseExpiresLabel = null;
}
if (bTcpIpAdapterSettings.getUsesAdapterLevelSettings()) {
this.dnsHostEditor = new BIpHostVectorFE();
LabelUtil.addLabelWidgetPair(bGridPane2, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.dnsHost"), (BWidget)this.dnsHostEditor);
basicContext = new BasicContext(context, BFacets.make((String)"maxHosts", (BIDataValue)BInteger.make((int)bTcpIpAdapterSettings.getMaxDnsHosts())));
this.dnsHostEditor.loadValue((BObject)bTcpIpAdapterSettings.getDnsHosts(), (Context)basicContext);
this.linkTo(null, (BComponent)this.dnsHostEditor, (Slot)BIpHostVectorFE.pluginModified, (Slot)setModified);
} else {
this.dnsHostEditor = null;
}
bTabbedPane.addPane(new BLabel(BImage.make((BIcon)BIcon.std((String)"connection.png")), LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.IPv4Settings").getText(context), BOLD_TEXT_FONT), (BWidget)new BBorderPane((BWidget)bGridPane2));
basicContext = new BGridPane(2);
basicContext.setHalign(BHalign.left);
basicContext.setValign(BValign.top);
basicContext.setRowAlign(BValign.top);
basicContext.setColumnGap(10.0);
basicContext.setRowGap(6.0);
basicContext.setColorRows(false);
this.isIpv6Supported = bTcpIpAdapterSettings.getIsIpv6Supported();
this.isIpv6Enabled = this.isIpv6Supported && bTcpIpAdapterSettings.getIsIpv6Enabled();
this.canDisableIpv6 = bTcpIpAdapterSettings.getCanDisableIpv6();
this.canUseIpv6Dhcp = bTcpIpAdapterSettings.getCanUseIpv6Dhcp();
bTcpIpAdapterSettings.getHostSettings().lease();
this.isIPv6Readonly = bTcpIpAdapterSettings.getHostSettings().getIsIPv6Readonly();
String string = this.isIpv6Supported ? this.getLexicon().getText("TcpIpAdapterEditor.isIpv6Supported.true") : this.getLexicon().getText("TcpIpAdapterEditor.isIpv6Supported.false");
this.ipv6SupportedLabel = new BLabel(string);
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.isIpv6Supported"), (BWidget)this.ipv6SupportedLabel);
if (this.isIpv6Supported && !this.isIpv6Enabled && this.canDisableIpv6 || this.isIpv6Supported && this.isIpv6Enabled) {
this.ipv6EnabledCheckBox = new BCheckBox(this.getLexicon().getText("TcpIpAdapterEditor.isIpv6Enabled.value"));
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.isIpv6Enabled"), (BWidget)this.ipv6EnabledCheckBox);
this.ipv6EnabledCheckBox.setSelected(this.isIpv6Supported && this.isIpv6Enabled);
this.linkTo(null, (BComponent)this.ipv6EnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
this.linkTo(null, (BComponent)this.ipv6EnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setEnabledStates);
if (this.canUseIpv6Dhcp) {
this.ipv6DhcpEnabledCheckBox = new BCheckBox(this.getLexicon().getText("TcpIpAdapterEditor.isIpv6DhcpEnabled.value"));
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.isIpv6DhcpEnabled"), (BWidget)this.ipv6DhcpEnabledCheckBox);
this.ipv6DhcpEnabledCheckBox.setSelected(bTcpIpAdapterSettings.getIsIpv6DhcpEnabled());
this.linkTo(null, (BComponent)this.ipv6DhcpEnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
this.linkTo(null, (BComponent)this.ipv6DhcpEnabledCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setEnabledStates);
} else {
this.ipv6DhcpEnabledCheckBox = null;
}
} else {
this.ipv6EnabledCheckBox = null;
this.ipv6DhcpEnabledCheckBox = null;
}
if (this.isIpv6Supported && !this.isIpv6Enabled && this.canDisableIpv6 || this.isIpv6Supported && this.isIpv6Enabled) {
this.ipv6AddressFE = new BIpHostFE(true);
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6Address"), (BWidget)this.ipv6AddressFE);
this.ipv6AddressFE.loadValue((BObject)BString.make((String)bTcpIpAdapterSettings.getIpv6Address()), context);
this.linkTo(null, (BComponent)this.ipv6AddressFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
if (bTcpIpAdapterSettings.getUsesAdapterLevelSettings()) {
this.ipv6GatewayFE = new BIpHostFE(true);
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6Gateway"), (BWidget)this.ipv6GatewayFE);
this.ipv6GatewayFE.loadValue((BObject)BString.make((String)bTcpIpAdapterSettings.getIpv6DefaultGateway()), context);
this.linkTo(null, (BComponent)this.ipv6GatewayFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
} else {
this.ipv6GatewayFE = null;
}
this.ipv6SubnetPrefixLengthFE = new BTextField(String.valueOf(bTcpIpAdapterSettings.getIpv6SubnetPrefixLength()), 4);
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6SubnetPrefixLength"), (BWidget)this.ipv6SubnetPrefixLengthFE);
this.linkTo(null, (BComponent)this.ipv6SubnetPrefixLengthFE, (Slot)BTextField.textModified, (Slot)setModified);
} else {
this.ipv6AddressFE = null;
this.ipv6GatewayFE = null;
this.ipv6SubnetPrefixLengthFE = null;
}
if ((this.isIpv6Supported && !this.isIpv6Enabled && this.canDisableIpv6 || this.isIpv6Supported && this.isIpv6Enabled) && this.canUseIpv6Dhcp) {
if (!bTcpIpAdapterSettings.getIpv6DhcpHost().toString().trim().equalsIgnoreCase("n/a")) {
this.ipv6DhcpHostLabel = new BLabel(bTcpIpAdapterSettings.getIpv6DhcpHost().toString().trim());
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6DhcpHost"), (BWidget)this.ipv6DhcpHostLabel);
this.ipv6DhcpLeaseGrantedLabel = new BLabel(bTcpIpAdapterSettings.getIpv6DhcpLeaseGranted());
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6DhcpLeaseGranted"), (BWidget)this.ipv6DhcpLeaseGrantedLabel);
this.ipv6DhcpLeaseExpiresLabel = new BLabel(bTcpIpAdapterSettings.getIpv6DhcpLeaseExpires());
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6DhcpLeaseExpires"), (BWidget)this.ipv6DhcpLeaseExpiresLabel);
}
} else {
this.ipv6DhcpHostLabel = null;
this.ipv6DhcpLeaseGrantedLabel = null;
this.ipv6DhcpLeaseExpiresLabel = null;
}
if (bTcpIpAdapterSettings.getUsesAdapterLevelSettings()) {
if (this.isIpv6Supported && !this.isIpv6Enabled && this.canDisableIpv6 || this.isIpv6Supported && this.isIpv6Enabled) {
this.ipv6DnsHostEditor = new BIpHostVectorFE(true);
LabelUtil.addLabelWidgetPair((BGridPane)basicContext, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6DnsHost"), (BWidget)this.ipv6DnsHostEditor);
if (bTcpIpAdapterSettings.getIsIpv6Enabled()) {
bBorderPane = new BasicContext(context, BFacets.make((String)"maxHosts", (BIDataValue)BInteger.make((int)bTcpIpAdapterSettings.getMaxDnsHosts())));
this.ipv6DnsHostEditor.loadValue((BObject)bTcpIpAdapterSettings.getIpv6DnsHosts(), (Context)bBorderPane);
}
this.linkTo(null, (BComponent)this.ipv6DnsHostEditor, (Slot)BIpHostVectorFE.pluginModified, (Slot)setModified);
} else {
this.ipv6DnsHostEditor = null;
}
} else {
this.ipv6DnsHostEditor = null;
}
bTabbedPane.addPane(new BLabel(BImage.make((BIcon)BIcon.std((String)"connections.png")), LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.IPv6Settings").getText(context), BOLD_TEXT_FONT), (BWidget)new BBorderPane((BWidget)basicContext));
bBorderPane = new BBorderPane((BWidget)bTabbedPane);
bBorderPane.setBorder(BBorder.none);
bBorderPane.setMargin(BInsets.make((double)8.0, (double)0.0, (double)0.0, (double)0.0));
bBorderPane.setPadding(BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0));
bEdgePane.setCenter((BWidget)bBorderPane);
this.doSetReadonly(this.isReadonly() || bTcpIpAdapterSettings.getHostSettings().getIsReadonly());
this.setContent((BWidget)bEdgePane);
}
public BTcpIpAdapterSettings getAdapter() {
return (BTcpIpAdapterSettings)this.getCurrentValue();
}
public boolean isAdapterEnabledSelected() {
return this.adapterEnabledCheckBox.isSelected();
}
public boolean isIpv6EnabledSelected() {
return this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected();
}
public boolean isDhcpEnabledSelected() {
return this.dhcpEnabledCheckBox != null && this.dhcpEnabledCheckBox.isSelected();
}
protected final BObject doSaveValue(BObject bObject, Context context) throws Exception {
if (!this.isModified()) {
return bObject;
}
BTcpIpAdapterSettings bTcpIpAdapterSettings = (BTcpIpAdapterSettings)bObject;
boolean bl = this.adapterEnabledCheckBox.isSelected();
if (this.canDisableAdapter) {
bTcpIpAdapterSettings.setIsAdapterEnabled(this.adapterEnabledCheckBox.isSelected());
}
if (bl) {
String string;
BString bString;
BString bString2 = (BString)this.ipAddressFE.saveValue(context);
BString bString3 = (BString)this.subnetMaskFE.saveValue(context);
if (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) {
if (bString2.toString().trim().length() == 0) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.nullIpAddress");
}
if (bString3.toString().trim().length() == 0) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.nullSubnetMask");
}
if (!IPAddressUtil.isIpv4SubnetMask((String)bString3.getString().trim())) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.invalidSubnetMaskValue");
}
}
if (this.isIpv6Supported && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected()) {
bString = (BString)this.ipv6AddressFE.saveValue(context);
string = this.ipv6SubnetPrefixLengthFE.getText();
if (this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected() || this.ipv6DhcpEnabledCheckBox == null) {
if (bString.toString().trim().length() == 0) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.nullIpv6Address");
}
if (string.trim().length() == 0) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.nullIpv6SubnetPrefixLength");
}
}
}
if (bTcpIpAdapterSettings.getUsesAdapterLevelSettings()) {
bString = (BString)this.gatewayFE.saveValue(context);
if ((this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) && bString.toString().trim().length() == 0) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.nullGateway");
}
bTcpIpAdapterSettings.setDefaultGateway(this.gatewayFE.saveValue(context).toString().trim());
bTcpIpAdapterSettings.setDomain(this.domainTextField.getText().trim());
bTcpIpAdapterSettings.setDnsHosts((BVector)this.dnsHostEditor.saveValue(context));
if (this.isIpv6Supported && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected()) {
string = (BString)this.ipv6GatewayFE.saveValue(context);
if (this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected() || this.ipv6DhcpEnabledCheckBox == null) {
if (string.toString().trim().length() == 0) {
this.saveError(bTcpIpAdapterSettings.getAdapterId(), "TcpIpAdapterEditor.nullIpv6Gateway");
}
bTcpIpAdapterSettings.setIpv6DefaultGateway(this.ipv6GatewayFE.saveValue(context).toString().trim());
bTcpIpAdapterSettings.setIpv6DnsHosts((BVector)this.ipv6DnsHostEditor.saveValue(context));
}
}
}
if (bTcpIpAdapterSettings.getCanUseDhcp()) {
bTcpIpAdapterSettings.setIsDhcpEnabled(this.dhcpEnabledCheckBox.isSelected());
} else {
bTcpIpAdapterSettings.setIsDhcpEnabled(false);
}
if (this.isIpv6Supported && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected()) {
if (bTcpIpAdapterSettings.getCanUseIpv6Dhcp()) {
bTcpIpAdapterSettings.setIsIpv6DhcpEnabled(this.ipv6DhcpEnabledCheckBox.isSelected());
} else {
bTcpIpAdapterSettings.setIsIpv6DhcpEnabled(false);
}
}
if (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) {
bTcpIpAdapterSettings.setIpAddress(this.ipAddressFE.saveValue(context).toString().trim());
bTcpIpAdapterSettings.setSubnetMask(this.subnetMaskFE.saveValue(context).toString().trim());
}
if (this.isIpv6Supported) {
if (bTcpIpAdapterSettings.getCanDisableIpv6()) {
bTcpIpAdapterSettings.setIsIpv6Enabled(this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected());
}
if (this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected() && this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected()) {
bTcpIpAdapterSettings.setIpv6Address(this.ipv6AddressFE.saveValue(context).toString().trim());
try {
bTcpIpAdapterSettings.setIpv6SubnetPrefixLength(Integer.valueOf(this.ipv6SubnetPrefixLengthFE.getText().trim()));
}
catch (Exception exception) {
this.saveError(this.getAdapter().getAdapterId(), "TcpIpAdapterEditor.invalidIpv6SubnetPrefixLength");
}
}
}
}
return bTcpIpAdapterSettings;
}
protected void saveError(String string, String string2) throws CannotSaveException {
BDialog.error((BWidget)this, (String)this.getLexicon().getText("TcpIpAdapterEditor.invalidDataTitle"), (Object)(string + ": " + this.getLexicon().getText(string2)));
CannotSaveException cannotSaveException = new CannotSaveException();
cannotSaveException.setSilent(true);
throw cannotSaveException;
}
protected void doSetReadonly(boolean bl) {
this.adapterEnabledCheckBox.setEnabled(!bl && this.canDisableAdapter);
if (this.isIpv6Supported && this.ipv6EnabledCheckBox != null) {
this.ipv6EnabledCheckBox.setEnabled(!bl && this.canDisableIpv6 && !this.isIPv6Readonly);
}
this.doSetEnabledStates();
}
public final void doSetEnabledStates() {
boolean bl;
if (this.dhcpEnabledCheckBox != null) {
this.dhcpEnabledCheckBox.setEnabled(this.adapterEnabledCheckBox.isSelected() && !this.isReadonly() && this.canUseDhcp);
}
if (this.ipAddressFE != null) {
bl = (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && !this.isReadonly();
this.ipAddressFE.setEnabled(bl);
this.ipAddressFE.setReadonly(!bl);
}
if (this.subnetMaskFE != null) {
bl = (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && !this.isReadonly();
this.subnetMaskFE.setEnabled(bl);
this.subnetMaskFE.setReadonly(!bl);
}
if (this.gatewayFE != null) {
bl = (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && !this.isReadonly();
this.gatewayFE.setEnabled(bl);
this.gatewayFE.setReadonly(!bl);
}
if (this.dnsHostEditor != null) {
bl = (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && !this.isReadonly();
this.dnsHostEditor.setEnabled(bl);
this.dnsHostEditor.setReadonly(!bl);
}
if (this.domainTextField != null) {
bl = (this.dhcpEnabledCheckBox != null && !this.dhcpEnabledCheckBox.isSelected() || this.dhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && !this.isReadonly();
this.domainTextField.setEditable(bl);
this.domainTextField.setEnabled(bl);
}
if (this.isIpv6Supported) {
if (this.ipv6EnabledCheckBox != null) {
bl = this.adapterEnabledCheckBox.isSelected() && !this.isReadonly() && !this.isIPv6Readonly;
this.ipv6EnabledCheckBox.setEnabled(bl);
}
if (this.ipv6DhcpEnabledCheckBox != null) {
bl = this.adapterEnabledCheckBox.isSelected() && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected() && this.canUseIpv6Dhcp && !this.isReadonly() && !this.isIPv6Readonly;
this.ipv6DhcpEnabledCheckBox.setEnabled(bl);
}
if (this.ipv6DnsHostEditor != null) {
bl = (this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected() || this.ipv6DhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected() && !this.isReadonly() && !this.isIPv6Readonly;
this.ipv6DnsHostEditor.setEnabled(bl);
this.ipv6DnsHostEditor.setReadonly(!bl);
}
if (this.ipv6AddressFE != null) {
bl = (this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected() || this.ipv6DhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected() && !this.isReadonly() && !this.isIPv6Readonly;
this.ipv6AddressFE.setEnabled(bl);
this.ipv6AddressFE.setReadonly(!bl);
}
if (this.ipv6SubnetPrefixLengthFE != null) {
bl = (this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected() || this.ipv6DhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected() && !this.isReadonly() && !this.isIPv6Readonly;
this.ipv6SubnetPrefixLengthFE.setEditable(bl);
this.ipv6SubnetPrefixLengthFE.setEnabled(bl);
}
if (this.ipv6GatewayFE != null) {
bl = (this.ipv6DhcpEnabledCheckBox != null && !this.ipv6DhcpEnabledCheckBox.isSelected() || this.ipv6DhcpEnabledCheckBox == null) && this.adapterEnabledCheckBox.isSelected() && this.ipv6EnabledCheckBox != null && this.ipv6EnabledCheckBox.isSelected() && !this.isReadonly() && !this.isIPv6Readonly;
this.ipv6GatewayFE.setEnabled(bl);
this.ipv6GatewayFE.setReadonly(!bl);
}
}
}
public final void processComponentEvent(BComponentEvent bComponentEvent) {
if (bComponentEvent.getSourceComponent() instanceof BTcpIpAdapterSettings) {
BTcpIpAdapterSettings bTcpIpAdapterSettings = (BTcpIpAdapterSettings)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
BValue bValue = bTcpIpAdapterSettings.get(property);
if (property == BTcpIpAdapterSettings.isAdapterEnabled) {
this.adapterEnabledCheckBox.setSelected(((BBoolean)bValue).getBoolean());
this.doSetEnabledStates();
} else if (property == BTcpIpAdapterSettings.isDhcpEnabled) {
this.dhcpEnabledCheckBox.setSelected(((BBoolean)bValue).getBoolean());
this.doSetEnabledStates();
} else if (property == BTcpIpAdapterSettings.adapterId) {
this.interfaceIdLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.description) {
this.interfaceDescLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.mediaAccessControlAddress) {
this.macAddressLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.dhcpHost) {
this.dhcpHostLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.dhcpLeaseGranted) {
this.dhcpLeaseGrantedLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.dhcpLeaseExpires) {
this.dhcpLeaseExpiresLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.domain) {
this.domainTextField.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.ipAddress) {
this.ipAddressFE.loadValue((BObject)((BString)bValue));
} else if (property == BTcpIpAdapterSettings.subnetMask) {
this.subnetMaskFE.loadValue((BObject)((BString)bValue));
} else if (property == BTcpIpAdapterSettings.defaultGateway) {
this.gatewayFE.loadValue((BObject)((BString)bValue));
} else if (property == BTcpIpAdapterSettings.dnsHosts) {
this.dnsHostEditor.loadValue((BObject)((BVector)bValue));
} else if (property == BTcpIpAdapterSettings.isIpv6Supported) {
this.ipv6SupportedLabel.setText(bValue.toString().trim());
this.doSetEnabledStates();
} else if (this.isIpv6Supported) {
if (property == BTcpIpAdapterSettings.isIpv6DhcpEnabled) {
this.ipv6DhcpEnabledCheckBox.setSelected(((BBoolean)bValue).getBoolean());
this.doSetEnabledStates();
} else if (property == BTcpIpAdapterSettings.isIpv6Enabled) {
if (this.ipv6EnabledCheckBox != null) {
this.ipv6EnabledCheckBox.setSelected(((BBoolean)bValue).getBoolean());
this.doSetEnabledStates();
}
} else if (property == BTcpIpAdapterSettings.ipv6DnsHosts) {
this.ipv6DnsHostEditor.loadValue((BObject)((BVector)bValue));
} else if (property == BTcpIpAdapterSettings.ipv6Address) {
this.ipv6AddressFE.loadValue((BObject)((BString)bValue));
} else if (property == BTcpIpAdapterSettings.ipv6SubnetPrefixLength) {
this.ipv6SubnetPrefixLengthFE.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.ipv6DefaultGateway) {
this.ipv6GatewayFE.loadValue((BObject)((BString)bValue));
} else if (property == BTcpIpAdapterSettings.ipv6DhcpHost) {
this.ipv6DhcpHostLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.ipv6DhcpLeaseExpires) {
this.ipv6DhcpLeaseExpiresLabel.setText(bValue.toString().trim());
} else if (property == BTcpIpAdapterSettings.ipv6DhcpLeaseGranted) {
this.ipv6DhcpLeaseGrantedLabel.setText(bValue.toString().trim());
}
}
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,445 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.IPAddressUtil
* javax.baja.data.BIDataValue
* javax.baja.gx.BInsets
* javax.baja.nre.util.Array
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.BasicContext
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Slot
* javax.baja.sys.SlotCursor
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BCheckBox
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BNullWidget
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.enums.BValign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BExpandablePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BTextEditorPane
* javax.baja.ui.text.BTextEditor
* javax.baja.util.LexiconText
* javax.baja.workbench.BWbEditor
* javax.baja.workbench.BWbPlugin
* javax.baja.workbench.CannotSaveException
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui.tcpip;
import com.tridium.nre.util.IPAddressUtil;
import com.tridium.platform.tcpip.BTcpIpAdapterSettings;
import com.tridium.platform.tcpip.BTcpIpHostSettings;
import com.tridium.platform.ui.tcpip.BIpHostFE;
import com.tridium.platform.ui.tcpip.BIpHostVectorFE;
import com.tridium.platform.ui.tcpip.BTcpIpAdapterEditor;
import com.tridium.platform.ui.util.LabelUtil;
import java.util.HashMap;
import javax.baja.data.BIDataValue;
import javax.baja.gx.BInsets;
import javax.baja.nre.util.Array;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BBorder;
import javax.baja.ui.BCheckBox;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BNullWidget;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.enums.BValign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BExpandablePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BTextEditorPane;
import javax.baja.ui.text.BTextEditor;
import javax.baja.util.LexiconText;
import javax.baja.workbench.BWbEditor;
import javax.baja.workbench.BWbPlugin;
import javax.baja.workbench.CannotSaveException;
import javax.baja.workbench.view.BWbComponentView;
public class BTcpIpHostEditor
extends BWbComponentView {
public static final Action handleHostFileContentChanged = BTcpIpHostEditor.newAction((int)4, null);
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$tcpip$BTcpIpHostEditor == null ? (class$com$tridium$platform$ui$tcpip$BTcpIpHostEditor = BTcpIpHostEditor.class$("com.tridium.platform.ui.tcpip.BTcpIpHostEditor")) : class$com$tridium$platform$ui$tcpip$BTcpIpHostEditor));
private BTextEditorPane hostsFilePane = null;
private Array adapterEditors = null;
private boolean hostFileDirty = false;
private BTextField hostNameTextField = null;
private boolean isIPv6Readonly = true;
private BCheckBox niagaraUsesIpv6 = null;
private BTextField domainTextField = null;
private BIpHostFE gatewayFE = null;
private BIpHostVectorFE dnsHostEditor = null;
private BIpHostFE ipv6DefaultGatewayFE = null;
private BIpHostVectorFE ipv6DnsHostEditor = null;
static /* synthetic */ Class class$com$tridium$platform$ui$tcpip$BTcpIpHostEditor;
public void handleHostFileContentChanged() {
this.invoke(handleHostFileContentChanged, null, null);
}
public Type getType() {
return TYPE;
}
public void doHandleHostFileContentChanged() {
this.hostFileDirty = true;
this.setModified();
}
private BWidget left(BWidget bWidget) {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.left);
bGridPane.add(null, (BValue)bWidget);
return bGridPane;
}
protected final void doLoadValue(BObject bObject, Context context) throws Exception {
BTcpIpHostSettings bTcpIpHostSettings = (BTcpIpHostSettings)bObject;
BGridPane bGridPane = new BGridPane(2);
bGridPane.setValign(BValign.top);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setStretchColumn(1);
bGridPane.setColumnGap(10.0);
bGridPane.setRowGap(6.0);
bGridPane.setColorRows(true);
this.hostNameTextField = new BTextField(bTcpIpHostSettings.getHostName(), 32);
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpHostEditor.hostName"), this.left((BWidget)this.hostNameTextField));
this.hostsFilePane = new BTextEditorPane(bTcpIpHostSettings.getHostFileContents(), 20, 80, true);
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpHostEditor.hostFile"), (BWidget)new BExpandablePane((BWidget)new BNullWidget(), (BWidget)this.hostsFilePane));
BTcpIpAdapterSettings bTcpIpAdapterSettings = null;
boolean bl = false;
SlotCursor slotCursor = bTcpIpHostSettings.getAdapters().loadSlots().getProperties();
while (slotCursor.next()) {
bTcpIpAdapterSettings = (BTcpIpAdapterSettings)slotCursor.get();
if (!bTcpIpAdapterSettings.getIsIpv6Supported()) continue;
bl = true;
break;
}
if (bl) {
this.niagaraUsesIpv6 = new BCheckBox(this.getLexicon().getText("TcpIpHostEditor.niagaraUsesIpv6.value"));
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpHostEditor.niagaraUsesIpv6"), this.left((BWidget)this.niagaraUsesIpv6));
this.niagaraUsesIpv6.setSelected(bTcpIpHostSettings.getNiagaraUsesIpv6());
this.isIPv6Readonly = bTcpIpHostSettings.getIsIPv6Readonly();
} else {
this.niagaraUsesIpv6 = null;
this.isIPv6Readonly = true;
}
if (bTcpIpHostSettings.getUsesAdapterLevelSettings()) {
this.domainTextField = null;
this.gatewayFE = null;
this.dnsHostEditor = null;
this.ipv6DnsHostEditor = null;
this.ipv6DefaultGatewayFE = null;
} else {
this.domainTextField = new BTextField(bTcpIpHostSettings.getDomain(), 32);
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.domain"), this.left((BWidget)this.domainTextField));
this.gatewayFE = new BIpHostFE();
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.gateway"), this.left((BWidget)this.gatewayFE));
this.gatewayFE.loadValue((BObject)BString.make((String)bTcpIpHostSettings.getDefaultGateway()), context);
this.dnsHostEditor = new BIpHostVectorFE();
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.dnsHost"), (BWidget)this.dnsHostEditor);
if (bl) {
this.ipv6DefaultGatewayFE = new BIpHostFE(true);
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6Gateway"), this.left((BWidget)this.ipv6DefaultGatewayFE));
this.ipv6DefaultGatewayFE.loadValue((BObject)BString.make((String)bTcpIpHostSettings.getIpv6DefaultGateway()), context);
this.ipv6DnsHostEditor = new BIpHostVectorFE(true);
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpAdapterEditor.ipv6DnsHost"), (BWidget)this.ipv6DnsHostEditor);
} else {
this.ipv6DnsHostEditor = null;
this.ipv6DefaultGatewayFE = null;
}
slotCursor = new BasicContext(context, BFacets.make((String)"maxHosts", (BIDataValue)BInteger.make((int)bTcpIpHostSettings.getMaxDnsHosts())));
this.dnsHostEditor.loadValue((BObject)bTcpIpHostSettings.getDnsHosts(), (Context)slotCursor);
if (bl) {
this.ipv6DnsHostEditor.loadValue((BObject)bTcpIpHostSettings.getIpv6DnsHosts(), (Context)slotCursor);
}
this.linkTo(null, (BComponent)this.domainTextField, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.gatewayFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.dnsHostEditor, (Slot)BIpHostVectorFE.pluginModified, (Slot)setModified);
if (bl) {
this.linkTo(null, (BComponent)this.ipv6DnsHostEditor, (Slot)BIpHostVectorFE.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.ipv6DefaultGatewayFE, (Slot)BIpHostFE.pluginModified, (Slot)setModified);
}
}
slotCursor = new BGridPane(1);
slotCursor.setHalign(BHalign.left);
slotCursor.setColumnAlign(BHalign.fill);
slotCursor.setStretchColumn(0);
LabelUtil.addLabelWidgetPair(bGridPane, LexiconText.make((Type)TYPE, (String)"TcpIpHostEditor.interfaceCategory"), (BWidget)slotCursor);
if (this.getSlot("lk0") != null) {
this.remove("lk0");
}
if (this.getSlot("lk3") != null) {
this.remove("lk3");
}
this.linkTo("lk0", (BComponent)this.hostNameTextField, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo("lk3", (BComponent)this.hostsFilePane.getEditor(), (Slot)BTextEditor.textModified, (Slot)handleHostFileContentChanged);
if (bl) {
this.linkTo(null, (BComponent)this.niagaraUsesIpv6, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
}
this.adapterEditors = new Array();
int n = 0;
BExpandablePane bExpandablePane = null;
SlotCursor slotCursor2 = bTcpIpHostSettings.getAdapters().loadSlots().getProperties();
while (slotCursor2.next()) {
BTcpIpAdapterSettings bTcpIpAdapterSettings2 = (BTcpIpAdapterSettings)slotCursor2.get();
++n;
BTcpIpAdapterEditor bTcpIpAdapterEditor = new BTcpIpAdapterEditor();
bTcpIpAdapterEditor.loadValue((BObject)bTcpIpAdapterSettings2);
this.adapterEditors.add((Object)bTcpIpAdapterEditor);
bTcpIpAdapterEditor.setReadonly(this.isReadonly());
this.linkTo(null, (BComponent)bTcpIpAdapterEditor, (Slot)BWbPlugin.pluginModified, (Slot)setModified);
BExpandablePane bExpandablePane2 = new BExpandablePane((BWidget)new BLabel(this.getLexicon().getText("TcpIpHostEditor.interfacePrefix") + " " + n), (BWidget)new BBorderPane((BWidget)bTcpIpAdapterEditor, BBorder.inset, BInsets.make((double)4.0)));
if (bExpandablePane == null) {
bExpandablePane = bExpandablePane2;
}
slotCursor.add(null, (BValue)bExpandablePane2, null);
}
if (n == 1 && bExpandablePane != null) {
bExpandablePane.setExpanded(true);
}
this.doSetReadonly(this.isReadonly() || bTcpIpHostSettings.getIsReadonly());
this.setContent((BWidget)bGridPane);
}
protected void doSetReadonly(boolean bl) {
if (this.hostNameTextField != null) {
this.hostNameTextField.setEditable(!bl);
this.hostNameTextField.setEnabled(!bl);
}
if (this.hostsFilePane != null) {
this.hostsFilePane.getEditor().setEditable(!bl);
this.hostsFilePane.getEditor().setEnabled(!bl);
}
if (this.domainTextField != null) {
this.domainTextField.setEditable(!bl);
this.domainTextField.setEnabled(!bl);
}
if (this.gatewayFE != null) {
this.gatewayFE.setReadonly(bl);
this.gatewayFE.setEnabled(!bl);
}
if (this.dnsHostEditor != null) {
this.dnsHostEditor.setReadonly(bl);
this.dnsHostEditor.setEnabled(!bl);
}
if (this.niagaraUsesIpv6 != null) {
this.niagaraUsesIpv6.setEnabled(!bl);
}
if (this.ipv6DefaultGatewayFE != null) {
this.ipv6DefaultGatewayFE.setReadonly(bl || this.isIPv6Readonly);
this.ipv6DefaultGatewayFE.setEnabled(!bl && !this.isIPv6Readonly);
}
if (this.ipv6DnsHostEditor != null) {
this.ipv6DnsHostEditor.setReadonly(bl || this.isIPv6Readonly);
this.ipv6DnsHostEditor.setEnabled(!bl && !this.isIPv6Readonly);
}
if (this.adapterEditors != null) {
for (int i = 0; i < this.adapterEditors.size(); ++i) {
BWbEditor bWbEditor = (BWbEditor)this.adapterEditors.get(i);
bWbEditor.setReadonly(bl);
bWbEditor.setEnabled(!bl);
}
}
}
protected final BObject doSaveValue(BObject bObject, Context context) throws Exception {
Object object;
Object object2;
BTcpIpHostSettings bTcpIpHostSettings = (BTcpIpHostSettings)bObject;
int n = 0;
boolean bl = false;
Object object3 = this.adapterEditors.iterator();
while (object3.hasNext()) {
object2 = (BTcpIpAdapterEditor)((Object)object3.next());
if (!object2.isAdapterEnabledSelected()) continue;
++n;
if (!object2.isIpv6EnabledSelected()) continue;
bl = true;
}
if (n == 0) {
this.saveError("TcpIpHostEditor.noEnabledAdapters");
}
object3 = null;
object2 = null;
HashMap<String, Object> hashMap = new HashMap<String, Object>();
String string = null;
Object object4 = this.adapterEditors.iterator();
while (object4.hasNext()) {
object = (BTcpIpAdapterEditor)((Object)object4.next());
object3 = (BTcpIpAdapterSettings)object.saveValue(context);
if (!((BTcpIpAdapterSettings)((Object)object3)).getIsAdapterEnabled()) continue;
try {
string = IPAddressUtil.getIPv4NetworkPrefix((String)((BTcpIpAdapterSettings)((Object)object3)).getIpAddress(), (String)((BTcpIpAdapterSettings)((Object)object3)).getSubnetMask());
}
catch (Exception exception) {
string = null;
}
if (string == null || (object2 = (BTcpIpAdapterSettings)((Object)hashMap.put(string, object3))) == null) continue;
this.saveError("TcpIpHostEditor.duplicateNetworkPrefixes");
}
if (!this.isModified()) {
return bObject;
}
object4 = this.hostNameTextField.getText();
if (((String)object4).length() != 0 && !IPAddressUtil.isHostname((String)object4)) {
this.saveError("TcpIpHostEditor.invalidHostNameSyntax");
}
bTcpIpHostSettings.setHostName((String)object4);
bTcpIpHostSettings.setHostFileContents(this.hostsFilePane.getText());
this.hostFileDirty = false;
if (this.niagaraUsesIpv6 != null) {
bTcpIpHostSettings.setNiagaraUsesIpv6(this.niagaraUsesIpv6.getSelected());
}
if (this.gatewayFE != null) {
bTcpIpHostSettings.setDefaultGateway(this.gatewayFE.saveValue(context).toString().trim());
}
if (this.domainTextField != null) {
bTcpIpHostSettings.setDomain(this.domainTextField.getText());
}
if (this.dnsHostEditor != null) {
bTcpIpHostSettings.setDnsHosts((BVector)this.dnsHostEditor.saveValue(context));
}
if (this.ipv6DefaultGatewayFE != null) {
object = this.ipv6DefaultGatewayFE.saveValue(context).toString().trim();
if (bl) {
bTcpIpHostSettings.setIpv6DefaultGateway((String)object);
} else if (((String)object).length() != 0) {
this.saveError("TcpIpHostEditor.nonEmptyIPv6Gateway");
}
}
if (this.ipv6DnsHostEditor != null) {
object = (BVector)this.ipv6DnsHostEditor.saveValue(context);
if (bl) {
bTcpIpHostSettings.setIpv6DnsHosts((BVector)object);
} else if (object.getSlotCount() != 0) {
this.saveError("TcpIpHostEditor.nonEmptyIPv6DNSHosts");
}
}
return bObject;
}
public boolean isHostFileDirty() {
return this.hostFileDirty;
}
protected void saveError(String string) throws CannotSaveException {
BDialog.error((BWidget)this, (String)this.getLexicon().getText("TcpIpHostEditor.invalidDataTitle"), (Object)this.getLexicon().getText(string));
CannotSaveException cannotSaveException = new CannotSaveException();
cannotSaveException.setSilent(true);
throw cannotSaveException;
}
public final void handleComponentEvent(BComponentEvent bComponentEvent) {
if (bComponentEvent.getSourceComponent() instanceof BTcpIpHostSettings) {
BTcpIpHostSettings bTcpIpHostSettings = (BTcpIpHostSettings)bComponentEvent.getSourceComponent();
Property property = bComponentEvent.getSlot().asProperty();
BValue bValue = bTcpIpHostSettings.get(property);
if (property == BTcpIpHostSettings.niagaraUsesIpv6) {
if (this.niagaraUsesIpv6 != null) {
this.niagaraUsesIpv6.setSelected(((BBoolean)bValue).getBoolean());
}
} else if (property == BTcpIpHostSettings.hostName) {
if (this.hostNameTextField != null) {
this.hostNameTextField.setText(bValue.toString().trim());
}
} else if (property == BTcpIpHostSettings.hostFileContents) {
if (this.hostsFilePane != null) {
this.hostsFilePane.setText(bValue.toString().trim());
}
} else if (!bTcpIpHostSettings.getUsesAdapterLevelSettings()) {
if (property == BTcpIpHostSettings.defaultGateway) {
if (this.gatewayFE != null) {
this.gatewayFE.loadValue((BObject)((BString)bValue));
}
} else if (property == BTcpIpHostSettings.domain) {
if (this.domainTextField != null) {
this.domainTextField.setText(bValue.toString().trim());
}
} else if (property == BTcpIpHostSettings.dnsHosts) {
if (this.dnsHostEditor != null) {
this.dnsHostEditor.loadValue((BObject)((BVector)bValue));
}
} else {
boolean bl = false;
BTcpIpAdapterSettings bTcpIpAdapterSettings = null;
SlotCursor slotCursor = bTcpIpHostSettings.getAdapters().loadSlots().getProperties();
while (slotCursor.next()) {
bTcpIpAdapterSettings = (BTcpIpAdapterSettings)slotCursor.get();
if (!bTcpIpAdapterSettings.getIsIpv6Supported()) continue;
bl = true;
break;
}
if (bl) {
if (property == BTcpIpHostSettings.ipv6DefaultGateway) {
if (this.ipv6DnsHostEditor != null) {
this.ipv6DnsHostEditor.loadValue((BObject)((BVector)bValue));
}
} else if (property == BTcpIpHostSettings.ipv6DnsHosts && this.ipv6DefaultGatewayFE != null) {
this.ipv6DefaultGatewayFE.loadValue((BObject)((BString)bValue));
}
}
}
}
} else if (bComponentEvent.getSourceComponent() instanceof BTcpIpAdapterSettings) {
BTcpIpAdapterSettings bTcpIpAdapterSettings = (BTcpIpAdapterSettings)bComponentEvent.getSourceComponent();
if (this.adapterEditors != null) {
for (int i = 0; i < this.adapterEditors.size(); ++i) {
if (bTcpIpAdapterSettings != ((BTcpIpAdapterEditor)((Object)this.adapterEditors.get(i))).getAdapter()) continue;
((BTcpIpAdapterEditor)((Object)this.adapterEditors.get(i))).processComponentEvent(bComponentEvent);
}
}
} else {
super.handleComponentEvent(bComponentEvent);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -0,0 +1,165 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* com.tridium.workbench.shell.BNiagaraWbWebShell
* javax.baja.gx.BBrush
* javax.baja.gx.BInsets
* javax.baja.naming.BOrd
* javax.baja.sys.BComponent
* javax.baja.sys.BComponentEvent
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BBorder
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BScrollPane
* javax.baja.workbench.BWbShell
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platform.ui.tcpip;
import com.tridium.install.BVersion;
import com.tridium.platform.BPlatformService;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.tcpip.BTcpIpAdapterSettings;
import com.tridium.platform.tcpip.BTcpIpHostSettings;
import com.tridium.platform.tcpip.BTcpIpPlatformService;
import com.tridium.platform.ui.tcpip.BTcpIpHostEditor;
import com.tridium.platform.ui.util.AuditUtil;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.ui.theme.Theme;
import com.tridium.workbench.shell.BNiagaraWbWebShell;
import javax.baja.gx.BBrush;
import javax.baja.gx.BInsets;
import javax.baja.naming.BOrd;
import javax.baja.platform.install.BVersionRelation;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
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.BBorder;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.workbench.BWbShell;
import javax.baja.workbench.view.BWbComponentView;
public class BTcpIpPlatformServicePlugin
extends BWbComponentView {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$tcpip$BTcpIpPlatformServicePlugin == null ? (class$com$tridium$platform$ui$tcpip$BTcpIpPlatformServicePlugin = BTcpIpPlatformServicePlugin.class$("com.tridium.platform.ui.tcpip.BTcpIpPlatformServicePlugin")) : class$com$tridium$platform$ui$tcpip$BTcpIpPlatformServicePlugin));
private AuditUtil.ViewAuditCommand auditCommand;
private BTcpIpHostEditor hostEditor;
private BScrollPane scrollpane;
static /* synthetic */ Class class$com$tridium$platform$ui$tcpip$BTcpIpPlatformServicePlugin;
public Type getType() {
return TYPE;
}
public BTcpIpPlatformServicePlugin() {
this.autoRegisterForComponentEvents = false;
this.hostEditor = new BTcpIpHostEditor();
BBrush bBrush = Theme.scrollPane().getControlBackground();
this.scrollpane = new BScrollPane((BWidget)new BBorderPane((BWidget)this.hostEditor, 10.0, 10.0, 10.0, 10.0));
this.scrollpane.setViewportBackground(bBrush);
this.linkTo(null, (BComponent)this.hostEditor, (Slot)BTcpIpHostEditor.pluginModified, (Slot)setModified);
this.setReadonly(true);
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
Object object;
BTcpIpPlatformService bTcpIpPlatformService = (BTcpIpPlatformService)bObject;
bTcpIpPlatformService.poll();
this.registerForComponentEvents(bTcpIpPlatformService, 2);
bTcpIpPlatformService.getSettings().lease(2);
bTcpIpPlatformService.getSettings().getComponentSpace().sync();
this.hostEditor.loadValue((BObject)bTcpIpPlatformService.getSettings());
BWbShell bWbShell = this.getWbShell();
if (bWbShell != null) {
object = new BButtonPane();
((BButtonPane)((Object)object)).add(bWbShell.getRefreshCommand(), true, true);
((BButtonPane)((Object)object)).add(bWbShell.getSaveCommand(), true, true);
if (!(bWbShell instanceof BNiagaraWbWebShell)) {
this.auditCommand = new AuditUtil.ViewAuditCommand("ipchanges", (BWidget)this);
((BButtonPane)((Object)object)).add(this.auditCommand, true, true);
this.auditCommand.setEnabled(!this.isReadonly() && this.auditCommand.auditFileExists());
}
this.setContent((BWidget)new BEdgePane(null, (BWidget)new BBorderPane((BWidget)object, 5.0, 0.0, 0.0, 0.0), null, null, (BWidget)new BBorderPane((BWidget)this.scrollpane, BBorder.inset, BInsets.DEFAULT)));
} else {
this.setContent((BWidget)new BBorderPane((BWidget)this.scrollpane, BBorder.inset, BInsets.DEFAULT));
}
object = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bTcpIpPlatformService);
((BPlatformService)((Object)object)).poll();
this.setReadonly(((BSystemPlatformService)object).getLocalDaemonAccess() == BDaemonAccessLevel.restricted || bTcpIpPlatformService.getSettings().getIsReadonly());
}
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
BSystemPlatformService bSystemPlatformService;
if (!this.isModified()) {
return bObject;
}
BTcpIpPlatformService bTcpIpPlatformService = (BTcpIpPlatformService)bObject;
if (bTcpIpPlatformService.getSettings().getIsReadonly()) {
return bObject;
}
BTcpIpHostSettings bTcpIpHostSettings = (BTcpIpHostSettings)bTcpIpPlatformService.getSettings().newCopy();
BTcpIpHostSettings bTcpIpHostSettings2 = (BTcpIpHostSettings)this.hostEditor.saveValue(context);
BWbShell bWbShell = this.getWbShell();
if (bWbShell != null && !(bWbShell instanceof BNiagaraWbWebShell)) {
AuditUtil.audit("ipchanges", bTcpIpPlatformService.getHost(), TYPE, (BComponent)bTcpIpHostSettings, (BComponent)bTcpIpHostSettings2);
}
if ((bSystemPlatformService = (BSystemPlatformService)BOrd.make((String)"service:platform:SystemPlatformService").get((BObject)bTcpIpPlatformService)).getLocalDaemonAccess() != BDaemonAccessLevel.restricted) {
bTcpIpPlatformService.savePlatformServiceProperties();
boolean bl = true;
BVersion bVersion = new BVersion(bSystemPlatformService.getNiagaraVersion());
if (bVersion.meetsVersionRequirement(new BVersion("3.4"), BVersionRelation.minimum) && bSystemPlatformService.getOsName().toLowerCase().startsWith("win")) {
bl = false;
}
if (bl && 4 == BDialog.confirm((BWidget)this, (String)this.getLexicon().getText("TcpIpPlatformServicePlugin.reboot.dlgTitle"), (Object)this.getLexicon().getText("TcpIpPlatformServicePlugin.reboot.dlgMessage"), (int)12)) {
bSystemPlatformService.reboot();
}
if (this.auditCommand != null) {
this.auditCommand.setEnabled(!this.isReadonly() && this.auditCommand.auditFileExists());
}
}
return bObject;
}
protected void doSetReadonly(boolean bl) {
this.hostEditor.setReadonly(bl);
if (this.auditCommand != null) {
this.auditCommand.setEnabled(!bl && this.auditCommand.auditFileExists());
}
}
public final void handleComponentEvent(BComponentEvent bComponentEvent) {
if (bComponentEvent.getSourceComponent() instanceof BTcpIpHostSettings || bComponentEvent.getSourceComponent() instanceof BTcpIpAdapterSettings) {
this.hostEditor.handleComponentEvent(bComponentEvent);
} else {
super.handleComponentEvent(bComponentEvent);
}
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}
@@ -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();
}
}