content: package com.aemtools.integration.sync.settings.gui;
  
  import com.aemtools.integration.sync.settings.*;
  import com.intellij.uiDesigner.core.*;
  import java.awt.*;
  import javax.swing.*;
  import org.aemsync.core.api.model.*;
  import org.jetbrains.annotations.*;
  
  /**
   * @author Dmytro Liakhov
   */
  public class AemToolsConfigurationGUI {
      private JCheckBox enableAEMSyncingFilesCheckBox;
      private JTextField urlTextField;
      private JTextField loginTextField;
      private JPasswordField passwordField;
      private JPanel rootPanel;
  
      public JPanel getRootPanel() {
          return rootPanel;
      }
  
      public AemToolsProjectConfiguration initModel(@NotNull AemToolsProjectConfiguration aemToolsProjectConfiguration) {
          aemToolsProjectConfiguration.setSyncEnabled(this.isEnabled());
          AemCredentials credentials = new AemCredentials(this.getLogin(), this.getPassword());
          AemInstance instance = new AemInstance(
                  "author",
                  this.getUrl(),
                  "default",
                  credentials,
                  AemVersion.Companion.getUnknown()
          );
  
          aemToolsProjectConfiguration.getInstances().set(0, instance);
          return aemToolsProjectConfiguration;
      }
  
      public void setUpForm(@NotNull AemToolsProjectConfiguration aemToolsProjectConfiguration) {
          AemInstance aemInstance = aemToolsProjectConfiguration.getInstances().get(0);
          this.setPassword(aemInstance.getCredentials().getPassword());
          this.setLogin(aemInstance.getCredentials().getLogin());
          this.setUrlInstance(aemInstance.getAddress());
          this.setAEMSyncEnabled(aemToolsProjectConfiguration.isSyncEnabled());
      }
  
      private boolean isEnabled() {
          return enableAEMSyncingFilesCheckBox.isSelected();
      }
  
      private String getLogin() {
          return loginTextField.getText();
      }
  
      private String getPassword() {
          return String.valueOf(passwordField.getPassword());
      }
  
      private String getUrl() {
          return urlTextField.getText();
      }
  
      private void setAEMSyncEnabled(boolean enabled) {
          this.enableAEMSyncingFilesCheckBox.setSelected(enabled);
      }
  
      private void setUrlInstance(String urlInstance) {
          this.urlTextField.setText(urlInstance);
      }
  
      private void setLogin(String login) {
          this.loginTextField.setText(login);
      }
  
      private void setPassword(String password) {
          this.passwordField.setText(password);
      }
  
      {
  // GUI initializer generated by IntelliJ IDEA GUI Designer
  // >>> IMPORTANT!! <<<
  // DO NOT EDIT OR ADD ANY CODE HERE!
          $$$setupUI$$$();
      }
  
      /**
       * Method generated by IntelliJ IDEA GUI Designer
       * >>> IMPORTANT!! <<<
       * DO NOT edit this method OR call it in your code!
       *
       * @noinspection ALL
       */
      private void $$$setupUI$$$() {
          rootPanel = new JPanel();
          rootPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
          enableAEMSyncingFilesCheckBox = new JCheckBox();
          enableAEMSyncingFilesCheckBox.setText("Enable AEM syncing files");
          rootPanel.add(enableAEMSyncingFilesCheckBox, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
          final JPanel panel1 = new JPanel();
          panel1.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
          rootPanel.add(panel1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
          panel1.setBorder(BorderFactory.createTitledBorder("Configurations"));
          final JLabel label1 = new JLabel();
          label1.setText("URL Instance");
          panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
          final Spacer spacer1 = new Spacer();
          panel1.add(spacer1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
          urlTextField = new JTextField();
          urlTextField.setText("");
          panel1.add(urlTextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
          final JLabel label2 = new JLabel();
          label2.setText("Login");
          panel1.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
          loginTextField = new JTextField();
          loginTextField.setText("");
          panel1.add(loginTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
          final JLabel label3 = new JLabel();
          label3.setText("Password");
          panel1.add(label3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
          passwordField = new JPasswordField();
          passwordField.setText("");
          panel1.add(passwordField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
      }
  
      /**
       * @noinspection ALL
       */
      public JComponent $$$getRootComponent$$$() {
          return rootPanel;
      }
  
  }
  