@Override public void change(final Host bookmark) { protocolPopup.selectItemAtIndex(protocolPopup.indexOfItemWithRepresentedObject(String.valueOf(bookmark.getProtocol().hashCode()))); } });
@Override public void change(Host bookmark) { transferPopup.selectItemAtIndex(transferPopup.indexOfItemWithRepresentedObject(bookmark.getTransferType().name())); } });
@Override public boolean validate(final Transfer transfer) { final NSPopUpButton popup = Rococoa.cast(item.view(), NSPopUpButton.class); switch(transfer.getSource().getTransferType()) { case newconnection: popup.selectItemAtIndex(popup.indexOfItemWithRepresentedObject(String.valueOf(1))); break; default: popup.selectItemAtIndex(popup.indexOfItemWithRepresentedObject(PreferencesFactory.get().getProperty("queue.connections.limit"))); break; } return true; } });
@Override public boolean validate(final Transfer transfer) { final NSPopUpButton popup = Rococoa.cast(item.view(), NSPopUpButton.class); popup.selectItemAtIndex(popup.indexOfItemWithRepresentedObject(String.valueOf((int) transfer.getBandwidth().getRate()))); return true; } });
public void setChmodDownloadTypePopup(NSPopUpButton b) { this.chmodDownloadTypePopup = b; this.chmodDownloadTypePopup.selectItemAtIndex(new NSInteger(0)); this.chmodDownloadTypePopup.setTarget(this.id()); this.chmodDownloadTypePopup.setAction(Foundation.selector("chmodDownloadTypePopupChanged:")); }
public void setChmodUploadTypePopup(NSPopUpButton b) { this.chmodUploadTypePopup = b; this.chmodUploadTypePopup.selectItemAtIndex(new NSInteger(0)); this.chmodUploadTypePopup.setTarget(this.id()); this.chmodUploadTypePopup.setAction(Foundation.selector("chmodUploadTypePopupChanged:")); }
public void setBookmarkSizePopup(NSPopUpButton b) { this.bookmarkSizePopup = b; this.bookmarkSizePopup.setTarget(this.id()); this.bookmarkSizePopup.setAction(Foundation.selector("bookmarkSizePopupClicked:")); final int size = preferences.getInteger("bookmark.icon.size"); for(int i = 0; i < this.bookmarkSizePopup.numberOfItems().intValue(); i++) { this.bookmarkSizePopup.itemAtIndex(new NSInteger(i)).setState(NSCell.NSOffState); } if(BookmarkCell.SMALL_BOOKMARK_SIZE == size) { this.bookmarkSizePopup.selectItemAtIndex(new NSInteger(0)); } if(BookmarkCell.MEDIUM_BOOKMARK_SIZE == size) { this.bookmarkSizePopup.selectItemAtIndex(new NSInteger(1)); } if(BookmarkCell.LARGE_BOOKMARK_SIZE == size) { this.bookmarkSizePopup.selectItemAtIndex(new NSInteger(2)); } }
public void setDefaultDownloadThrottleCombobox(NSPopUpButton b) { this.defaultDownloadThrottleCombobox = b; this.defaultDownloadThrottleCombobox.setTarget(this.id()); this.defaultDownloadThrottleCombobox.setAction(Foundation.selector("defaultDownloadThrottleComboboxClicked:")); int bandwidth = (int) preferences.getDouble("queue.download.bandwidth.bytes"); final StringTokenizer options = new StringTokenizer(preferences.getProperty("queue.bandwidth.options"), ","); while(options.hasMoreTokens()) { final String bytes = options.nextToken(); this.defaultDownloadThrottleCombobox.addItemWithTitle(SizeFormatterFactory.get().format(Integer.parseInt(bytes)) + "/s"); this.defaultDownloadThrottleCombobox.lastItem().setRepresentedObject(bytes); } if(-1 == bandwidth) { this.defaultDownloadThrottleCombobox.selectItemWithTag(new NSInteger(-1)); } else { this.defaultDownloadThrottleCombobox.selectItemAtIndex( this.defaultDownloadThrottleCombobox.menu().indexOfItemWithRepresentedObject(String.valueOf(bandwidth))); } }
public void setDefaultUploadThrottleCombobox(NSPopUpButton b) { this.defaultUploadThrottleCombobox = b; this.defaultUploadThrottleCombobox.setTarget(this.id()); this.defaultUploadThrottleCombobox.setAction(Foundation.selector("defaultUploadThrottleComboboxClicked:")); int bandwidth = (int) preferences.getDouble("queue.upload.bandwidth.bytes"); final StringTokenizer options = new StringTokenizer(preferences.getProperty("queue.bandwidth.options"), ","); while(options.hasMoreTokens()) { final String bytes = options.nextToken(); this.defaultUploadThrottleCombobox.addItemWithTitle(SizeFormatterFactory.get().format(Integer.parseInt(bytes)) + "/s"); this.defaultUploadThrottleCombobox.lastItem().setRepresentedObject(bytes); } if(-1 == bandwidth) { this.defaultUploadThrottleCombobox.selectItemWithTag(new NSInteger(-1)); } else { this.defaultUploadThrottleCombobox.selectItemAtIndex( this.defaultUploadThrottleCombobox.menu().indexOfItemWithRepresentedObject(String.valueOf(bandwidth))); } }
@Override public void change(Host bookmark) { connectmodePopup.setEnabled(bookmark.getProtocol().getType() == Protocol.Type.ftp); if(bookmark.getProtocol().getType() == Protocol.Type.ftp) { connectmodePopup.selectItemAtIndex(connectmodePopup.indexOfItemWithRepresentedObject(bookmark.getFTPConnectMode().name())); } } });
public void setUpdateFeedPopup(NSPopUpButton b) { this.updateFeedPopup = b; this.updateFeedPopup.removeAllItems(); this.updateFeedPopup.setAction(Foundation.selector("updateFeedPopupClicked:")); this.updateFeedPopup.addItemWithTitle(LocaleFactory.localizedString("Release")); this.updateFeedPopup.lastItem().setRepresentedObject(preferences.getProperty("update.feed.release")); this.updateFeedPopup.addItemWithTitle(LocaleFactory.localizedString("Beta")); this.updateFeedPopup.lastItem().setRepresentedObject(preferences.getProperty("update.feed.beta")); this.updateFeedPopup.addItemWithTitle(LocaleFactory.localizedString("Snapshot Builds")); this.updateFeedPopup.lastItem().setRepresentedObject(preferences.getProperty("update.feed.nightly")); final String feed = preferences.getProperty(Updater.PROPERTY_FEED_URL); NSInteger selected = this.updateFeedPopup.menu().indexOfItemWithRepresentedObject(feed); if(-1 == selected.intValue()) { log.warn(String.format("Invalid feed setting:%s", feed)); this.updateFeedPopup.selectItemAtIndex(this.updateFeedPopup.menu().indexOfItemWithRepresentedObject( preferences.getProperty("update.feed.release"))); } else { this.updateFeedPopup.selectItemAtIndex(selected); } }
@Override public void change(final Host bookmark) { encodingPopup.setEnabled(bookmark.getProtocol().isEncodingConfigurable()); if(!bookmark.getProtocol().isEncodingConfigurable()) { encodingPopup.selectItemWithTitle(DEFAULT); } else { if(null == bookmark.getEncoding()) { encodingPopup.selectItemWithTitle(DEFAULT); } else { encodingPopup.selectItemAtIndex(encodingPopup.indexOfItemWithRepresentedObject(bookmark.getEncoding())); } } } });
public void setTransferPopup(NSPopUpButton b) { this.transferPopup = b; this.transferPopup.setTarget(this.id()); this.transferPopup.setAction(Foundation.selector("transferPopupClicked:")); this.transferPopup.removeAllItems(); for(String name : preferences.getList("queue.transfer.type.enabled")) { final Host.TransferType t = Host.TransferType.valueOf(name); this.transferPopup.addItemWithTitle(t.toString()); this.transferPopup.lastItem().setRepresentedObject(t.name()); } this.transferPopup.selectItemAtIndex(this.transferPopup.indexOfItemWithRepresentedObject( preferences.getProperty("queue.transfer.type") )); }
this.protocolCombobox.selectItemAtIndex(this.protocolCombobox.indexOfItemWithRepresentedObject(String.valueOf(defaultProtocol.hashCode())));
bucketLoggingPopup.selectItemAtIndex(bucketLoggingPopup.indexOfItemWithRepresentedObject(containerService.getContainer(file).getName())); encryptionPopup.selectItemAtIndex(new NSInteger(-1)); if(-1 != encryptionPopup.indexOfItemWithTitle(LocaleFactory.localizedString("Unknown")).intValue()) { encryptionPopup.removeItemWithTitle(LocaleFactory.localizedString("Unknown")); encryptionPopup.selectItemAtIndex(encryptionPopup.indexOfItemWithRepresentedObject(algorithm.toString())); storageClassPopup.selectItemAtIndex(new NSInteger(-1)); if(-1 != storageClassPopup.indexOfItemWithTitle(LocaleFactory.localizedString("Unknown")).intValue()) { storageClassPopup.removeItemWithTitle(LocaleFactory.localizedString("Unknown")); storageClassPopup.selectItemAtIndex(storageClassPopup.indexOfItemWithRepresentedObject(storageClass)); lifecycleDeletePopup.lastItem().setRepresentedObject(String.valueOf(lifecycle.getExpiration())); lifecycleDeletePopup.selectItemAtIndex(lifecycleDeletePopup.indexOfItemWithRepresentedObject(String.valueOf(lifecycle.getExpiration()))); lifecycleTransitionPopup.lastItem().setRepresentedObject(String.valueOf(lifecycle.getTransition())); lifecycleTransitionPopup.selectItemAtIndex(lifecycleTransitionPopup.indexOfItemWithRepresentedObject(String.valueOf(lifecycle.getTransition())));
@Override public void change(final Host bookmark) { certificatePopup.setEnabled(options.certificate); certificatePopup.removeAllItems(); certificatePopup.addItemWithTitle(LocaleFactory.localizedString("None")); if(options.certificate) { certificatePopup.menu().addItem(NSMenuItem.separatorItem()); for(String certificate : new KeychainX509KeyManager(bookmark).list()) { certificatePopup.addItemWithTitle(certificate); certificatePopup.lastItem().setRepresentedObject(certificate); } } if(credentials.isCertificateAuthentication()) { certificatePopup.selectItemAtIndex(certificatePopup.indexOfItemWithRepresentedObject(credentials.getCertificate())); } else { certificatePopup.selectItemWithTitle(LocaleFactory.localizedString("None")); } } });
@Override public void change(final Host bookmark) { privateKeyPopup.setEnabled(options.publickey); if(credentials.isPublicKeyAuthentication()) { privateKeyPopup.selectItemAtIndex(privateKeyPopup.indexOfItemWithRepresentedObject(credentials.getIdentity().getAbsolute())); } else { privateKeyPopup.selectItemWithTitle(LocaleFactory.localizedString("None")); } if(credentials.isPublicKeyAuthentication()) { final Local key = credentials.getIdentity(); if(-1 == privateKeyPopup.indexOfItemWithRepresentedObject(key.getAbsolute()).intValue()) { final NSInteger index = new NSInteger(0); privateKeyPopup.insertItemWithTitle_atIndex(key.getAbbreviatedPath(), index); privateKeyPopup.itemAtIndex(index).setRepresentedObject(key.getAbsolute()); } } } });
public void setDefaultEncryptionPopup(NSPopUpButton b) { this.defaultEncryptionPopup = b; this.defaultEncryptionPopup.setAutoenablesItems(false); this.defaultEncryptionPopup.removeAllItems(); this.defaultEncryptionPopup.addItemWithTitle(LocaleFactory.localizedString("None")); this.defaultEncryptionPopup.lastItem().setRepresentedObject(S3EncryptionFeature.Algorithm.NONE.toString()); this.defaultEncryptionPopup.addItemWithTitle(LocaleFactory.localizedString(S3EncryptionFeature.SSE_AES256.getDescription(), "S3")); this.defaultEncryptionPopup.lastItem().setRepresentedObject(S3EncryptionFeature.SSE_AES256.toString()); this.defaultEncryptionPopup.addItemWithTitle(LocaleFactory.localizedString(KMSEncryptionFeature.SSE_KMS_DEFAULT.getDescription(), "S3")); this.defaultEncryptionPopup.lastItem().setRepresentedObject(KMSEncryptionFeature.SSE_KMS_DEFAULT.toString()); this.defaultEncryptionPopup.setTarget(this.id()); this.defaultEncryptionPopup.setAction(Foundation.selector("defaultEncryptionPopupClicked:")); if(StringUtils.isEmpty(preferences.getProperty("s3.encryption.algorithm"))) { this.defaultEncryptionPopup.selectItemWithTitle(LocaleFactory.localizedString("None")); } else { this.defaultEncryptionPopup.selectItemAtIndex(this.defaultEncryptionPopup.indexOfItemWithRepresentedObject(preferences.getProperty("s3.encryption.algorithm"))); } }
button.setTarget(controller.id()); button.setAction(connections.action()); button.selectItemAtIndex(button.indexOfItemWithRepresentedObject(preferences.getProperty("queue.connections.limit"))); item.setView(button); item.setMaxSize(new NSSize(button.frame().size.width.doubleValue(), button.frame().size.height.doubleValue()));
popup.selectItemAtIndex(popup.indexOfItemWithRepresentedObject(controller.isMounted() ? controller.getSession().getHost().getEncoding() : PreferencesFactory.get().getProperty("browser.charset.encoding")));