Esempio n. 1
0
  public void setDownloadPathPopup(NSPopUpButton downloadPathPopup) {
    this.downloadPathPopup = downloadPathPopup;
    this.downloadPathPopup.setTarget(this.id());
    final Selector action = Foundation.selector("downloadPathPopupClicked:");
    this.downloadPathPopup.setAction(action);
    this.downloadPathPopup.removeAllItems();

    // Default download folder
    this.addDownloadPath(action, host.getDownloadFolder());
    this.downloadPathPopup.menu().addItem(NSMenuItem.separatorItem());
    this.addDownloadPath(
        action,
        LocalFactory.createLocal(Preferences.instance().getProperty("queue.download.folder")));
    // Shortcut to the Desktop
    this.addDownloadPath(action, LocalFactory.createLocal("~/Desktop"));
    // Shortcut to user home
    this.addDownloadPath(action, LocalFactory.createLocal("~"));
    // Shortcut to user downloads for 10.5
    this.addDownloadPath(action, LocalFactory.createLocal("~/Downloads"));
    // Choose another folder

    // Choose another folder
    this.downloadPathPopup.menu().addItem(NSMenuItem.separatorItem());
    this.downloadPathPopup
        .menu()
        .addItemWithTitle_action_keyEquivalent(CHOOSE, action, StringUtils.EMPTY);
    this.downloadPathPopup.lastItem().setTarget(this.id());
  }
Esempio n. 2
0
 public void setTransferPopup(NSPopUpButton transferPopup) {
   this.transferPopup = transferPopup;
   this.transferPopup.setTarget(this.id());
   this.transferPopup.setAction(Foundation.selector("transferPopupClicked:"));
   this.transferPopup.removeAllItems();
   this.transferPopup.addItemWithTitle(DEFAULT);
   this.transferPopup.menu().addItem(NSMenuItem.separatorItem());
   this.transferPopup.addItemWithTitle(TRANSFER_NEWCONNECTION);
   this.transferPopup.addItemWithTitle(TRANSFER_BROWSERCONNECTION);
 }
Esempio n. 3
0
 public void setConnectmodePopup(NSPopUpButton connectmodePopup) {
   this.connectmodePopup = connectmodePopup;
   this.connectmodePopup.setTarget(this.id());
   this.connectmodePopup.setAction(Foundation.selector("connectmodePopupClicked:"));
   this.connectmodePopup.removeAllItems();
   this.connectmodePopup.addItemWithTitle(DEFAULT);
   this.connectmodePopup.menu().addItem(NSMenuItem.separatorItem());
   this.connectmodePopup.addItemWithTitle(CONNECTMODE_ACTIVE);
   this.connectmodePopup.addItemWithTitle(CONNECTMODE_PASSIVE);
 }
Esempio n. 4
0
 public void setEncodingPopup(NSPopUpButton encodingPopup) {
   this.encodingPopup = encodingPopup;
   this.encodingPopup.setEnabled(true);
   this.encodingPopup.removeAllItems();
   this.encodingPopup.addItemWithTitle(DEFAULT);
   this.encodingPopup.menu().addItem(NSMenuItem.separatorItem());
   this.encodingPopup.addItemsWithTitles(
       NSArray.arrayWithObjects(MainController.availableCharsets()));
   if (null == host.getEncoding()) {
     this.encodingPopup.selectItemWithTitle(DEFAULT);
   } else {
     this.encodingPopup.selectItemWithTitle(host.getEncoding());
   }
   this.encodingPopup.setTarget(this.id());
   final Selector action = Foundation.selector("encodingSelectionChanged:");
   this.encodingPopup.setAction(action);
 }
Esempio n. 5
0
 public void setTimezonePopup(NSPopUpButton timezonePopup) {
   this.timezonePopup = timezonePopup;
   this.timezonePopup.setTarget(this.id());
   this.timezonePopup.setAction(Foundation.selector("timezonePopupClicked:"));
   this.timezonePopup.removeAllItems();
   final List<String> timezones = Arrays.asList(TimeZone.getAvailableIDs());
   this.timezonePopup.addItemWithTitle(UTC.getID());
   this.timezonePopup.lastItem().setRepresentedObject(UTC.getID());
   this.timezonePopup.menu().addItem(NSMenuItem.separatorItem());
   Collections.sort(
       timezones,
       new Comparator<String>() {
         @Override
         public int compare(String o1, String o2) {
           return TimeZone.getTimeZone(o1).getID().compareTo(TimeZone.getTimeZone(o2).getID());
         }
       });
   for (String tz : timezones) {
     if (tz.matches(TIMEZONE_CONTINENT_PREFIXES)) {
       this.timezonePopup.addItemWithTitle(String.format("%s", tz));
       this.timezonePopup.lastItem().setRepresentedObject(tz);
     }
   }
 }