@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; } });
@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())); } } });
@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()); } } } });
@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())); } } } });
bucketLoggingPopup.selectItemAtIndex(bucketLoggingPopup.indexOfItemWithRepresentedObject(containerService.getContainer(file).getName())); encryptionPopup.selectItemAtIndex(encryptionPopup.indexOfItemWithRepresentedObject(algorithm.toString())); encryptionPopup.itemAtIndex(encryptionPopup.indexOfItemWithRepresentedObject(algorithm.toString())) .setState(selectedEncryptionKeys.size() == 1 ? NSCell.NSOnState : NSCell.NSMixedState); storageClassPopup.selectItemAtIndex(storageClassPopup.indexOfItemWithRepresentedObject(storageClass)); storageClassPopup.itemAtIndex(storageClassPopup.indexOfItemWithRepresentedObject(storageClass)) .setState(selectedStorageClasses.size() == 1 ? NSCell.NSOnState : NSCell.NSMixedState); lifecycleDeleteCheckbox.setState(lifecycle.getExpiration() != null ? NSCell.NSOnState : NSCell.NSOffState); if(lifecycle.getExpiration() != null) { final NSInteger index = lifecycleDeletePopup.indexOfItemWithRepresentedObject(String.valueOf(lifecycle.getExpiration())); if(-1 == index.intValue()) { lifecycleDeletePopup.addItemWithTitle(MessageFormat.format(LocaleFactory.localizedString("after {0} Days", "S3"), String.valueOf(lifecycle.getExpiration()))); lifecycleDeletePopup.lastItem().setRepresentedObject(String.valueOf(lifecycle.getExpiration())); lifecycleDeletePopup.selectItemAtIndex(lifecycleDeletePopup.indexOfItemWithRepresentedObject(String.valueOf(lifecycle.getExpiration()))); final NSInteger index = lifecycleTransitionPopup.indexOfItemWithRepresentedObject(String.valueOf(lifecycle.getTransition())); if(-1 == index.intValue()) { lifecycleTransitionPopup.addItemWithTitle(MessageFormat.format(LocaleFactory.localizedString("after {0} Days", "S3"), String.valueOf(lifecycle.getTransition()))); lifecycleTransitionPopup.selectItemAtIndex(lifecycleTransitionPopup.indexOfItemWithRepresentedObject(String.valueOf(lifecycle.getTransition())));
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())));
@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")); } } });
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")));