示例#1
0
 /**
  * Show warning if user selected gateway requiring registration and no credentials are filled in
  */
 private void updateCredentialsInfoLabel() {
   Gateway gateway = gatewayComboBox.getSelectedGateway();
   if (gateway != null
       && gateway.hasFeature(Feature.LOGIN_ONLY)
       && keyring.getKey(gateway.getName()) == null) {
     credentialsInfoLabel.setVisible(true);
   } else {
     credentialsInfoLabel.setVisible(false);
   }
 }
示例#2
0
  /**
   * Show warning if user selected gateway can't send messages to a recipient number (based on
   * supported prefixes list)
   */
  private void updateCountryInfoLabel() {
    countryInfoLabel.setVisible(false);

    // ensure that fields are sufficiently filled in
    Gateway gateway = gatewayComboBox.getSelectedGateway();
    String number = numberTextField.getText();
    if (gateway == null || !Contact.isValidNumber(number)) {
      return;
    }

    boolean supported = Gateways.isNumberSupported(gateway, number);
    if (!supported) {
      String text =
          MessageFormat.format(
              l10n.getString("EditContactPanel.countryInfoLabel.text"),
              StringUtils.join(gateway.getSupportedPrefixes(), ','));
      countryInfoLabel.setText(text);
      countryInfoLabel.setVisible(true);
    }
  }