示例#1
0
 public void stopConnectionTest() {
   btnConnectionTest.setIcon(UIImages.PLAY.getImageIcon());
   lblConnectionStatus.setIcon(null);
   setLabel(
       lblConnectionStatus, STLConstants.K3028_NOT_TESTED.getValue(), UIConstants.INTEL_DARK_GRAY);
   // TODO cancel task...
   btnConnectionTest.setSelected(false);
 }
示例#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;
  }