214 lines
7.8 KiB
Java
214 lines
7.8 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.gx.BImage
|
|
* javax.baja.security.BPassword
|
|
* javax.baja.sys.Action
|
|
* javax.baja.sys.BComponent
|
|
* javax.baja.sys.BValue
|
|
* javax.baja.sys.Slot
|
|
* javax.baja.sys.Sys
|
|
* javax.baja.sys.Type
|
|
* javax.baja.ui.BButton
|
|
* javax.baja.ui.BDialog
|
|
* javax.baja.ui.BLabel
|
|
* javax.baja.ui.BWidget
|
|
* javax.baja.ui.enums.BHalign
|
|
* javax.baja.ui.event.BWidgetEvent
|
|
* javax.baja.ui.event.BWindowEvent
|
|
* javax.baja.ui.pane.BBorderPane
|
|
* javax.baja.ui.pane.BEdgePane
|
|
* javax.baja.ui.pane.BGridPane
|
|
* javax.baja.ui.util.UiLexicon
|
|
* javax.baja.ui.wizard.BWizardHeader
|
|
* javax.baja.util.Lexicon
|
|
*/
|
|
package com.tridium.platcrypto.ui;
|
|
|
|
import com.tridium.platcrypto.ui.BPasswordField;
|
|
import javax.baja.gx.BImage;
|
|
import javax.baja.security.BPassword;
|
|
import javax.baja.sys.Action;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.Slot;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.ui.BButton;
|
|
import javax.baja.ui.BDialog;
|
|
import javax.baja.ui.BLabel;
|
|
import javax.baja.ui.BWidget;
|
|
import javax.baja.ui.enums.BHalign;
|
|
import javax.baja.ui.event.BWidgetEvent;
|
|
import javax.baja.ui.event.BWindowEvent;
|
|
import javax.baja.ui.pane.BBorderPane;
|
|
import javax.baja.ui.pane.BEdgePane;
|
|
import javax.baja.ui.pane.BGridPane;
|
|
import javax.baja.ui.util.UiLexicon;
|
|
import javax.baja.ui.wizard.BWizardHeader;
|
|
import javax.baja.util.Lexicon;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class BPrivateKeyPasswordDialog
|
|
extends BDialog {
|
|
public static final Action okButtonPressed = BPrivateKeyPasswordDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
|
|
public static final Action cancelButtonPressed = BPrivateKeyPasswordDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
|
|
public static final Action setModified = BPrivateKeyPasswordDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
|
|
public static final Type TYPE;
|
|
private static Lexicon lex;
|
|
private static final BImage logo;
|
|
protected BButton okButton;
|
|
protected BButton cancelButton;
|
|
private BPassword password;
|
|
private BPasswordField passwordField;
|
|
private BPasswordField confirmField;
|
|
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BPrivateKeyPasswordDialog;
|
|
|
|
public void okButtonPressed(BWidgetEvent bWidgetEvent) {
|
|
this.invoke(okButtonPressed, (BValue)bWidgetEvent, null);
|
|
}
|
|
|
|
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
|
|
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
|
|
}
|
|
|
|
public void setModified(BWidgetEvent bWidgetEvent) {
|
|
this.invoke(setModified, (BValue)bWidgetEvent, null);
|
|
}
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public static BPassword open(BWidget bWidget) {
|
|
BPrivateKeyPasswordDialog bPrivateKeyPasswordDialog = new BPrivateKeyPasswordDialog(bWidget);
|
|
bPrivateKeyPasswordDialog.setBoundsCenteredOnOwner();
|
|
bPrivateKeyPasswordDialog.setResizable(false);
|
|
bPrivateKeyPasswordDialog.open();
|
|
return bPrivateKeyPasswordDialog.getPassword();
|
|
}
|
|
|
|
private final BWidget buildDialog() {
|
|
BEdgePane bEdgePane = new BEdgePane();
|
|
bEdgePane.setTop(this.buildHeader());
|
|
bEdgePane.setCenter(this.buildContent());
|
|
return bEdgePane;
|
|
}
|
|
|
|
private final BWidget buildHeader() {
|
|
return new BWizardHeader(logo, this.getTitle(), lex.get("cert.export.privatekey.title"));
|
|
}
|
|
|
|
private final BWidget buildContent() {
|
|
BGridPane bGridPane = new BGridPane(1);
|
|
bGridPane.setHalign(BHalign.center);
|
|
bGridPane.setColumnAlign(BHalign.center);
|
|
bGridPane.add(null, (BValue)new BLabel(lex.get("cert.export.password.prompt"), BHalign.left));
|
|
bGridPane.add(null, (BValue)this.buildBody());
|
|
bGridPane.add(null, (BValue)this.buildButtons());
|
|
return new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 7.0, 7.0);
|
|
}
|
|
|
|
private final BWidget buildBody() {
|
|
BGridPane bGridPane = new BGridPane(2);
|
|
bGridPane.setRowGap((double)5);
|
|
bGridPane.setColumnGap((double)5);
|
|
bGridPane.setColumnAlign(BHalign.left);
|
|
bGridPane.setStretchColumn(1);
|
|
bGridPane.add(null, (BValue)new BLabel(lex.get("password.field.password")));
|
|
this.passwordField = new BPasswordField();
|
|
bGridPane.add(null, (BValue)this.passwordField);
|
|
bGridPane.add(null, (BValue)new BLabel(lex.get("password.field.confirm")));
|
|
this.confirmField = new BPasswordField();
|
|
bGridPane.add(null, (BValue)this.confirmField);
|
|
this.linkTo(null, (BComponent)this.passwordField, (Slot)BPasswordField.textModified, (Slot)setModified);
|
|
this.linkTo(null, (BComponent)this.confirmField, (Slot)BPasswordField.textModified, (Slot)setModified);
|
|
return bGridPane;
|
|
}
|
|
|
|
private final BWidget buildButtons() {
|
|
BGridPane bGridPane = new BGridPane(3);
|
|
bGridPane.setColumnAlign(BHalign.fill);
|
|
bGridPane.setUniformColumnWidth(true);
|
|
this.okButton = new BButton(UiLexicon.bajaui().getText("dialog.ok"));
|
|
bGridPane.add(null, (BValue)this.okButton);
|
|
this.linkTo("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
|
|
this.okButton.setEnabled(false);
|
|
this.cancelButton = new BButton(UiLexicon.bajaui().getText("dialog.cancel"));
|
|
bGridPane.add(null, (BValue)this.cancelButton);
|
|
this.linkTo("linkC", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
|
|
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
|
|
}
|
|
|
|
public void windowClosing(BWindowEvent bWindowEvent) {
|
|
this.close();
|
|
}
|
|
|
|
public BPassword getPassword() {
|
|
return this.password;
|
|
}
|
|
|
|
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) throws Exception {
|
|
this.password = BPassword.make((String)this.confirmField.getText());
|
|
this.close();
|
|
}
|
|
|
|
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
|
|
this.close();
|
|
}
|
|
|
|
public void doSetModified(BWidgetEvent bWidgetEvent) {
|
|
try {
|
|
if (this.passwordField.getText().equals(this.confirmField.getText())) {
|
|
this.okButton.setEnabled(true);
|
|
} else {
|
|
this.okButton.setEnabled(false);
|
|
}
|
|
}
|
|
catch (Exception exception) {
|
|
exception.printStackTrace();
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.password = null;
|
|
this.passwordField = null;
|
|
this.confirmField = null;
|
|
}
|
|
|
|
private BPrivateKeyPasswordDialog(BWidget bWidget) {
|
|
super(bWidget, "Private Key Password", true);
|
|
this.this();
|
|
this.setContent(this.buildDialog());
|
|
this.setDefaultButton(this.okButton);
|
|
this.okButton.setEnabled(true);
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$com$tridium$platcrypto$ui$BPrivateKeyPasswordDialog;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$platcrypto$ui$BPrivateKeyPasswordDialog = BPrivateKeyPasswordDialog.class("[Lcom.tridium.platcrypto.ui.BPrivateKeyPasswordDialog;", false);
|
|
}
|
|
TYPE = Sys.loadType((Class)clazz);
|
|
lex = Lexicon.make((String)"platCrypto");
|
|
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
|
|
}
|
|
}
|
|
|