public void setConnectionStatus(String status) { btnConnectionTest.setIcon(UIImages.PLAY.getImageIcon()); btnConnectionTest.setSelected(false); lblConnectionStatus.setIcon(null); Color color = (status.equals(STLConstants.K3031_PASS.getValue())) ? UIConstants.DARK_GREEN : UIConstants.INTEL_RED; setLabel(lblConnectionStatus, status, color); btnConnectionTest.setIcon(UIImages.PLAY.getImageIcon()); }
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); }
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; }