203 lines
7.7 KiB
Java
203 lines
7.7 KiB
Java
/*
|
|
* 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());
|
|
}
|
|
}
|
|
}
|
|
|