Ejemplo n.º 1
0
  protected JPanel getHostPanel() {
    if (hostPanel == null) {
      hostPanel = new JPanel(new GridBagLayout());
      hostPanel.setBackground(UIConstants.INTEL_WHITE);
      hostPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 2, 5));

      GridBagConstraints gc = new GridBagConstraints();
      gc.fill = GridBagConstraints.BOTH;

      gc.gridwidth = 1;
      gc.insets = new Insets(7, 2, 3, 2);
      JLabel label =
          ComponentFactory.getH5Label(STLConstants.K3037_FE_CONNECTION.getValue(), Font.BOLD);
      label.setHorizontalAlignment(JLabel.TRAILING);
      label.setVerticalAlignment(JLabel.TOP);
      hostPanel.add(label, gc);

      gc.weightx = 1;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      gc.insets = widthInsets;
      JPanel panel = getConnectionPanel();
      hostPanel.add(panel, gc);

      gc.weightx = 0;
      gc.gridwidth = 1;
      gc.insets = insets;
      label = ComponentFactory.getH5Label(STLConstants.K3033_CONNECTION_TEST.getValue(), Font.BOLD);
      label.setHorizontalAlignment(JLabel.TRAILING);
      hostPanel.add(label, gc);

      gc.weightx = 1;
      gc.gridwidth = GridBagConstraints.REMAINDER;
      gc.insets = widthInsets;
      panel = getConnTestPanel();
      hostPanel.add(panel, gc);
    }
    return hostPanel;
  }
Ejemplo n.º 2
0
  protected JPanel getConnTestPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);

    GridBagConstraints gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.insets = insets;

    gc.gridwidth = 1;
    btnConnectionTest = ComponentFactory.getImageButton(UIImages.PLAY.getImageIcon());
    btnConnectionTest.setToolTipText(STLConstants.K3027_TEST_CONNECTION.getValue());
    btnConnectionTest.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (!txtFldHostName.isEditValid() || !txtFldPortNum.isEditValid()) {
              // do nothing if edit is invalid
              return;
            }

            if (btnConnectionTest.isSelected()) {
              stopConnectionTest();
            } else {
              testConnection();
            }
          }
        });
    panel.add(btnConnectionTest, gc);

    gc.weightx = 1;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    lblConnectionStatus =
        ComponentFactory.getH5Label(STLConstants.K3028_NOT_TESTED.getValue(), Font.PLAIN);
    panel.add(lblConnectionStatus, gc);

    return panel;
  }