Example #1
0
 /** Show or hide suggest gateway button */
 private void updateSuggestGatewayButton() {
   ArrayList<Gateway> gws =
       Gateways.getInstance().suggestGateway(numberTextField.getText()).get1();
   boolean visible = false;
   if (gws.size() > 1) {
     visible = true;
   }
   if (gws.size() == 1 && gatewayComboBox.getSelectedGateway() != gws.get(0)) {
     visible = true;
   }
   suggestGatewayButton.setVisible(visible);
 }
Example #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);
    }
  }