Пример #1
0
 @Action
 public void protocolSelectionChanged(final NSPopUpButton sender) {
   log.debug("protocolSelectionChanged:" + sender);
   final Protocol selected =
       ProtocolFactory.forName(protocolPopup.selectedItem().representedObject());
   host.setPort(selected.getDefaultPort());
   if (!host.getProtocol().isHostnameConfigurable()) {
     // Previously selected protocol had a default hostname. Change to default
     // of newly selected protocol.
     host.setHostname(selected.getDefaultHostname());
   }
   if (!selected.isHostnameConfigurable()) {
     // Hostname of newly selected protocol is not configurable. Change to default.
     host.setHostname(selected.getDefaultHostname());
   }
   if (StringUtils.isNotBlank(selected.getDefaultHostname())) {
     // Prefill with default hostname
     host.setHostname(selected.getDefaultHostname());
   }
   if (!selected.isWebUrlConfigurable()) {
     host.setWebURL(null);
   }
   host.setProtocol(selected);
   this.itemChanged();
   this.init();
   this.reachable();
 }