@Override public void run() { progressField.setAttributedStringValue(NSAttributedString.attributedStringWithAttributes( message, TRUNCATE_MIDDLE_ATTRIBUTES)); } });
protected void updateField(final NSTextField f, final String value) { if(null == f) { return; } f.setStringValue(StringUtils.isNotBlank(value) ? value : StringUtils.EMPTY); }
public static NSTextField textfieldWithFrame(NSRect frameRect) { return CLASS.alloc().initWithFrame(frameRect); }
public void setLocalField(NSTextField localField) { this.localField = localField; this.localField.setAllowsEditingTextAttributes(true); this.localField.setSelectable(true); }
public void setMessageField(final NSTextField f) { this.messageField = f; this.messageField.setEditable(false); this.messageField.setSelectable(false); this.messageField.setTextColor(NSColor.controlTextColor()); }
public void setProgressField(final NSTextField f) { this.progressField = f; this.progressField.setEditable(false); this.progressField.setSelectable(false); this.progressField.setTextColor(NSColor.controlTextColor()); this.progressField.setFont(NSFont.monospacedDigitSystemFontOfSize(NSFont.smallSystemFontSize())); }
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); } }
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)); distributionUrlField.setStringValue(String.format("(%s)", LocaleFactory.localizedString("Multiple files"))); distributionUrlField.setToolTip(StringUtils.EMPTY); distributionCnameUrlField.setStringValue(String.format("(%s)", LocaleFactory.localizedString("Multiple files"))); distributionUrlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(url)); distributionUrlField.setToolTip(LocaleFactory.localizedString("CDN URL")); distributionUrlField.setStringValue(LocaleFactory.localizedString("None")); distributionUrlField.setToolTip(StringUtils.EMPTY); distributionCnameField.setStringValue(StringUtils.EMPTY); distributionCnameUrlField.setStringValue(StringUtils.EMPTY); distributionCnameUrlField.setToolTip(StringUtils.EMPTY); distributionCnameField.setStringValue(StringUtils.join(cnames, ' ')); final DescriptiveUrl url = cdn.toUrl(file).find(DescriptiveUrl.Type.cname); if(!url.equals(DescriptiveUrl.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 initGeneral() { final int count = this.numberOfFiles(); if(count > 0) { filenameField.setStringValue(this.getName()); final Path file = this.getSelected(); filenameField.setEnabled(1 == count && session.getFeature(Move.class).isSupported(file, file)); pathField.setToolTip(path); if(count > 1) { kindField.setStringValue(String.format("(%s)", LocaleFactory.localizedString("Multiple files"))); checksumField.setStringValue(String.format("(%s)", LocaleFactory.localizedString("Multiple files"))); modifiedField.setStringValue(String.format("(%s)", LocaleFactory.localizedString("Multiple files"))); createdField.setStringValue(String.format("(%s)", LocaleFactory.localizedString("Multiple files")));
@Override public void change(final Host bookmark) { updateField(usernameField, credentials.getUsername()); usernameField.cell().setPlaceholderString(bookmark.getProtocol().getUsernamePlaceholder()); usernameField.setEnabled(options.user && !credentials.isAnonymousLogin()); } });
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")); } } }
distributionStatusField.setStringValue(LocaleFactory.localizedString("Unknown")); distributionCnameField.cell().setPlaceholderString(LocaleFactory.localizedString("None")); distributionOriginField.setStringValue(LocaleFactory.localizedString("Unknown")); distributionUrlField.setStringValue(LocaleFactory.localizedString("Unknown")); distributionInvalidationStatusField.setStringValue(LocaleFactory.localizedString("None")); distributionLoggingPopup.itemWithTitle(LocaleFactory.localizedString("None")).setEnabled(false); distributionAnalyticsSetupUrlField.setStringValue(LocaleFactory.localizedString("None"));
public void setDistributionCnameField(NSTextField t) { this.distributionCnameField = t; notificationCenter.addObserver(this.id(), Foundation.selector("distributionApplyButtonClicked:"), NSControl.NSControlTextDidEndEditingNotification, t.id()); }
public void setWebURLField(final NSTextField field) { this.webURLField = field; final NSTextFieldCell cell = this.webURLField.cell(); notificationCenter.addObserver(this.id(), Foundation.selector("webURLInputDidChange:"), NSControl.NSControlTextDidChangeNotification, field.id()); this.addObserver(new BookmarkObserver() { @Override public void change(Host bookmark) { updateField(webURLField, bookmark.getWebURL()); cell.setPlaceholderString(new WebUrlProvider(bookmark).toUrl().getUrl()); } }); }
@Override public void loadBundle(final NSAlert alert) { this.inputField = NSTextField.textfieldWithFrame(new NSRect(alert.window().frame().size.width.doubleValue(), 22)); this.inputField.cell().setPlaceholderString(alert.informativeText()); super.loadBundle(alert); }
@Override public void change(final Host bookmark) { updateField(portField, String.valueOf(bookmark.getPort())); portField.setEnabled(bookmark.getProtocol().isPortConfigurable()); } });
@Override protected void focus(final NSAlert alert) { super.focus(alert); this.updateField(urlField, url); urlField.selectText(null); }
public void setFilenameField(NSTextField filenameField) { this.filenameField = filenameField; this.filenameField.setEditable(false); }
@Action public void setStatusLabel(NSTextField statusLabel) { this.statusLabel = statusLabel; this.statusLabel.setFont(NSFont.monospacedDigitSystemFontOfSize(NSFont.smallSystemFontSize())); }