ui

## Class FrameDialogController

- java.lang.Object
- - ui.FrameDialogController

- All Implemented Interfaces:
    javafx.fxml.Initializable

      public class FrameDialogController
      extends java.lang.Object
      implements javafx.fxml.Initializable

  Layer 2 controller
  Author:
    David Hudec (dwdization@gmail.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private javafx.scene.control.Button` | `btnOK`
    `private javafx.scene.control.CheckBox` | `chbAnyAppError`
    `private javafx.scene.control.CheckBox` | `chbAppBusy`
    `private javafx.scene.control.CheckBox` | `chbNoError`
    `private javafx.scene.control.CheckBox` | `chbPermanentError`
    `private javafx.scene.control.CheckBox` | `chbPowerLow`
    `private javafx.scene.control.CheckBox` | `chbStatusBitManSpecific5`
    `private javafx.scene.control.CheckBox` | `chbStatusBitManSpecific6`
    `private javafx.scene.control.CheckBox` | `chbStatusBitManSpecific7`
    `private javafx.scene.control.CheckBox` | `chbTempError`
    `private javafx.scene.control.ComboBox<CCode>` | `cmbCCode`
    `private javafx.scene.control.ComboBox<CICode>` | `cmbCICode`
    `private javafx.scene.control.ComboBox<DeviceType>` | `cmbDeviceType`
    `private javafx.scene.control.ComboBox<DataHeaderType>` | `cmbDHType`
    `private javafx.scene.control.ComboBox<EncryptionMethod>` | `cmbEncryption`
    `private javafx.scene.control.ComboBox<Mode>` | `cmbMode`
    `private boolean` | `confirmed`
    `private javafx.collections.ObservableList<DataRecord>` | `dataRecords`
    `private DataRecordDialogController` | `drdc`
    `private Frame` | `frame`
    `private javafx.scene.control.Label` | `lblOutput`
    `private javafx.scene.control.Label` | `lblSignature`
    `private javafx.scene.control.Label` | `lblStatusBits`
    `private javafx.scene.control.Label` | `lblVerification`
    `private static java.util.logging.Logger` | `LOG`
    `private javafx.scene.control.ListView<DataRecord>` | `lstDataRecords`
    `private javafx.event.EventHandler<javafx.stage.WindowEvent>` | `onDataRecordDialogClose` Custom EventHandler to take care of Layer 3 windows.
    `private java.util.Map<StatusCode,javafx.scene.control.CheckBox>` | `statusChbs`
    `private javafx.scene.control.TextField` | `txtAccessNumber`
    `private javafx.scene.control.TextField` | `txtDeviceSN`
    `private javafx.scene.control.TextField` | `txtEncryptionIV`
    `private javafx.scene.control.TextField` | `txtEncryptionKey`
    `private javafx.scene.control.TextField` | `txtManufacturerID`
    `private javafx.scene.control.TextField` | `txtSignature`
    `private javafx.scene.control.TextField` | `txtVersion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FrameDialogController()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private void` | `btnAddDRClicked()` New Layer 3 window is opened and set to default by passing an empty datarecord.
    `private void` | `btnCancelClicked()`
    `private void` | `btnEditDRClicked()` If one and just one datarecord is selected, a Layer 3 window, set by the selected datarecord, is opened.
    `private void` | `btnGenerateClicked()` Completes frame, generates the full available byte sequence and puts it to the output box.
    `private void` | `btnOKClicked()`
    `private void` | `btnRemoveDRClicked()` Raises a confirmation dialog to remove selected datarecords.
    `private void` | `cbEncryptionChanged()` Updates controls to match selected encryption type.
    `private void` | `closeStage()`
    `private void` | `comboBoxCICodeChanged()` Sets the Header drop down menu to match the CI one.
    `private void` | `comboBoxDataHeaderTypeChanged()` Sets the CI-code drop down menu to match the Header type one.
    `Frame` | `getFrame()`
    `void` | `initialize(java.net.URL location, java.util.ResourceBundle resources)`
    `private void` | `openNewDataRecordDialog(DataRecord dataRecord)` Opens a new Layer 3 window and sets the GUI controls by given datarecord.
    `private void` | `refreshDataRecords()`
    `private void` | `saveFrameParameters()` Takes inputs from the GUI and stores them in the underlying frame object.
    `void` | `setByFrame(Frame frame)` Sets this window controls by given Frame
    `private void` | `statusCheckBoxesChanged(javafx.event.ActionEvent event)` Sets the Status bits text by the status byte checkboxes.
    `private void` | `updateEncryptionControls()` Enables/disables encryption key and encryption IV controls based on selected encryption type.
    `private void` | `updateSignature()` Updates the signature byte output based on selected encryption method.
    `private void` | `updateStatusBits()` Sets the status byte bits to match the bit sequence from the status bits text output.
    `private void` | `updateVerification()` Updates the verification byte output based on selected encryption method.
    `boolean` | `wasConfirmed()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### btnOK

          private javafx.scene.control.Button btnOK

    - #### chbAnyAppError

          private javafx.scene.control.CheckBox chbAnyAppError

    - #### chbAppBusy

          private javafx.scene.control.CheckBox chbAppBusy

    - #### chbNoError

          private javafx.scene.control.CheckBox chbNoError

    - #### chbPermanentError

          private javafx.scene.control.CheckBox chbPermanentError

    - #### chbPowerLow

          private javafx.scene.control.CheckBox chbPowerLow

    - #### chbStatusBitManSpecific5

          private javafx.scene.control.CheckBox chbStatusBitManSpecific5

    - #### chbStatusBitManSpecific6

          private javafx.scene.control.CheckBox chbStatusBitManSpecific6

    - #### chbStatusBitManSpecific7

          private javafx.scene.control.CheckBox chbStatusBitManSpecific7

    - #### chbTempError

          private javafx.scene.control.CheckBox chbTempError

    - #### cmbCCode

          private javafx.scene.control.ComboBox<CCode> cmbCCode

    - #### cmbCICode

          private javafx.scene.control.ComboBox<CICode> cmbCICode

    - #### cmbDeviceType

          private javafx.scene.control.ComboBox<DeviceType> cmbDeviceType

    - #### cmbDHType

          private javafx.scene.control.ComboBox<DataHeaderType> cmbDHType

    - #### cmbEncryption

          private javafx.scene.control.ComboBox<EncryptionMethod> cmbEncryption

    - #### cmbMode

          private javafx.scene.control.ComboBox<Mode> cmbMode

    - #### confirmed

          private boolean confirmed

    - #### dataRecords

          private javafx.collections.ObservableList<DataRecord> dataRecords

    - #### drdc

          private DataRecordDialogController drdc

    - #### frame

          private Frame frame

    - #### lblOutput

          private javafx.scene.control.Label lblOutput

    - #### lblSignature

          private javafx.scene.control.Label lblSignature

    - #### lblStatusBits

          private javafx.scene.control.Label lblStatusBits

    - #### lblVerification

          private javafx.scene.control.Label lblVerification

    - #### LOG

          private static final java.util.logging.Logger LOG

    - #### lstDataRecords

          private javafx.scene.control.ListView<DataRecord> lstDataRecords

    - #### onDataRecordDialogClose

          private javafx.event.EventHandler<javafx.stage.WindowEvent> onDataRecordDialogClose

      Custom EventHandler to take care of Layer 3 windows. If a Layer 3 window was confirmed (OK), the defined datarecord is stored and this window updated.

    - #### statusChbs

          private final java.util.Map<StatusCode,javafx.scene.control.CheckBox> statusChbs

    - #### txtAccessNumber

          private javafx.scene.control.TextField txtAccessNumber

    - #### txtDeviceSN

          private javafx.scene.control.TextField txtDeviceSN

    - #### txtEncryptionIV

          private javafx.scene.control.TextField txtEncryptionIV

    - #### txtEncryptionKey

          private javafx.scene.control.TextField txtEncryptionKey

    - #### txtManufacturerID

          private javafx.scene.control.TextField txtManufacturerID

    - #### txtSignature

          private javafx.scene.control.TextField txtSignature

    - #### txtVersion

          private javafx.scene.control.TextField txtVersion

  - ### Constructor Detail

    - #### FrameDialogController

          public FrameDialogController()

  - ### Method Detail

    - #### btnAddDRClicked

          private void btnAddDRClicked()

      New Layer 3 window is opened and set to default by passing an empty datarecord.

    - #### btnCancelClicked

          private void btnCancelClicked()

    - #### btnEditDRClicked

          private void btnEditDRClicked()

      If one and just one datarecord is selected, a Layer 3 window, set by the selected datarecord, is opened. An alert is raised otherwise.

    - #### btnGenerateClicked

          private void btnGenerateClicked()

      Completes frame, generates the full available byte sequence and puts it to the output box.

    - #### btnOKClicked

          private void btnOKClicked()

    - #### btnRemoveDRClicked

          private void btnRemoveDRClicked()

      Raises a confirmation dialog to remove selected datarecords. If confirmed, these are deleted. Raises an alert if none is selected.

    - #### cbEncryptionChanged

          private void cbEncryptionChanged()

      Updates controls to match selected encryption type.

    - #### closeStage

          private void closeStage()

    - #### comboBoxCICodeChanged

          private void comboBoxCICodeChanged()

      Sets the Header drop down menu to match the CI one.

    - #### comboBoxDataHeaderTypeChanged

          private void comboBoxDataHeaderTypeChanged()

      Sets the CI-code drop down menu to match the Header type one.

    - #### getFrame

          public Frame getFrame()

    - #### initialize

          public void initialize(java.net.URL location,
                                 java.util.ResourceBundle resources)

      Specified by:
        `initialize` in interface `javafx.fxml.Initializable`

    - #### openNewDataRecordDialog

          private void openNewDataRecordDialog(DataRecord dataRecord)

      Opens a new Layer 3 window and sets the GUI controls by given datarecord.
      Parameters:
        `dataRecord` - Datarecord to set the window by

    - #### refreshDataRecords

          private void refreshDataRecords()

    - #### saveFrameParameters

          private void saveFrameParameters()

      Takes inputs from the GUI and stores them in the underlying frame object.

    - #### setByFrame

          public void setByFrame(Frame frame)

      Sets this window controls by given Frame
      Parameters:
        `frame` - Frame to adjust the controls by

    - #### statusCheckBoxesChanged

          private void statusCheckBoxesChanged(javafx.event.ActionEvent event)

      Sets the Status bits text by the status byte checkboxes. Resets all others if "No errors" is checked and vice versa.

    - #### updateEncryptionControls

          private void updateEncryptionControls()

      Enables/disables encryption key and encryption IV controls based on selected encryption type.

    - #### updateSignature

          private void updateSignature()

      Updates the signature byte output based on selected encryption method.

    - #### updateStatusBits

          private void updateStatusBits()

      Sets the status byte bits to match the bit sequence from the status bits text output.

    - #### updateVerification

          private void updateVerification()

      Updates the verification byte output based on selected encryption method.

    - #### wasConfirmed

          public boolean wasConfirmed()