<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import tornadofx.control.Form?>
<?import tornadofx.control.Fieldset?>
<?import tornadofx.control.Field?>

<?import javafx.geometry.Insets?>
<?import org.controlsfx.control.SegmentedButton?>
<?import com.sparrowwallet.drongo.wallet.KeystoreSource?>
<?import org.controlsfx.glyphfont.Glyph?>
<StackPane stylesheets="@keystore.css, @settings.css, @../general.css" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.wallet.KeystoreController">
    <padding>
        <Insets left="25.0" right="25.0" />
    </padding>
    <Form fx:id="keystoreForm" GridPane.columnIndex="0" GridPane.rowIndex="0">
        <Fieldset inputGrow="SOMETIMES" text="">
            <Field text="Type:">
                <Label fx:id="type"/>
                <Pane HBox.hgrow="ALWAYS" />
                <Button text="Import..." onAction="#importKeystore"/>
            </Field>
            <Field text="Label:">
                <TextField fx:id="label" maxWidth="160"/>
            </Field>
            <Field text="Master fingerprint:">
                <TextField fx:id="fingerprint" maxWidth="80"/>
            </Field>
            <Field text="Derivation:">
                <TextField fx:id="derivation" maxWidth="200"/>
            </Field>
            <Field text="xPub:">
                <TextArea fx:id="xpub" wrapText="true" prefRowCount="2" maxHeight="40" />
            </Field>
        </Fieldset>
    </Form>
    <StackPane fx:id="selectSourcePane">
        <SegmentedButton>
            <toggleGroup>
                <ToggleGroup fx:id="keystoreSourceToggleGroup" />
            </toggleGroup>
            <buttons>
                <ToggleButton text="Connected Hardware Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
                    <graphic>
                        <Glyph fontFamily="Font Awesome 5 Brands Regular" fontSize="20" icon="USB" />
                    </graphic>
                    <userData>
                        <KeystoreSource fx:constant="HW_USB"/>
                    </userData>
                </ToggleButton>
                <ToggleButton text="Airgapped Hardware Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
                    <graphic>
                        <Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SD_CARD" />
                    </graphic>
                    <userData>
                        <KeystoreSource fx:constant="HW_AIRGAPPED"/>
                    </userData>
                </ToggleButton>
                <ToggleButton text="New or Imported Software Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
                    <graphic>
                        <Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="LAPTOP" />
                    </graphic>
                    <userData>
                        <KeystoreSource fx:constant="SW_SEED"/>
                    </userData>
                </ToggleButton>
                <ToggleButton text="XPUB / Watch Only Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
                    <graphic>
                        <Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="EYE" />
                    </graphic>
                    <userData>
                        <KeystoreSource fx:constant="SW_WATCH"/>
                    </userData>
                </ToggleButton>
            </buttons>
        </SegmentedButton>
    </StackPane>
</StackPane>
