Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #16247. #16283

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import ch.cyberduck.binding.application.NSOutlineView;
import ch.cyberduck.binding.application.NSTableColumn;
import ch.cyberduck.binding.application.NSTableView;
import ch.cyberduck.binding.application.NSTextFieldCell;
import ch.cyberduck.binding.foundation.NSNotification;
import ch.cyberduck.binding.foundation.NSObject;
import ch.cyberduck.core.NullComparator;
Expand Down Expand Up @@ -92,13 +91,13 @@ public boolean outlineView_shouldEditTableColumn_item(final NSOutlineView view,
/**
* @see NSOutlineView.Delegate
*/
public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView view, final NSTextFieldCell cell, final NSTableColumn tableColumn, final NSObject item) {
public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView view, final NSCell cell, final NSTableColumn tableColumn, final NSObject item) {
}

/**
* @see NSTableView.Delegate
*/
public void tableView_willDisplayCell_forTableColumn_row(NSTableView view, NSTextFieldCell cell, NSTableColumn c, NSInteger row) {
public void tableView_willDisplayCell_forTableColumn_row(final NSTableView view, final NSCell cell, final NSTableColumn c, final NSInteger row) {
}

public boolean selectionShouldChange() {
Expand Down Expand Up @@ -215,12 +214,12 @@ public boolean isSortedAscending() {
}

public boolean tableView_shouldTypeSelectForEvent_withCurrentSearchString(
final NSTableView view, final NSEvent event, final String searchString) {
final NSTableView view, final NSEvent event, final String searchString) {
return this.isTypeSelectSupported();
}

public boolean outlineView_shouldTypeSelectForEvent_withCurrentSearchString(
final NSOutlineView view, final NSEvent event, final String searchString) {
final NSOutlineView view, final NSEvent event, final String searchString) {
return this.isTypeSelectSupported();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package ch.cyberduck.binding.application;

/*
* Copyright (c) 2002-2024 iterate GmbH. All rights reserved.
* https://cyberduck.io/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

public interface NSAccessibility {

/**
* The title of the accessibility element—for example, a button’s visible text.
*
* @param title
* @since macOS 10.10+
*/
void setAccessibilityTitle(String title);

/**
* Use this property only when the results of activating this element are not obvious from the element’s label.
* This string functions as a tooltip. For example, VoiceOver reads this string when you pause over a control.
* To help ensure that accessibility clients like VoiceOver read the help text with the proper inflection, begin
* this string with a verb, capitalize the first letter, and end the string with a period. Always localize this
* string. The default value is nil.
*
* @param help The help text for the accessibility element.
*/
void setAccessibilityHelp(String help);

/**
* Do not include the accessibility element’s type in the label (for example, write Play, not Play button.).
* If possible, use a single word. To help ensure that accessibility clients such as VoiceOver read the label
* with the correct intonation, start this label with a capital letter. Do not put a period at the end.
* Always localize the label.
*
* @param label A short description of the accessibility element.
* @since macOS 10.10+
*/
void setAccessibilityLabel(String label);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.rococoa.cocoa.foundation.NSSize;
import org.rococoa.cocoa.foundation.NSUInteger;

public abstract class NSCell extends NSObject implements NSCopying {
public abstract class NSCell extends NSObject implements NSCopying, NSAccessibility {

/// <i>native declaration : :11</i>
public static final int NSAnyType = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void outlineView_setObjectValue_forTableColumn_byItem(NSOutlineView outlineView,
}

public interface Delegate {
void outlineView_willDisplayCell_forTableColumn_item(NSOutlineView view, NSTextFieldCell cell, NSTableColumn tableColumn, NSObject item);
void outlineView_willDisplayCell_forTableColumn_item(NSOutlineView view, NSCell cell, NSTableColumn tableColumn, NSObject item);

boolean outlineView_shouldExpandItem(NSOutlineView view, NSObject item);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public interface DataSource {
}

public interface Delegate {
void tableView_willDisplayCell_forTableColumn_row(NSTableView view, NSTextFieldCell cell, NSTableColumn tableColumn, NSInteger row);
void tableView_willDisplayCell_forTableColumn_row(NSTableView view, NSCell cell, NSTableColumn tableColumn, NSInteger row);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ public void enterKeyPressed(final ID sender) {
* @see NSOutlineView.Delegate
*/
@Override
public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView view, final NSTextFieldCell cell, final NSTableColumn tableColumn, final NSObject item) {
public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView view, final NSCell cell, final NSTableColumn tableColumn, final NSObject item) {
if(null == item) {
return;
}
Expand All @@ -1153,10 +1153,10 @@ public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView
(Rococoa.cast(cell, OutlineCell.class)).setIcon(browserOutlineModel.iconForPath(file));
}
if(!BrowserController.this.isConnected() || !SearchFilterFactory.HIDDEN_FILTER.accept(file)) {
cell.setTextColor(NSColor.disabledControlTextColor());
Rococoa.cast(cell, NSTextFieldCell.class).setTextColor(NSColor.disabledControlTextColor());
}
else {
cell.setTextColor(NSColor.controlTextColor());
Rococoa.cast(cell, NSTextFieldCell.class).setTextColor(NSColor.controlTextColor());
}
}

Expand Down Expand Up @@ -1299,14 +1299,14 @@ public void enterKeyPressed(final ID sender) {
}

@Override
public void tableView_willDisplayCell_forTableColumn_row(final NSTableView view, final NSTextFieldCell cell, final NSTableColumn tableColumn, final NSInteger row) {
public void tableView_willDisplayCell_forTableColumn_row(final NSTableView view, final NSCell cell, final NSTableColumn tableColumn, final NSInteger row) {
final Path file = browserListModel.get(workdir).get(row.intValue());
if(cell.isKindOfClass(Foundation.getClass(NSTextFieldCell.class.getSimpleName()))) {
if(!BrowserController.this.isConnected() || !SearchFilterFactory.HIDDEN_FILTER.accept(file)) {
cell.setTextColor(NSColor.disabledControlTextColor());
Rococoa.cast(cell, NSTextFieldCell.class).setTextColor(NSColor.disabledControlTextColor());
}
else {
cell.setTextColor(NSColor.controlTextColor());
Rococoa.cast(cell, NSTextFieldCell.class).setTextColor(NSColor.controlTextColor());
}
}
}
Expand Down Expand Up @@ -1674,6 +1674,41 @@ else if(event.deltaY().doubleValue() == kSwipeGestureDown) {
NSIndexSet.indexSetWithIndex(next), false);
}
}

@Override
public void tableView_willDisplayCell_forTableColumn_row(final NSTableView view, final NSCell cell, final NSTableColumn c, final NSInteger row) {
cell.setAccessibilityLabel(LocaleFactory.localizedString("Connect to server"));
if(c.identifier().equals(BookmarkColumn.icon.name())) {
cell.setAccessibilityTitle(bookmarkModel.getSource().get(row.intValue()).getProtocol().getName());
}
if(c.identifier().equals(BookmarkColumn.bookmark.name())) {
cell.setAccessibilityTitle(BookmarkNameProvider.toString(bookmarkModel.getSource().get(row.intValue())));
}
if(c.identifier().equals(BookmarkColumn.status.name())) {
final Host host = bookmarkModel.getSource().get(row.intValue());
if(host.equals(pool.getHost())) {
switch(pool.getState()) {
case open:
cell.setAccessibilityTitle(LocaleFactory.localizedString("Idle", "Status"));
break;
case closed:
cell.setAccessibilityTitle(LocaleFactory.localizedString("Disconnected", "Status"));
break;
case opening:
cell.setAccessibilityTitle(MessageFormat.format(LocaleFactory.localizedString("Mounting {0}", "Status"),
BookmarkNameProvider.toString(host)));
break;
case closing:
cell.setAccessibilityTitle(MessageFormat.format(LocaleFactory.localizedString("Disconnecting {0}", "Status"),
BookmarkNameProvider.toString(host)));
break;
}
}
else {
cell.setAccessibilityTitle(LocaleFactory.localizedString("Disconnected", "Status"));
}
}
}
}).id());
// receive drag events from types
bookmarkTable.registerForDraggedTypes(NSArray.arrayWithObjects(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,7 @@ protected boolean isTypeSelectSupported() {
return false;
}

public void tableView_willDisplayCell_forTableColumn_row(NSTableView view, NSTextFieldCell cell,
NSTableColumn c, NSInteger row) {
public void tableView_willDisplayCell_forTableColumn_row(final NSTableView view, final NSTextFieldCell cell, final NSTableColumn c, final NSInteger row) {
if(c.identifier().equals(MetadataColumn.VALUE.name())) {
final String value = metadata.get(row.intValue()).getValue();
if(null == value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public String tooltip(final Protocol item, final Void unused) {
}

@Override
public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView view, final NSTextFieldCell cell, final NSTableColumn tableColumn, final NSObject item) {
public void outlineView_willDisplayCell_forTableColumn_item(final NSOutlineView view, final NSCell cell, final NSTableColumn tableColumn, final NSObject item) {
//
}

Expand Down