Skip to content

Commit 9fc6597

Browse files
committed
add progress indicator to create-account
1 parent 54335d6 commit 9fc6597

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

wallet/src/main/resources/ui/workspace/create_account.fxml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@
1414
<children>
1515
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" styleClass="workspace-background-dark">
1616
<children>
17-
<HBox alignment="CENTER_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="60.0" prefWidth="200.0" styleClass="workspace-title-bar">
17+
<StackPane>
1818
<children>
19-
<ImageView fitHeight="36.0" fitWidth="36.0" pickOnBounds="true" preserveRatio="true">
20-
<image>
21-
<Image url="@../image/create_account_logo.png" />
22-
</image>
23-
<HBox.margin>
24-
<Insets left="24.0" right="10.0" />
25-
</HBox.margin>
26-
</ImageView>
27-
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" styleClass="workspace-title-text" text="Create Account" />
19+
<HBox alignment="CENTER_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="60.0" prefWidth="200.0" styleClass="workspace-title-bar">
20+
<children>
21+
<ImageView fitHeight="36.0" fitWidth="36.0" pickOnBounds="true" preserveRatio="true">
22+
<image>
23+
<Image url="@../image/create_account_logo.png" />
24+
</image>
25+
<HBox.margin>
26+
<Insets left="24.0" right="10.0" />
27+
</HBox.margin>
28+
</ImageView>
29+
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" styleClass="workspace-title-text" text="Create Account" />
30+
</children>
31+
</HBox>
32+
<ProgressIndicator fx:id="cWorkingIndicator" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="24.0" prefWidth="24.0" visible="false" />
2833
</children>
29-
</HBox>
34+
</StackPane>
3035
<HBox fx:id="cCanvasParent" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" onMouseDragged="#mouseDragged" onMousePressed="#mousePressed" onMouseReleased="#mouseReleased" prefHeight="400.0" prefWidth="804.0" styleClass="create_account_mouse_track_pad">
3136
<VBox.margin>
3237
<Insets left="10.0" right="10.0" top="10.0" />

wallet/src/main/scala/fssi/wallet/controller/workspace/CreateAccountController.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import fssi.base._
1616
import fssi.types.base.RandomSeed
1717
import fssi.types.biz.Account
1818
import fssi.wallet.{MainFrameFragment, Program, WorkingThreadPool}
19-
import javafx.scene.control.{Label, TextArea, TextField}
19+
import javafx.scene.control.{Label, ProgressIndicator, TextArea, TextField}
2020
import scalafx.application.Platform
2121
import scalafx.stage.FileChooser
2222
import io.circe._
@@ -44,6 +44,8 @@ class CreateAccountController extends javafx.fxml.Initializable {
4444
var cAccountId: TextField = _
4545
@FXML
4646
var cAccountSec: TextField = _
47+
@FXML
48+
var cWorkingIndicator: ProgressIndicator = _
4749

4850
var gc: GraphicsContext = _
4951
val currentAccount: Var[Account] = Var.empty
@@ -69,6 +71,8 @@ class CreateAccountController extends javafx.fxml.Initializable {
6971
//cSavePath.textProperty() <==> savePathProperty
7072

7173
MainFrameFragment.mainTitle.value = "Create Account"
74+
75+
cWorkingIndicator.visibleProperty().value = false
7276
}
7377

7478
@FXML
@@ -153,6 +157,7 @@ class CreateAccountController extends javafx.fxml.Initializable {
153157
alert.showAndWait()
154158
()
155159
} else {
160+
cWorkingIndicator.visibleProperty().value = true
156161
WorkingThreadPool.delay {
157162
createAccount() match {
158163
case Left(t) =>
@@ -163,6 +168,7 @@ class CreateAccountController extends javafx.fxml.Initializable {
163168
contentText = t.getStackTrace.mkString("\n\t")
164169
}
165170
alert.showAndWait()
171+
cWorkingIndicator.visibleProperty().value = false
166172
}
167173

168174
case Right((account, sk)) =>
@@ -174,6 +180,8 @@ class CreateAccountController extends javafx.fxml.Initializable {
174180
cAccountPrv.textProperty().value = account.encPrivKey.asBytesValue.bcBase58
175181
cAccountPub.textProperty().value = account.pubKey.asBytesValue.bcBase58
176182
cAccountSec.textProperty().value = sk.asBytesValue.bcBase58
183+
184+
cWorkingIndicator.visibleProperty().value = false
177185
}
178186
}
179187
}

0 commit comments

Comments
 (0)