link start!
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user