protected void updateField(final NSTextField f, final String value, final NSDictionary attributes) { if(null == f) { return; } f.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes(StringUtils.isNotBlank(value) ? value : StringUtils.EMPTY, attributes)); } }
@Override public void message(final String message) { if(null == statusLabel) { return; } // Update the status label at the bottom of the browser window statusLabel.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes(message, TRUNCATE_MIDDLE_ATTRIBUTES)); }
@Override public void run() { progressField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( message, TRUNCATE_MIDDLE_ATTRIBUTES)); } });
private void setStatus(final String status) { statusField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes(status, TRUNCATE_MIDDLE_ATTRIBUTES)); }
@Override public void change(final Host bookmark) { passwordLabel.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( StringUtils.isNotBlank(options.getPasswordPlaceholder()) ? String.format("%s:", options.getPasswordPlaceholder()) : StringUtils.EMPTY, TRUNCATE_TAIL_ATTRIBUTES )); } });
@Override public void change(final Host bookmark) { usernameLabel.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( StringUtils.isNotBlank(bookmark.getProtocol().getUsernamePlaceholder()) ? String.format("%s:", bookmark.getProtocol().getUsernamePlaceholder()) : StringUtils.EMPTY, TRUNCATE_TAIL_ATTRIBUTES )); } });
private void setSize(final Long size) { sizeField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( SizeFormatterFactory.get().format(size, true), TRUNCATE_MIDDLE_ATTRIBUTES)); }
/** * Reload the files in the prompt dialog */ public void reload() { if(log.isDebugEnabled()) { log.debug("Reload table view"); } browserView.reloadData(); browserView.selectRowIndexes(NSIndexSet.indexSetWithIndex(new NSInteger(0L)), false); statusLabel.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( MessageFormat.format(LocaleFactory.localizedString("{0} Files"), String.valueOf(browserView.numberOfRows())), TRUNCATE_MIDDLE_ATTRIBUTES)); }
public void setMessage(final String message) { final String text; if(StringUtils.isBlank(message)) { // Do not display any progress text when transfer is stopped final Date timestamp = transfer.getTimestamp(); if(null != timestamp) { text = UserDateFormatterFactory.get().getLongFormat(timestamp.getTime(), false); } else { text = StringUtils.EMPTY; } } else { text = message; } messageField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( text, TRUNCATE_MIDDLE_ATTRIBUTES)); }
if(StringUtils.isNotBlank(label)) { statusLabel.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes(label, TRUNCATE_MIDDLE_ATTRIBUTES)); statusLabel.setAttributedStringValue( NSAttributedString.attributedStringWithAttributes(MessageFormat.format(LocaleFactory.localizedString("{0} Bookmarks"), bookmarkTable.numberOfRows()), TRUNCATE_MIDDLE_ATTRIBUTES statusLabel.setAttributedStringValue( NSAttributedString.attributedStringWithAttributes(MessageFormat.format(LocaleFactory.localizedString("{0} Files"), String.valueOf(getSelectedBrowserView().numberOfRows())),
@Override public void change(final Host bookmark) { urlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(new HostUrlProvider().withUsername(false).withPath(true).get(bookmark))); } });
browserView.itemAtRow(browserView.selectedRow()))); if(item.local != null) { localURLField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( item.local.getAbsolute(), TRUNCATE_MIDDLE_ATTRIBUTES)); if(item.local.attributes().getSize() == -1) { localSizeField.setAttributedStringValue(UNKNOWN_STRING); localSizeField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( SizeFormatterFactory.get().format(item.local.attributes().getSize()), TRUNCATE_MIDDLE_ATTRIBUTES)); localModificationField.setAttributedStringValue(UNKNOWN_STRING); localModificationField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( UserDateFormatterFactory.get().getLongFormat(item.local.attributes().getModificationDate()), TRUNCATE_MIDDLE_ATTRIBUTES)); remoteURLField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( new DefaultUrlProvider(transfer.getSource()).toUrl(item.remote).find(DescriptiveUrl.Type.provider).getUrl(), TRUNCATE_MIDDLE_ATTRIBUTES)); final TransferStatus status = browserModel.getStatus(item); if(status.getRemote().getSize() == -1) { remoteSizeField.setAttributedStringValue(UNKNOWN_STRING); remoteSizeField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( SizeFormatterFactory.get().format(status.getRemote().getSize()), TRUNCATE_MIDDLE_ATTRIBUTES));
private void updateLabels() { final int selected = transferTable.numberOfSelectedRows().intValue(); if(1 == selected) { final Transfer transfer = transferTableModel.getSource().get(transferTable.selectedRow().intValue()); // Draw text fields at the bottom final String remote = transfer.getRemote().getUrl(); urlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(remote)); final String local = transfer.getLocal(); if(local != null) { localField.setAttributedStringValue( HyperlinkAttributedStringFactory.create(local, LocalFactory.get(local))); } else { localField.setStringValue(StringUtils.EMPTY); } } else { urlField.setStringValue(StringUtils.EMPTY); localField.setStringValue(StringUtils.EMPTY); } }
public void setTextField(NSTextField textField) { this.textField = textField; this.textField.setSelectable(true); if(StringUtils.startsWith(reason, Scheme.http.name())) { // For OAuth2 this.textField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(reason)); this.textField.setAllowsEditingTextAttributes(true); this.textField.setSelectable(true); } else { this.updateField(this.textField, new StringAppender().append(reason).toString()); } } }
private void initWebUrl() { // Web URL if(this.numberOfFiles() > 1) { this.updateField(webUrlField, String.format("(%s)", LocaleFactory.localizedString("Multiple files"))); webUrlField.setToolTip(StringUtils.EMPTY); } else { this.updateField(webUrlField, LocaleFactory.localizedString("Unknown")); final Path file = this.getSelected(); final DescriptiveUrl http = session.getFeature(UrlProvider.class).toUrl(file).find(DescriptiveUrl.Type.http); if(!http.equals(DescriptiveUrl.EMPTY)) { webUrlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(http)); webUrlField.setToolTip(LocaleFactory.localizedString("Open in Web Browser")); } } }
cdn.getName(distribution.getMethod()))); distributionEnableButton.setState(distribution.isEnabled() ? NSCell.NSOnState : NSCell.NSOffState); distributionStatusField.setAttributedStringValue(NSMutableAttributedString.create(distribution.getStatus(), TRUNCATE_MIDDLE_ATTRIBUTES)); distributionAnalyticsButton.setState(credentials != null ? NSCell.NSOnState : NSCell.NSOffState); if(credentials != null) { distributionAnalyticsSetupUrlField.setAttributedStringValue( HyperlinkAttributedStringFactory.create(analyticsFeature.getSetup(cdn.getHostname(), distribution.getMethod().getScheme(), file, credentials)) distributionOriginField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(origin)); final DescriptiveUrl url = cdn.toUrl(file).find(DescriptiveUrl.Type.cdn); if(!url.equals(DescriptiveUrl.EMPTY)) { distributionUrlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(url)); distributionUrlField.setToolTip(LocaleFactory.localizedString("CDN URL")); if(!url.equals(DescriptiveUrl.EMPTY)) { distributionCnameUrlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(url)); distributionCnameUrlField.setToolTip(LocaleFactory.localizedString("CDN URL"));
bucketAnalyticsSetupUrlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create( session.getFeature(AnalyticsProvider.class).getSetup(session.getHost().getProtocol().getDefaultHostname(), session.getHost().getProtocol().getScheme(), file, credentials)
final DescriptiveUrl authenticated = session.getFeature(UrlProvider.class).toUrl(file).find(DescriptiveUrl.Type.authenticated); if(!authenticated.equals(DescriptiveUrl.EMPTY)) { aclUrlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(authenticated)); aclUrlField.setToolTip(authenticated.getHelp());