Examples of JHost


Examples of com.commander4j.sys.JHost

  private void getHostDataFrom()
  {
    int j = jListHostFrom.getSelectedIndex();
    if (j >= 0)
    {
      hstFrom = new JHost();
      hstFrom = (JHost) jListHostFrom.getModel().getElementAt(j);
      hostIDFrom = hstFrom.getSiteNumber();

    } else
    {
View Full Code Here

Examples of com.commander4j.sys.JHost

  private void getHostDataTo()
  {
    int j = jListHostTo.getSelectedIndex();
    if (j >= 0)
    {
      hstTo = new JHost();
      hstTo = (JHost) jListHostTo.getModel().getElementAt(j);
      hostIDTo = hstTo.getSiteNumber();

    } else
    {
View Full Code Here

Examples of com.commander4j.sys.JHost

  private void getHostDataFrom()
  {
    int j = jListHostFrom.getSelectedIndex();
    if (j >= 0)
    {
      hstFrom = new JHost();
      hstFrom = (JHost) jListHostFrom.getModel().getElementAt(j);
      hostIDFrom = hstFrom.getSiteNumber();

    } else
    {
View Full Code Here

Examples of com.commander4j.sys.JHost

  private void getHostDataTo()
  {
    int j = jListHostTo.getSelectedIndex();
    if (j >= 0)
    {
      hstTo = new JHost();
      hstTo = (JHost) jListHostTo.getModel().getElementAt(j);
      hostIDTo = hstTo.getSiteNumber();

    } else
    {
View Full Code Here

Examples of com.commander4j.sys.JHost

  private void getHostData()
  {
    int j = jListHosts.getSelectedIndex();
    if (j >= 0)
    {
      JHost hst = new JHost();
      hst = (JHost) jListHosts.getModel().getElementAt(j);
      jTextFieldDescription.setText(hst.getSiteDescription());
      jTextFieldUniqueID.setText(hst.getUniqueID());
      jTextFieldURL.setText(hst.getSiteURL());
      jTextFieldSiteNo.setText(hst.getSiteNumber());
      jTextFieldDriver.setText(hst.getDatabaseParameters().getjdbcDriver());
      if (hst.getDatabaseParameters().getjdbcDriver().equals(""))
      {
        jComboBoxjdbcDriver.setSelectedIndex(0);
      }

      if (hst.getDatabaseParameters().getjdbcDriver().equals("com.mysql.jdbc.Driver"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(1);
      }
      if (hst.getDatabaseParameters().getjdbcDriver().equals("oracle.jdbc.driver.OracleDriver"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(2);
      }
      if (hst.getDatabaseParameters().getjdbcDriver().equals("com.microsoft.sqlserver.jdbc.SQLServerDriver"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(3);
      }
      if (hst.getDatabaseParameters().getjdbcDriver().equals("http"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(4);
      }

      jTextFieldConnect.setText(hst.getDatabaseParameters().getjdbcConnectString());
      jTextFieldDateTime.setText(hst.getDatabaseParameters().getjdbcDatabaseDateTimeToken());
      jTextFieldSelectLimit.setText(hst.getDatabaseParameters().getjdbcDatabaseSelectLimit());
      jTextFieldSchema.setText(hst.getDatabaseParameters().getjdbcDatabaseSchema());
      jTextFieldUsername.setText(hst.getDatabaseParameters().getjdbcUsername());
      jTextFieldPassword.setText(hst.getDatabaseParameters().getjdbcPassword());
      jTextFieldPort.setText(hst.getDatabaseParameters().getjdbcPort());
      jTextFieldSID.setText(hst.getDatabaseParameters().getjdbcSID());
      jTextFieldServer.setText(hst.getDatabaseParameters().getjdbcServer());
      jTextFieldDatabase.setText(hst.getDatabaseParameters().getjdbcDatabase());
      if (hst.getEnabled().equals("Y"))
        jCheckBoxEnabled.setSelected(true);
      else
        jCheckBoxEnabled.setSelected(false);

      setEditable(true);
View Full Code Here

Examples of com.commander4j.sys.JHost

  }

  private JHost setHostData()
  {
    int j = jListHosts.getSelectedIndex();
    JHost hst = new JHost();
    if (j > -1)
    {

      hst.setSiteDescription(jTextFieldDescription.getText());
      hst.setSiteURL(jTextFieldURL.getText());
      hst.setSiteNumber(jTextFieldSiteNo.getText());
      hst.getDatabaseParameters().setjdbcDriver(jTextFieldDriver.getText());
      hst.getDatabaseParameters().setjdbcDatabaseDateTimeToken(jTextFieldDateTime.getText());
      hst.getDatabaseParameters().setjdbcDatabaseSelectLimit(jTextFieldSelectLimit.getText());
      hst.getDatabaseParameters().setjdbcDatabaseSchema(jTextFieldSchema.getText());
      hst.getDatabaseParameters().setjdbcUsername(jTextFieldUsername.getText());
      hst.getDatabaseParameters().setjdbcPassword(String.valueOf(jTextFieldPassword.getPassword()));

      hst.getDatabaseParameters().setjdbcPort(jTextFieldPort.getText());
      hst.getDatabaseParameters().setjdbcSID(jTextFieldSID.getText());
      hst.getDatabaseParameters().setjdbcServer(jTextFieldServer.getText());
      hst.getDatabaseParameters().setjdbcDatabase(jTextFieldDatabase.getText());
      hst.setUniqueID(jTextFieldUniqueID.getText());
      hst.getSqlstatements().setjdbcDriver(hst.getDatabaseParameters().getjdbcDriver());
      hst.getSqlstatements().setjdbcDriver(hst.getDatabaseParameters().getjdbcDriver());

      if (jCheckBoxEnabled.isSelected())
        hst.setEnabled("Y");
      else
        hst.setEnabled("N");
      hostList.set(j, hst);
      setEditable(false);
      populateList("");
      jButtonApply.setEnabled(false);
      jButtonCancel.setEnabled(false);
View Full Code Here

Examples of com.commander4j.sys.JHost

                  }
                }

              } while (found);

              JHost hst = new JHost();
              hst.setSiteNumber(siteNo);
              hst.setSiteDescription(newdesc);

              hostList.add(hst);
              setSaveButtonState(true);

              populateList(newdesc);
              getHostData();
            }
          });
        }
        {
          jButtonApply = new JButton4j(Common.icon_ok);
          desktopPane.add(jButtonApply);
          jButtonApply.setText("Confirm Changes");
          jButtonApply.setBounds(762, 160, 160, 36);
          jButtonApply.setEnabled(false);
          jButtonApply.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              int j = jListHosts.getSelectedIndex();
              JHost hst = setHostData();

              hostList.set(j, hst);
              setEditable(false);
              populateList("");
              jButtonApply.setEnabled(false);
              jButtonCancel.setEnabled(false);

              setSaveButtonState(true);
              jButtonTest.setEnabled(true);
              jListHosts.setSelectedIndex(j);
            }
          });
        }
        {
          jButtonDelete = new JButton4j(Common.icon_delete);
          desktopPane.add(jButtonDelete);
          jButtonDelete.setText("Delete DB Connection");
          jButtonDelete.setBounds(762, 49, 160, 36);
          jButtonDelete.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jListHosts.getSelectedIndex() > -1)
              {
                int j = jListHosts.getSelectedIndex();
                hostList.remove(j);
                renumberHosts();
                populateList("");
                if (hostList.size() > 0)
                {
                  if (j > (hostList.size() - 1))
                  {
                    j--;
                  }
                  if (j >= 0)
                  {
                    populateList(hostList.get(j).getSiteDescription());
                  }
                }

                getHostData();
                setSaveButtonState(true);
              }
            }
          });
        }
        {
          jButtonUp = new JButton4j(Common.icon_arrow_up);
          desktopPane.add(jButtonUp);
          jButtonUp.setEnabled(false);
          jButtonUp.setBounds(284, 221, 28, 28);
          jButtonUp.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jListHosts.getSelectedIndex() > -1)
              {
                int j = jListHosts.getSelectedIndex();
                JHost element = ((JHost) jListHosts.getModel().getElementAt(j));
                hostList = moveElementUp(hostList, element);
                renumberHosts();
                populateList(element.getSiteDescription());
                setSaveButtonState(true);
              }
            }
          });
        }
        {
          jButtonDown = new JButton4j(Common.icon_arrow_down);
          desktopPane.add(jButtonDown);
          jButtonDown.setEnabled(false);
          jButtonDown.setBounds(284, 256, 28, 28);
          jButtonDown.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jListHosts.getSelectedIndex() > -1)
              {
                int j = jListHosts.getSelectedIndex();
                JHost element = ((JHost) jListHosts.getModel().getElementAt(j));
                hostList = moveElementDown(hostList, element);
                renumberHosts();
                populateList(element.getSiteDescription());
                setSaveButtonState(true);
              }
            }
          });
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          desktopPane.add(jButtonClose);
          jButtonClose.setText("Close");
          jButtonClose.setBounds(762, 382, 160, 36);
          jButtonClose.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              logger.debug("JFrameHostAdmin closed");
              dispose();
            }
          });
        }
        {
          jButtonUndo = new JButton4j(Common.icon_undo);
          desktopPane.add(jButtonUndo);
          jButtonUndo.setText("Undo Changes");
          jButtonUndo.setBounds(762, 271, 160, 36);
          jButtonUndo.setEnabled(false);
          jButtonUndo.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              // Common.hosts = JXMLHost.loadHosts(false);
              int j = jListHosts.getSelectedIndex();
              String Current = hostList.get(j).getSiteDescription();
              getHosts();
              populateList(Current);
              getHostData();
              setSaveButtonState(false);
              setSaveButtonState(false);
            }
          });
        }
        {

          jButtonSave = new JButton4j(Common.icon_update);
          desktopPane.add(jButtonSave);
          jButtonSave.setText("Save DB Connections");
          jButtonSave.setBounds(762, 197, 160, 36);
          jButtonSave.setEnabled(false);
          jButtonSave.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              String pass1 = "";
              String pass2 = "";
              pass1 = String.valueOf(setupPasswordField.getPassword());
              pass2 = String.valueOf(verifyPasswordField.getPassword());

              if (pass1.equals(pass2))
              {

                String splash;
                if (jCheckBoxSplash.isSelected())
                {
                  splash = "Y";
                } else
                {
                  splash = "N";
                }

                JXMLHost.writeHosts(hostList, splash, JTextFieldUpdateURL.getText(), getUpdateMode(), jTextField4jInstallDir.getText(), pass1);
                jButtonSave.setEnabled(false);
                jButtonUndo.setEnabled(false);
              } else
              {
                JOptionPane.showMessageDialog(null,
                      "Setup password has been changed but failed verification - please check.",
                      "Error",
                      JOptionPane.ERROR_MESSAGE);
              }
            }
          });
        }
        {
          jTextFieldDescription = new JTextField4j();
          desktopPane.add(jTextFieldDescription);
          jTextFieldDescription.setFocusCycleRoot(true);
          jTextFieldDescription.setBounds(425, 40, 325, 21);
          jTextFieldDescription.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldURL = new JTextField4j();
          desktopPane.add(jTextFieldURL);
          jTextFieldURL.setFocusCycleRoot(true);
          jTextFieldURL.setBounds(425, 65, 325, 21);
          jTextFieldURL.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelDatabaseType = new JLabel4j_std();
          desktopPane.add(jLabelDatabaseType);
          jLabelDatabaseType.setText("Database Type");
          jLabelDatabaseType.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDatabaseType.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDatabaseType.setBounds(291, 91, 127, 21);

        }
        {

          ComboBoxModel<String> jComboBoxjdbcDriverModel = new DefaultComboBoxModel<String>(new String[] { "", "mySQL", "Oracle", "SQL Server", "Web URL" });
          jComboBoxjdbcDriver = new JComboBox4j<String>();
          desktopPane.add(jComboBoxjdbcDriver);
          jComboBoxjdbcDriver.setModel(jComboBoxjdbcDriverModel);
          jComboBoxjdbcDriver.setBounds(425, 90, 164, 21);
          jComboBoxjdbcDriver.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("Oracle"))
              {
                jTextFieldDriver.setText("oracle.jdbc.driver.OracleDriver");
                jTextFieldConnect.setText("jdbc:oracle:thin:@jdbcServer:jdbcPort:jdbcSID");
                jTextFieldDateTime.setText("sysdate");
                jTextFieldSelectLimit.setText("rownum");
                jTextFieldServer.setText("localhost");
                jTextFieldPort.setText("1521");
              }
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("mySQL"))
              {
                jTextFieldDriver.setText("com.mysql.jdbc.Driver");
                jTextFieldConnect.setText("jdbc:mysql://jdbcServer/jdbcDatabase");
                jTextFieldDateTime.setText("sysdate");
                jTextFieldSelectLimit.setText("limit");
                jTextFieldServer.setText("localhost");
                jTextFieldPort.setText("3306");
              }
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("SQL Server"))
              {
                jTextFieldDriver.setText("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                jTextFieldConnect.setText("jdbc:sqlserver://jdbcServer\\jdbcSID");
                jTextFieldDateTime.setText("sysdate");
                jTextFieldSelectLimit.setText("top");
                jTextFieldServer.setText("localhost");
                jTextFieldPort.setText("1433");
              }
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("Web URL"))
              {
                jTextFieldDriver.setText("http");
                jTextFieldConnect.setText("");
                jTextFieldDateTime.setText("");
                jTextFieldSelectLimit.setText("");
                jTextFieldServer.setText("");
                jTextFieldPort.setText("");
              }
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldConnect = new JTextField4j();
          desktopPane.add(jTextFieldConnect);
          jTextFieldConnect.setFocusCycleRoot(true);
          jTextFieldConnect.setBounds(425, 145, 325, 21);
          jTextFieldConnect.setEditable(false);
          jTextFieldConnect.setEnabled(false);
          jTextFieldConnect.setDisabledTextColor(Common.color_textdisabled);
          jTextFieldConnect.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelDriver = new JLabel4j_std();
          desktopPane.add(jLabelDriver);
          jLabelDriver.setText("Driver");
          jLabelDriver.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDriver.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDriver.setBounds(291, 116, 127, 21);

        }
        {
          jLabelDatabase = new JLabel4j_std();
          desktopPane.add(jLabelDatabase);
          jLabelDatabase.setText("Database");
          jLabelDatabase.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDatabase.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDatabase.setBounds(320, 196, 98, 21);

        }
        {
          jLabelDBDateTime = new JLabel4j_std();
          desktopPane.add(jLabelDBDateTime);
          jLabelDBDateTime.setText("DB Date Time");
          jLabelDBDateTime.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDBDateTime.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDBDateTime.setBounds(291, 321, 127, 21);

        }
        {
          jLabelPassword = new JLabel4j_std();
          desktopPane.add(jLabelPassword);
          jLabelPassword.setText("Password");
          jLabelPassword.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelPassword.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelPassword.setBounds(291, 296, 127, 21);

        }
        {
          jLabelDescription = new JLabel4j_std();
          desktopPane.add(jLabelDescription);
          jLabelDescription.setText("Description");
          jLabelDescription.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDescription.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDescription.setBounds(291, 41, 127, 21);
        }
        {
          jLabelSiteNo = new JLabel4j_std();
          desktopPane.add(jLabelSiteNo);
          jLabelSiteNo.setText("Site No");
          jLabelSiteNo.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSiteNo.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSiteNo.setBounds(291, 15, 127, 21);

        }
        {
          jLabelUsername = new JLabel4j_std();
          desktopPane.add(jLabelUsername);
          jLabelUsername.setText("Username");
          jLabelUsername.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelUsername.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelUsername.setBounds(291, 271, 127, 21);

        }
        {
          jLabelPort = new JLabel4j_std();
          desktopPane.add(jLabelPort);
          jLabelPort.setText("Port");
          jLabelPort.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelPort.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelPort.setBounds(320, 221, 98, 21);

        }
        {
          jTextFieldDateTime = new JTextField4j();
          desktopPane.add(jTextFieldDateTime);
          jTextFieldDateTime.setFocusCycleRoot(true);
          jTextFieldDateTime.setBounds(425, 320, 325, 21);
          jTextFieldDateTime.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldUsername = new JTextField4j();
          desktopPane.add(jTextFieldUsername);
          jTextFieldUsername.setFocusCycleRoot(true);
          jTextFieldUsername.setBounds(425, 270, 325, 21);
          jTextFieldUsername.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldPassword = new JPasswordField(10);
          desktopPane.add(jTextFieldPassword);
          jTextFieldPassword.setFocusCycleRoot(true);
          jTextFieldPassword.setBounds(425, 295, 325, 21);
          jTextFieldPassword.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldPort = new JTextField4j();
          desktopPane.add(jTextFieldPort);
          jTextFieldPort.setFocusCycleRoot(true);
          jTextFieldPort.setBounds(425, 220, 325, 21);
          jTextFieldPort.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldSID = new JTextField4j();
          desktopPane.add(jTextFieldSID);
          jTextFieldSID.setFocusCycleRoot(true);
          jTextFieldSID.setBounds(425, 245, 325, 21);
          jTextFieldSID.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldSiteNo = new JTextField4j();
          desktopPane.add(jTextFieldSiteNo);
          jTextFieldSiteNo.setFocusCycleRoot(true);
          jTextFieldSiteNo.setBounds(425, 14, 28, 21);
          jTextFieldSiteNo.setHorizontalAlignment(SwingConstants.CENTER);
          jTextFieldSiteNo.setEnabled(false);
          jTextFieldSiteNo.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldDriver = new JTextField4j();
          desktopPane.add(jTextFieldDriver);
          jTextFieldDriver.setFocusCycleRoot(true);
          jTextFieldDriver.setBounds(425, 117, 325, 21);
          jTextFieldDriver.setEditable(false);
          jTextFieldDriver.setEnabled(false);
          jTextFieldDriver.setDisabledTextColor(Common.color_textdisabled);
          jTextFieldDriver.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jCheckBoxEnabled = new JCheckBox4j();
          jCheckBoxEnabled.setFont(Common.font_std);
          desktopPane.add(jCheckBoxEnabled);
          jCheckBoxEnabled.setText("Enabled");
          jCheckBoxEnabled.setBounds(467, 14, 91, 21);
          jCheckBoxEnabled.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxEnabled.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jCheckBoxSplash = new JCheckBox4j();
          jCheckBoxSplash.setSelected(true);
          jCheckBoxSplash.setFont(Common.font_std);
          desktopPane.add(jCheckBoxSplash);
          jCheckBoxSplash.setText("Enable Splash Screen");
          jCheckBoxSplash.setBounds(687, 445, 150, 21);
          jCheckBoxSplash.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxSplash.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelSID = new JLabel4j_std();
          desktopPane.add(jLabelSID);
          jLabelSID.setText("SID");
          jLabelSID.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSID.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSID.setBounds(320, 246, 98, 21);
        }
        {
          jButtonCancel = new JButton4j(Common.icon_cancel);
          desktopPane.add(jButtonCancel);
          jButtonCancel.setText("Cancel");
          jButtonCancel.setBounds(762, 345, 160, 36);
          jButtonCancel.setEnabled(false);
          jButtonCancel.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              getHostData();
            }
          });
        }
        {
          jTextFieldServer = new JTextField4j();
          desktopPane.add(jTextFieldServer);
          jTextFieldServer.setFocusCycleRoot(true);
          jTextFieldServer.setBounds(425, 170, 325, 21);
          jTextFieldServer.setEnabled(false);
          jTextFieldServer.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelConnectionString = new JLabel4j_std();
          desktopPane.add(jLabelConnectionString);
          jLabelConnectionString.setText("Connect String");
          jLabelConnectionString.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelConnectionString.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelConnectionString.setBounds(291, 141, 127, 21);
        }
        {
          jTextFieldDatabase = new JTextField4j();
          desktopPane.add(jTextFieldDatabase);
          jTextFieldDatabase.setEnabled(false);
          jTextFieldDatabase.setFocusCycleRoot(true);
          jTextFieldDatabase.setBounds(425, 195, 325, 21);
          jTextFieldDatabase.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelServer = new JLabel4j_std();
          desktopPane.add(jLabelServer);
          jLabelServer.setText("Server");
          jLabelServer.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelServer.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelServer.setBounds(320, 171, 98, 21);
        }
        {
          jButtonTest = new JButton4j(Common.icon_connect);
          desktopPane.add(jButtonTest);
          jButtonTest.setText("Connect to DB");
          jButtonTest.setBounds(762, 86, 160, 36);
          jButtonTest.setToolTipText("Connect to selected Host Database");
          jButtonTest.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {

              writeBackHosts(hostList);

              int j = jListHosts.getSelectedIndex();
              JHost hst = (JHost) jListHosts.getModel().getElementAt(j);
              Common.selectedHostID = hst.getSiteNumber();
              if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID))
              {
                btnSchema.setEnabled(true);
                jButtonUpdate.setEnabled(true);
                Common.hostList.getHost(Common.selectedHostID).disconnect(Common.sessionID);
              } else
              {
                jButtonUpdate.setEnabled(false);
                btnSchema.setEnabled(false);
              }
            }
          });
        }
        {
          jButtonUpdate = new JButton4j(Common.icon_update);
          desktopPane.add(jButtonUpdate);
          jButtonUpdate.setText("Create/Update Tables");
          jButtonUpdate.setBounds(762, 123, 160, 36);
          jButtonUpdate.setEnabled(false);
          jButtonUpdate.setToolTipText("Create or Upgrade Application Database Schema");
          jButtonUpdate.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {

              writeBackHosts(hostList);

              int j = jListHosts.getSelectedIndex();
              JHost hst = (JHost) jListHosts.getModel().getElementAt(j);
              Common.selectedHostID = hst.getSiteNumber();

              if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID))
              {
                JDBSchema schema = new JDBSchema(Common.sessionID, Common.hostList.getHost(Common.selectedHostID));
                JDBUpdateRequest updrst = new JDBUpdateRequest();
                updrst = schema.validate(false);

                if (updrst.schema_updateRequired)
                {
                  int continueUpdate = JOptionPane.showConfirmDialog(me, "Current Schema Version is " + String.valueOf(updrst.schema_currentVersion) + ", required version is " + String.valueOf(updrst.schema_requiredVersion)
                      + ". Upgrade ?", "Connection to (" + hst.getSiteDescription() + ")", JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);

                  if (continueUpdate == 0)
                  {

                    LinkedList<JDBDDL> cmds = new LinkedList<JDBDDL>();
                    cmds.clear();
                    cmds = JXMLSchema.loadDDLStatements(jTextFieldDriver.getText(), "xml/schema/" + Common.hostList.getHost(Common.selectedHostID).getDatabaseParameters().getjdbcDriver() + "/");
                    boolean updateCtrl = false;
                    if (cmds.size() > 0)
                    {
                      if (schema.executeDDL(cmds, progressBar, labelCommand) == true)
                      {
                        updateCtrl = true;

                      } else
                      {
                        JUtility.errorBeep();
                        JDialogDMLErrors dmlerrs = new JDialogDMLErrors(me, cmds);
                        dmlerrs.setModal(true);
                        int ignoreDDLErrors = JOptionPane.showConfirmDialog(me, "Ignore Errors and set SCHEMA version to " + String.valueOf(updrst.schema_requiredVersion) + " ?", "Connection to (" + hst.getSiteDescription()
                            + ")", JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);

                        if (ignoreDDLErrors == 0)
                        {
                          updateCtrl = true;
                        }
                      }
                    } else
                    {
                      JOptionPane.showMessageDialog(me, "No DDL Commands found", "Connection to (" + hst.getSiteDescription() + ")", JOptionPane.WARNING_MESSAGE);

                    }

                    if (updateCtrl)
                    {
                      JDBControl ctrl = new JDBControl(Common.selectedHostID, Common.sessionID);
                      if (ctrl.getProperties("SCHEMA VERSION"))
                      {
                        ctrl.setKeyValue(String.valueOf(updrst.schema_requiredVersion));
                        ctrl.update();
                      } else
                      {
                        ctrl.create("SCHEMA VERSION", String.valueOf(updrst.schema_requiredVersion), "Schema Version");
                      }
                      JOptionPane.showMessageDialog(me, "Schema Version now set to " + String.valueOf(JVersion.getSchemaVersion()), "Control Table", JOptionPane.INFORMATION_MESSAGE);

                    }

                  }
                } else
                {
                  JOptionPane.showMessageDialog(me, "No Schema update Required", "Connection to (" + hst.getSiteDescription() + ")", JOptionPane.INFORMATION_MESSAGE);
                }

                if (updrst.program_updateRequired)
                {
                  JDBControl ctrl = new JDBControl(Common.selectedHostID, Common.sessionID);

                  if (ctrl.getProperties("PROGRAM VERSION"))
                  {
                    ctrl.setKeyValue(JVersion.getProgramVersion());
                    ctrl.update();
                  } else
                  {
                    ctrl.create("PROGRAM VERSION", JVersion.getProgramVersion(), "Program Version");
                  }
                  JOptionPane.showMessageDialog(me, "Program Version now set to " + JVersion.getProgramVersion(), "Control Table", JOptionPane.INFORMATION_MESSAGE);

                }
                Common.hostList.getHost(Common.selectedHostID).disconnect(Common.sessionID);
              }
            }
          });
        }
        {
          jTextFieldSelectLimit = new JTextField4j();
          desktopPane.add(jTextFieldSelectLimit);
          jTextFieldSelectLimit.setBounds(425, 345, 325, 21);
          jTextFieldSelectLimit.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
          jTextFieldSelectLimit.setFocusCycleRoot(true);
          jTextFieldSelectLimit.setEnabled(false);
        }
        {
          jLabelSelectTime = new JLabel4j_std();
          desktopPane.add(jLabelSelectTime);
          jLabelSelectTime.setText("DB Select Limit");
          jLabelSelectTime.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSelectTime.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSelectTime.setBounds(291, 346, 127, 21);

        }
        {
          jLabelSchema = new JLabel4j_std();
          desktopPane.add(jLabelSchema);
          jLabelSchema.setText("DB Schema");
          jLabelSchema.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSchema.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSchema.setBounds(291, 370, 127, 21);
        }
        {
          jTextFieldSchema = new JTextField4j();
          desktopPane.add(jTextFieldSchema);
          jTextFieldSchema.setEnabled(false);
          jTextFieldSchema.setBounds(425, 370, 325, 21);
          jTextFieldSchema.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
          jTextFieldSchema.setFocusCycleRoot(true);
        }

        {
          jLabelMenuURL = new JLabel4j_std();
          jLabelMenuURL.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelMenuURL.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelMenuURL.setText("URL");
          jLabelMenuURL.setBounds(291, 66, 127, 21);
          desktopPane.add(jLabelMenuURL);
        }

        {
          jTextFieldUniqueID = new JTextField4j();
          jTextFieldUniqueID.addKeyListener(new KeyAdapter()
          {
            @Override
            public void keyTyped(KeyEvent e)
            {
              jTextFieldKeyTyped();
            }
          });
          jTextFieldUniqueID.setEditable(true);
          jTextFieldUniqueID.setBounds(425, 395, 325, 21);
          desktopPane.add(jTextFieldUniqueID);
        }

        {
          jLabelUniqueID = new JLabel4j_std();
          jLabelUniqueID.setText("Unique ID");
          jLabelUniqueID.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelUniqueID.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelUniqueID.setBounds(291, 396, 127, 21);
          desktopPane.add(jLabelUniqueID);
        }
        {
          btnSchema = new JButton4j(Common.icon_report);
          btnSchema.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {

              writeBackHosts(hostList);

              int j = jListHosts.getSelectedIndex();
              JHost hst = (JHost) jListHosts.getModel().getElementAt(j);
              Common.selectedHostID = hst.getSiteNumber();
              if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID))
              {
                btnSchema.setEnabled(true);
                jButtonUpdate.setEnabled(true);
                JDBStructure struct = new JDBStructure(Common.selectedHostID, Common.sessionID);
View Full Code Here

Examples of com.commander4j.sys.JHost

  private void getHostData()
  {
    int j = jListHosts.getSelectedIndex();
    if (j >= 0)
    {
      JHost hst = new JHost();
      hst = (JHost) jListHosts.getModel().getElementAt(j);
      jTextFieldDescription.setText(hst.getSiteDescription());
      jTextFieldUniqueID.setText(hst.getUniqueID());
      jTextFieldURL.setText(hst.getSiteURL());
      jTextFieldSiteNo.setText(hst.getSiteNumber());
      jTextFieldDriver.setText(hst.getDatabaseParameters().getjdbcDriver());
      if (hst.getDatabaseParameters().getjdbcDriver().equals(""))
      {
        jComboBoxjdbcDriver.setSelectedIndex(0);
      }

      if (hst.getDatabaseParameters().getjdbcDriver().equals("com.mysql.jdbc.Driver"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(1);
      }
      if (hst.getDatabaseParameters().getjdbcDriver().equals("oracle.jdbc.driver.OracleDriver"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(2);
      }
      if (hst.getDatabaseParameters().getjdbcDriver().equals("com.microsoft.sqlserver.jdbc.SQLServerDriver"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(3);
      }
      if (hst.getDatabaseParameters().getjdbcDriver().equals("http"))
      {
        jComboBoxjdbcDriver.setSelectedIndex(4);
      }

      jTextFieldConnect.setText(hst.getDatabaseParameters().getjdbcConnectString());
      jTextFieldDateTime.setText(hst.getDatabaseParameters().getjdbcDatabaseDateTimeToken());
      jTextFieldSelectLimit.setText(hst.getDatabaseParameters().getjdbcDatabaseSelectLimit());
      jTextFieldSchema.setText(hst.getDatabaseParameters().getjdbcDatabaseSchema());
      jTextFieldUsername.setText(hst.getDatabaseParameters().getjdbcUsername());
      jTextFieldPassword.setText(hst.getDatabaseParameters().getjdbcPassword());
      jTextFieldPort.setText(hst.getDatabaseParameters().getjdbcPort());
      jTextFieldSID.setText(hst.getDatabaseParameters().getjdbcSID());
      jTextFieldServer.setText(hst.getDatabaseParameters().getjdbcServer());
      jTextFieldDatabase.setText(hst.getDatabaseParameters().getjdbcDatabase());
      if (hst.getEnabled().equals("Y"))
        jCheckBoxEnabled.setSelected(true);
      else
        jCheckBoxEnabled.setSelected(false);

      setEditable(true);
View Full Code Here

Examples of com.commander4j.sys.JHost

  }

  private JHost setHostData()
  {
    int j = jListHosts.getSelectedIndex();
    JHost hst = new JHost();
    if (j > -1)
    {

      hst.setSiteDescription(jTextFieldDescription.getText());
      hst.setSiteURL(jTextFieldURL.getText());
      hst.setSiteNumber(jTextFieldSiteNo.getText());
      hst.getDatabaseParameters().setjdbcDriver(jTextFieldDriver.getText());
      hst.getDatabaseParameters().setjdbcDatabaseDateTimeToken(jTextFieldDateTime.getText());
      hst.getDatabaseParameters().setjdbcDatabaseSelectLimit(jTextFieldSelectLimit.getText());
      hst.getDatabaseParameters().setjdbcDatabaseSchema(jTextFieldSchema.getText());
      hst.getDatabaseParameters().setjdbcUsername(jTextFieldUsername.getText());
      hst.getDatabaseParameters().setjdbcPassword(String.valueOf(jTextFieldPassword.getPassword()));

      hst.getDatabaseParameters().setjdbcPort(jTextFieldPort.getText());
      hst.getDatabaseParameters().setjdbcSID(jTextFieldSID.getText());
      hst.getDatabaseParameters().setjdbcServer(jTextFieldServer.getText());
      hst.getDatabaseParameters().setjdbcDatabase(jTextFieldDatabase.getText());
      hst.setUniqueID(jTextFieldUniqueID.getText());
      hst.getSqlstatements().setjdbcDriver(hst.getDatabaseParameters().getjdbcDriver());
      hst.getSqlstatements().setjdbcDriver(hst.getDatabaseParameters().getjdbcDriver());

      if (jCheckBoxEnabled.isSelected())
        hst.setEnabled("Y");
      else
        hst.setEnabled("N");
      hostList.set(j, hst);
      setEditable(false);
      populateList("");
      jButtonApply.setEnabled(false);
      jButtonCancel.setEnabled(false);
View Full Code Here

Examples of com.commander4j.sys.JHost

                  }
                }

              } while (found);

              JHost hst = new JHost();
              hst.setSiteNumber(siteNo);
              hst.setSiteDescription(newdesc);

              hostList.add(hst);
              setSaveButtonState(true);

              populateList(newdesc);
              getHostData();
            }
          });
        }
        {
          jButtonApply = new JButton4j(Common.icon_ok);
          desktopPane.add(jButtonApply);
          jButtonApply.setText("Confirm Changes");
          jButtonApply.setBounds(762, 160, 160, 36);
          jButtonApply.setEnabled(false);
          jButtonApply.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              int j = jListHosts.getSelectedIndex();
              JHost hst = setHostData();

              hostList.set(j, hst);
              setEditable(false);
              populateList("");
              jButtonApply.setEnabled(false);
              jButtonCancel.setEnabled(false);

              setSaveButtonState(true);
              jButtonTest.setEnabled(true);
              jListHosts.setSelectedIndex(j);
            }
          });
        }
        {
          jButtonDelete = new JButton4j(Common.icon_delete);
          desktopPane.add(jButtonDelete);
          jButtonDelete.setText("Delete DB Connection");
          jButtonDelete.setBounds(762, 49, 160, 36);
          jButtonDelete.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jListHosts.getSelectedIndex() > -1)
              {
                int j = jListHosts.getSelectedIndex();
                hostList.remove(j);
                renumberHosts();
                populateList("");
                if (hostList.size() > 0)
                {
                  if (j > (hostList.size() - 1))
                  {
                    j--;
                  }
                  if (j >= 0)
                  {
                    populateList(hostList.get(j).getSiteDescription());
                  }
                }

                getHostData();
                setSaveButtonState(true);
              }
            }
          });
        }
        {
          jButtonUp = new JButton4j(Common.icon_arrow_up);
          desktopPane.add(jButtonUp);
          jButtonUp.setEnabled(false);
          jButtonUp.setBounds(284, 221, 28, 28);
          jButtonUp.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jListHosts.getSelectedIndex() > -1)
              {
                int j = jListHosts.getSelectedIndex();
                JHost element = ((JHost) jListHosts.getModel().getElementAt(j));
                hostList = moveElementUp(hostList, element);
                renumberHosts();
                populateList(element.getSiteDescription());
                setSaveButtonState(true);
              }
            }
          });
        }
        {
          jButtonDown = new JButton4j(Common.icon_arrow_down);
          desktopPane.add(jButtonDown);
          jButtonDown.setEnabled(false);
          jButtonDown.setBounds(284, 256, 28, 28);
          jButtonDown.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jListHosts.getSelectedIndex() > -1)
              {
                int j = jListHosts.getSelectedIndex();
                JHost element = ((JHost) jListHosts.getModel().getElementAt(j));
                hostList = moveElementDown(hostList, element);
                renumberHosts();
                populateList(element.getSiteDescription());
                setSaveButtonState(true);
              }
            }
          });
        }
        {
          jButtonClose = new JButton4j(Common.icon_close);
          desktopPane.add(jButtonClose);
          jButtonClose.setText("Close");
          jButtonClose.setBounds(762, 382, 160, 36);
          jButtonClose.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              logger.debug("JFrameHostAdmin closed");
              dispose();
            }
          });
        }
        {
          jButtonUndo = new JButton4j(Common.icon_undo);
          desktopPane.add(jButtonUndo);
          jButtonUndo.setText("Undo Changes");
          jButtonUndo.setBounds(762, 271, 160, 36);
          jButtonUndo.setEnabled(false);
          jButtonUndo.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              // Common.hosts = JXMLHost.loadHosts(false);
              int j = jListHosts.getSelectedIndex();
              String Current = hostList.get(j).getSiteDescription();
              getHosts();
              populateList(Current);
              getHostData();
              setSaveButtonState(false);
              setSaveButtonState(false);
            }
          });
        }
        {

          jButtonSave = new JButton4j(Common.icon_update);
          desktopPane.add(jButtonSave);
          jButtonSave.setText("Save DB Connections");
          jButtonSave.setBounds(762, 197, 160, 36);
          jButtonSave.setEnabled(false);
          jButtonSave.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              String pass1 = "";
              String pass2 = "";
              pass1 = String.valueOf(setupPasswordField.getPassword());
              pass2 = String.valueOf(verifyPasswordField.getPassword());

              if (pass1.equals(pass2))
              {

                String splash;
                if (jCheckBoxSplash.isSelected())
                {
                  splash = "Y";
                } else
                {
                  splash = "N";
                }

                JXMLHost.writeHosts(hostList, splash, JTextFieldUpdateURL.getText(), getUpdateMode(), jTextField4jInstallDir.getText(), pass1);
                jButtonSave.setEnabled(false);
                jButtonUndo.setEnabled(false);
              } else
              {
                JOptionPane.showMessageDialog(null,
                      "Setup password has been changed but failed verification - please check.",
                      "Error",
                      JOptionPane.ERROR_MESSAGE);
              }
            }
          });
        }
        {
          jTextFieldDescription = new JTextField4j();
          desktopPane.add(jTextFieldDescription);
          jTextFieldDescription.setFocusCycleRoot(true);
          jTextFieldDescription.setBounds(425, 40, 325, 21);
          jTextFieldDescription.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldURL = new JTextField4j();
          desktopPane.add(jTextFieldURL);
          jTextFieldURL.setFocusCycleRoot(true);
          jTextFieldURL.setBounds(425, 65, 325, 21);
          jTextFieldURL.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelDatabaseType = new JLabel4j_std();
          desktopPane.add(jLabelDatabaseType);
          jLabelDatabaseType.setText("Database Type");
          jLabelDatabaseType.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDatabaseType.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDatabaseType.setBounds(291, 91, 127, 21);

        }
        {

          ComboBoxModel jComboBoxjdbcDriverModel = new DefaultComboBoxModel(new String[]
          { "", "mySQL", "Oracle", "SQL Server", "Web URL" });
          jComboBoxjdbcDriver = new JComboBox4j();
          desktopPane.add(jComboBoxjdbcDriver);
          jComboBoxjdbcDriver.setModel(jComboBoxjdbcDriverModel);
          jComboBoxjdbcDriver.setBounds(425, 90, 164, 21);
          jComboBoxjdbcDriver.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("Oracle"))
              {
                jTextFieldDriver.setText("oracle.jdbc.driver.OracleDriver");
                jTextFieldConnect.setText("jdbc:oracle:thin:@jdbcServer:jdbcPort:jdbcSID");
                jTextFieldDateTime.setText("sysdate");
                jTextFieldSelectLimit.setText("rownum");
                jTextFieldServer.setText("localhost");
                jTextFieldPort.setText("1521");
              }
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("mySQL"))
              {
                jTextFieldDriver.setText("com.mysql.jdbc.Driver");
                jTextFieldConnect.setText("jdbc:mysql://jdbcServer/jdbcDatabase");
                jTextFieldDateTime.setText("sysdate");
                jTextFieldSelectLimit.setText("limit");
                jTextFieldServer.setText("localhost");
                jTextFieldPort.setText("3306");
              }
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("SQL Server"))
              {
                jTextFieldDriver.setText("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                jTextFieldConnect.setText("jdbc:sqlserver://jdbcServer\\jdbcSID");
                jTextFieldDateTime.setText("sysdate");
                jTextFieldSelectLimit.setText("top");
                jTextFieldServer.setText("localhost");
                jTextFieldPort.setText("1433");
              }
              if (jComboBoxjdbcDriver.getSelectedItem().toString().equals("Web URL"))
              {
                jTextFieldDriver.setText("http");
                jTextFieldConnect.setText("");
                jTextFieldDateTime.setText("");
                jTextFieldSelectLimit.setText("");
                jTextFieldServer.setText("");
                jTextFieldPort.setText("");
              }
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldConnect = new JTextField4j();
          desktopPane.add(jTextFieldConnect);
          jTextFieldConnect.setFocusCycleRoot(true);
          jTextFieldConnect.setBounds(425, 145, 325, 21);
          jTextFieldConnect.setEditable(false);
          jTextFieldConnect.setEnabled(false);
          jTextFieldConnect.setDisabledTextColor(Common.color_textdisabled);
          jTextFieldConnect.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelDriver = new JLabel4j_std();
          desktopPane.add(jLabelDriver);
          jLabelDriver.setText("Driver");
          jLabelDriver.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDriver.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDriver.setBounds(291, 116, 127, 21);

        }
        {
          jLabelDatabase = new JLabel4j_std();
          desktopPane.add(jLabelDatabase);
          jLabelDatabase.setText("Database");
          jLabelDatabase.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDatabase.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDatabase.setBounds(320, 196, 98, 21);

        }
        {
          jLabelDBDateTime = new JLabel4j_std();
          desktopPane.add(jLabelDBDateTime);
          jLabelDBDateTime.setText("DB Date Time");
          jLabelDBDateTime.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDBDateTime.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDBDateTime.setBounds(291, 321, 127, 21);

        }
        {
          jLabelPassword = new JLabel4j_std();
          desktopPane.add(jLabelPassword);
          jLabelPassword.setText("Password");
          jLabelPassword.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelPassword.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelPassword.setBounds(291, 296, 127, 21);

        }
        {
          jLabelDescription = new JLabel4j_std();
          desktopPane.add(jLabelDescription);
          jLabelDescription.setText("Description");
          jLabelDescription.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelDescription.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelDescription.setBounds(291, 41, 127, 21);
        }
        {
          jLabelSiteNo = new JLabel4j_std();
          desktopPane.add(jLabelSiteNo);
          jLabelSiteNo.setText("Site No");
          jLabelSiteNo.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSiteNo.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSiteNo.setBounds(291, 15, 127, 21);

        }
        {
          jLabelUsername = new JLabel4j_std();
          desktopPane.add(jLabelUsername);
          jLabelUsername.setText("Username");
          jLabelUsername.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelUsername.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelUsername.setBounds(291, 271, 127, 21);

        }
        {
          jLabelPort = new JLabel4j_std();
          desktopPane.add(jLabelPort);
          jLabelPort.setText("Port");
          jLabelPort.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelPort.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelPort.setBounds(320, 221, 98, 21);

        }
        {
          jTextFieldDateTime = new JTextField4j();
          desktopPane.add(jTextFieldDateTime);
          jTextFieldDateTime.setFocusCycleRoot(true);
          jTextFieldDateTime.setBounds(425, 320, 325, 21);
          jTextFieldDateTime.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldUsername = new JTextField4j();
          desktopPane.add(jTextFieldUsername);
          jTextFieldUsername.setFocusCycleRoot(true);
          jTextFieldUsername.setBounds(425, 270, 325, 21);
          jTextFieldUsername.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldPassword = new JPasswordField(10);
          desktopPane.add(jTextFieldPassword);
          jTextFieldPassword.setFocusCycleRoot(true);
          jTextFieldPassword.setBounds(425, 295, 325, 21);
          jTextFieldPassword.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldPort = new JTextField4j();
          desktopPane.add(jTextFieldPort);
          jTextFieldPort.setFocusCycleRoot(true);
          jTextFieldPort.setBounds(425, 220, 325, 21);
          jTextFieldPort.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldSID = new JTextField4j();
          desktopPane.add(jTextFieldSID);
          jTextFieldSID.setFocusCycleRoot(true);
          jTextFieldSID.setBounds(425, 245, 325, 21);
          jTextFieldSID.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldSiteNo = new JTextField4j();
          desktopPane.add(jTextFieldSiteNo);
          jTextFieldSiteNo.setFocusCycleRoot(true);
          jTextFieldSiteNo.setBounds(425, 14, 28, 21);
          jTextFieldSiteNo.setHorizontalAlignment(SwingConstants.CENTER);
          jTextFieldSiteNo.setEnabled(false);
          jTextFieldSiteNo.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jTextFieldDriver = new JTextField4j();
          desktopPane.add(jTextFieldDriver);
          jTextFieldDriver.setFocusCycleRoot(true);
          jTextFieldDriver.setBounds(425, 117, 325, 21);
          jTextFieldDriver.setEditable(false);
          jTextFieldDriver.setEnabled(false);
          jTextFieldDriver.setDisabledTextColor(Common.color_textdisabled);
          jTextFieldDriver.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jCheckBoxEnabled = new JCheckBox();
          jCheckBoxEnabled.setFont(Common.font_std);
          desktopPane.add(jCheckBoxEnabled);
          jCheckBoxEnabled.setText("Enabled");
          jCheckBoxEnabled.setBounds(467, 14, 91, 21);
          jCheckBoxEnabled.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxEnabled.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jCheckBoxSplash = new JCheckBox();
          jCheckBoxSplash.setSelected(true);
          jCheckBoxSplash.setFont(Common.font_std);
          desktopPane.add(jCheckBoxSplash);
          jCheckBoxSplash.setText("Enable Splash Screen");
          jCheckBoxSplash.setBounds(687, 445, 150, 21);
          jCheckBoxSplash.setBackground(new java.awt.Color(255, 255, 255));
          jCheckBoxSplash.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelSID = new JLabel4j_std();
          desktopPane.add(jLabelSID);
          jLabelSID.setText("SID");
          jLabelSID.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSID.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSID.setBounds(320, 246, 98, 21);
        }
        {
          jButtonCancel = new JButton4j(Common.icon_cancel);
          desktopPane.add(jButtonCancel);
          jButtonCancel.setText("Cancel");
          jButtonCancel.setBounds(762, 345, 160, 36);
          jButtonCancel.setEnabled(false);
          jButtonCancel.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {
              getHostData();
            }
          });
        }
        {
          jTextFieldServer = new JTextField4j();
          desktopPane.add(jTextFieldServer);
          jTextFieldServer.setFocusCycleRoot(true);
          jTextFieldServer.setBounds(425, 170, 325, 21);
          jTextFieldServer.setEnabled(false);
          jTextFieldServer.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelConnectionString = new JLabel4j_std();
          desktopPane.add(jLabelConnectionString);
          jLabelConnectionString.setText("Connect String");
          jLabelConnectionString.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelConnectionString.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelConnectionString.setBounds(291, 141, 127, 21);
        }
        {
          jTextFieldDatabase = new JTextField4j();
          desktopPane.add(jTextFieldDatabase);
          jTextFieldDatabase.setEnabled(false);
          jTextFieldDatabase.setFocusCycleRoot(true);
          jTextFieldDatabase.setBounds(425, 195, 325, 21);
          jTextFieldDatabase.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
        }
        {
          jLabelServer = new JLabel4j_std();
          desktopPane.add(jLabelServer);
          jLabelServer.setText("Server");
          jLabelServer.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelServer.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelServer.setBounds(320, 171, 98, 21);
        }
        {
          jButtonTest = new JButton4j(Common.icon_connect);
          desktopPane.add(jButtonTest);
          jButtonTest.setText("Connect to DB");
          jButtonTest.setBounds(762, 86, 160, 36);
          jButtonTest.setToolTipText("Connect to selected Host Database");
          jButtonTest.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {

              writeBackHosts(hostList);

              int j = jListHosts.getSelectedIndex();
              JHost hst = (JHost) jListHosts.getModel().getElementAt(j);
              Common.selectedHostID = hst.getSiteNumber();
              if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID))
              {
                btnSchema.setEnabled(true);
                jButtonUpdate.setEnabled(true);
                Common.hostList.getHost(Common.selectedHostID).disconnect(Common.sessionID);
              } else
              {
                jButtonUpdate.setEnabled(false);
                btnSchema.setEnabled(false);
              }
            }
          });
        }
        {
          jButtonUpdate = new JButton4j(Common.icon_update);
          desktopPane.add(jButtonUpdate);
          jButtonUpdate.setText("Create/Update Tables");
          jButtonUpdate.setBounds(762, 123, 160, 36);
          jButtonUpdate.setEnabled(false);
          jButtonUpdate.setToolTipText("Create or Upgrade Application Database Schema");
          jButtonUpdate.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent evt)
            {

              writeBackHosts(hostList);

              int j = jListHosts.getSelectedIndex();
              JHost hst = (JHost) jListHosts.getModel().getElementAt(j);
              Common.selectedHostID = hst.getSiteNumber();

              if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID))
              {
                JDBSchema schema = new JDBSchema(Common.sessionID, Common.hostList.getHost(Common.selectedHostID));
                JDBUpdateRequest updrst = new JDBUpdateRequest();
                updrst = schema.validate(false);

                if (updrst.schema_updateRequired)
                {
                  int continueUpdate = JOptionPane.showConfirmDialog(me, "Current Schema Version is " + String.valueOf(updrst.schema_currentVersion) + ", required version is " + String.valueOf(updrst.schema_requiredVersion)
                      + ". Upgrade ?", "Connection to (" + hst.getSiteDescription() + ")", JOptionPane.YES_NO_OPTION);

                  if (continueUpdate == 0)
                  {

                    LinkedList<JDBDDL> cmds = new LinkedList<JDBDDL>();
                    cmds.clear();
                    cmds = JXMLSchema.loadDDLStatements(jTextFieldDriver.getText(), "xml/schema/" + Common.hostList.getHost(Common.selectedHostID).getDatabaseParameters().getjdbcDriver() + "/");
                    boolean updateCtrl = false;
                    if (cmds.size() > 0)
                    {
                      if (schema.executeDDL(cmds, progressBar, labelCommand) == true)
                      {
                        updateCtrl = true;

                      } else
                      {
                        JUtility.errorBeep();
                        JDialogDMLErrors dmlerrs = new JDialogDMLErrors(me, cmds);
                        dmlerrs.setModal(true);
                        int ignoreDDLErrors = JOptionPane.showConfirmDialog(me, "Ignore Errors and set SCHEMA version to " + String.valueOf(updrst.schema_requiredVersion) + " ?", "Connection to (" + hst.getSiteDescription()
                            + ")", JOptionPane.YES_NO_OPTION);

                        if (ignoreDDLErrors == 0)
                        {
                          updateCtrl = true;
                        }
                      }
                    } else
                    {
                      JOptionPane.showMessageDialog(me, "No DDL Commands found", "Connection to (" + hst.getSiteDescription() + ")", JOptionPane.WARNING_MESSAGE);

                    }

                    if (updateCtrl)
                    {
                      JDBControl ctrl = new JDBControl(Common.selectedHostID, Common.sessionID);
                      if (ctrl.getProperties("SCHEMA VERSION"))
                      {
                        ctrl.setKeyValue(String.valueOf(updrst.schema_requiredVersion));
                        ctrl.update();
                      } else
                      {
                        ctrl.create("SCHEMA VERSION", String.valueOf(updrst.schema_requiredVersion), "Schema Version");
                      }
                      JOptionPane.showMessageDialog(me, "Schema Version now set to " + String.valueOf(JVersion.getSchemaVersion()), "Control Table", JOptionPane.INFORMATION_MESSAGE);

                    }

                  }
                } else
                {
                  JOptionPane.showMessageDialog(me, "No Schema update Required", "Connection to (" + hst.getSiteDescription() + ")", JOptionPane.INFORMATION_MESSAGE);
                }

                if (updrst.program_updateRequired)
                {
                  JDBControl ctrl = new JDBControl(Common.selectedHostID, Common.sessionID);

                  if (ctrl.getProperties("PROGRAM VERSION"))
                  {
                    ctrl.setKeyValue(JVersion.getProgramVersion());
                    ctrl.update();
                  } else
                  {
                    ctrl.create("PROGRAM VERSION", JVersion.getProgramVersion(), "Program Version");
                  }
                  JOptionPane.showMessageDialog(me, "Program Version now set to " + JVersion.getProgramVersion(), "Control Table", JOptionPane.INFORMATION_MESSAGE);

                }
                Common.hostList.getHost(Common.selectedHostID).disconnect(Common.sessionID);
              }
            }
          });
        }
        {
          jTextFieldSelectLimit = new JTextField4j();
          desktopPane.add(jTextFieldSelectLimit);
          jTextFieldSelectLimit.setBounds(425, 345, 325, 21);
          jTextFieldSelectLimit.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
          jTextFieldSelectLimit.setFocusCycleRoot(true);
          jTextFieldSelectLimit.setEnabled(false);
        }
        {
          jLabelSelectTime = new JLabel4j_std();
          desktopPane.add(jLabelSelectTime);
          jLabelSelectTime.setText("DB Select Limit");
          jLabelSelectTime.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSelectTime.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSelectTime.setBounds(291, 346, 127, 21);

        }
        {
          jLabelSchema = new JLabel4j_std();
          desktopPane.add(jLabelSchema);
          jLabelSchema.setText("DB Schema");
          jLabelSchema.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelSchema.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelSchema.setBounds(291, 370, 127, 21);
        }
        {
          jTextFieldSchema = new JTextField4j();
          desktopPane.add(jTextFieldSchema);
          jTextFieldSchema.setEnabled(false);
          jTextFieldSchema.setBounds(425, 370, 325, 21);
          jTextFieldSchema.addKeyListener(new KeyAdapter()
          {
            public void keyTyped(KeyEvent evt)
            {
              jTextFieldKeyTyped();
            }
          });
          jTextFieldSchema.setFocusCycleRoot(true);
        }

        {
          jLabelMenuURL = new JLabel4j_std();
          jLabelMenuURL.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelMenuURL.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelMenuURL.setText("URL");
          jLabelMenuURL.setBounds(291, 66, 127, 21);
          desktopPane.add(jLabelMenuURL);
        }

        {
          jTextFieldUniqueID = new JTextField4j();
          jTextFieldUniqueID.addKeyListener(new KeyAdapter()
          {
            @Override
            public void keyTyped(KeyEvent e)
            {
              jTextFieldKeyTyped();
            }
          });
          jTextFieldUniqueID.setEditable(true);
          jTextFieldUniqueID.setBounds(425, 395, 325, 21);
          desktopPane.add(jTextFieldUniqueID);
        }

        {
          jLabelUniqueID = new JLabel4j_std();
          jLabelUniqueID.setText("Unique ID");
          jLabelUniqueID.setHorizontalAlignment(SwingConstants.RIGHT);
          jLabelUniqueID.setHorizontalTextPosition(SwingConstants.RIGHT);
          jLabelUniqueID.setBounds(291, 396, 127, 21);
          desktopPane.add(jLabelUniqueID);
        }
        {
          btnSchema = new JButton4j(Common.icon_report);
          btnSchema.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {

              writeBackHosts(hostList);

              int j = jListHosts.getSelectedIndex();
              JHost hst = (JHost) jListHosts.getModel().getElementAt(j);
              Common.selectedHostID = hst.getSiteNumber();
              if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID))
              {
                btnSchema.setEnabled(true);
                jButtonUpdate.setEnabled(true);
                JDBStructure struct = new JDBStructure(Common.selectedHostID, Common.sessionID);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.