Skip to content
Closed
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 @@ -31,6 +31,7 @@
@interface ButtonAccessibility : CommonComponentAccessibility <NSAccessibilityButton> {

};
- (nullable NSString *)accessibilityLabel;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (BOOL)accessibilityPerformPress;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
* Implementation of the accessibility peer for the pushbutton role
*/
@implementation ButtonAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityButtonRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
@interface CheckboxAccessibility : ButtonAccessibility <NSAccessibilityCheckBox> {

};
- (id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (id _Nonnull)accessibilityValue;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
* Implementation of the accessibility peer for the checkbox role
*/
@implementation CheckboxAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityCheckBoxRole;
}

- (id) accessibilityValue
- (id _Nonnull) accessibilityValue
{
AWT_ASSERT_APPKIT_THREAD;
return [self accessibilityValueAttribute];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
+ (void) initializeRolesMap;
+ (JavaComponentAccessibility * _Nullable) getComponentAccessibility:(NSString * _Nonnull)role;
- (NSRect)accessibilityFrame;
- (nullable id)accessibilityParent;
- (id _Nullable)accessibilityParent;
- (BOOL)performAccessibleAction:(int)index;
- (BOOL)isAccessibilityElement;
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ + (void) initializeRolesMap {
/*
* Here we should keep all the mapping between the accessibility roles and implementing classes
*/
rolesMap = [[NSMutableDictionary alloc] initWithCapacity:29];
rolesMap = [[NSMutableDictionary alloc] initWithCapacity:37];

[rolesMap setObject:@"ButtonAccessibility" forKey:@"pushbutton"];
[rolesMap setObject:@"ImageAccessibility" forKey:@"icon"];
Expand All @@ -61,6 +61,14 @@ + (void) initializeRolesMap {
// [rolesMap setObject:@"SliderAccessibility" forKey:@"slider"];
[rolesMap setObject:@"ScrollAreaAccessibility" forKey:@"scrollpane"];
[rolesMap setObject:@"ScrollBarAccessibility" forKey:@"scrollbar"];
[rolesMap setObject:@"GroupAccessibility" forKey:@"awtcomponent"];
[rolesMap setObject:@"GroupAccessibility" forKey:@"canvas"];
[rolesMap setObject:@"GroupAccessibility" forKey:@"groupbox"];
[rolesMap setObject:@"GroupAccessibility" forKey:@"internalframe"];
[rolesMap setObject:@"GroupAccessibility" forKey:@"swingcomponent"];
[rolesMap setObject:@"ToolbarAccessibility" forKey:@"toolbar"];
[rolesMap setObject:@"SplitpaneAccessibility" forKey:@"splitpane"];
[rolesMap setObject:@"StatusbarAccessibility" forKey:@"statusbar"];

/*
* All the components below should be ignored by the accessibility subsystem,
Expand Down Expand Up @@ -158,7 +166,7 @@ - (NSRect)accessibilityFrame
return NSMakeRect(point.x, point.y, size.width, size.height);
}

- (nullable id)accessibilityParent
- (id _Nullable)accessibilityParent
{
return [self accessibilityParentAttribute];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
@interface CommonTextAccessibility : CommonComponentAccessibility {

}
- (nullable NSString *)accessibilityValueAttribute;
- (NSString * _Nullable)accessibilityValueAttribute;
- (NSRange)accessibilityVisibleCharacterRangeAttribute;
- (nullable NSString *)accessibilityStringForRangeAttribute:(NSRange)parameter;
- (NSString * _Nullable)accessibilityStringForRangeAttribute:(NSRange)parameter;
@end

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#import "JavaComponentAccessibility.h"
#import "CommonComponentAccessibility.h"

#import <AppKit/AppKit.h>

@interface GroupAccessibility : CommonComponentAccessibility <NSAccessibilityGroup> {

};
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSArray * _Nullable)accessibilityChildren;
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#import "GroupAccessibility.h"
#import "JNIUtilities.h"
#import "ThreadUtilities.h"
/*
* This is the protocol for the components that contain children.
* Basic logic of accessibilityChildren might be overridden in the specific implementing
* classes reflecting the logic of the class.
*/
@implementation GroupAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityGroupRole;
}

/*
* Return all non-ignored children.
*/
- (NSArray *)accessibilityChildren {
JNIEnv *env = [ThreadUtilities getJNIEnv];

NSArray *children = [JavaComponentAccessibility childrenOfParent:self
withEnv:env
withChildrenCode:JAVA_AX_ALL_CHILDREN
allowIgnored:NO];

if ([children count] == 0) {
return nil;
} else {
return children;
}
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
@interface ImageAccessibility : CommonComponentAccessibility <NSAccessibilityImage> {

};
- (nullable NSString *)accessibilityLabel;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
* Implementation of the accessibility peer for the icon role
*/
@implementation ImageAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityImageRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
@interface RadiobuttonAccessibility : ButtonAccessibility <NSAccessibilityRadioButton> {

};
- (id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (id _Nonnull)accessibilityValue;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
* Implementation of the accessibility peer for the radiobutton role
*/
@implementation RadiobuttonAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityRadioButtonRole;
}

- (id) accessibilityValue
- (id _Nonnull) accessibilityValue
{
AWT_ASSERT_APPKIT_THREAD;
return [self accessibilityValueAttribute];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@interface ScrollAreaAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSArray * _Nullable)accessibilityContents;
- (id _Nullable)accessibilityHorizontalScrollBar;
- (id _Nullable)accessibilityVerticalScrollBar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ - (id _Nullable)getScrollBarwithOrientation:(enum NSAccessibilityOrientation)ori
return nil;
}

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityScrollAreaRole;
}

- (NSArray * _Nullable)accessibilityContents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
@interface ScrollBarAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSAccessibilityOrientation) accessibilityOrientation;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
*/
@implementation ScrollBarAccessibility

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityScrollBarRole;
}

- (NSAccessibilityOrientation) accessibilityOrientation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#import "JavaComponentAccessibility.h"
#import "CommonComponentAccessibility.h"

#import <AppKit/AppKit.h>

@interface SliderAccessibility : CommonComponentAccessibility <NSAccessibilitySlider> {

};
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (id _Nullable)accessibilityValue;
- (BOOL)accessibilityPerformDecrement;
- (BOOL)accessibilityPerformIncrement;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
@interface SpinboxAccessibility : CommonComponentAccessibility <NSAccessibilityStepper> {

};

- (nullable NSString *)accessibilityLabel;
- (nullable id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (id _Nullable)accessibilityValue;
- (BOOL)accessibilityPerformDecrement;
- (BOOL)accessibilityPerformIncrement;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@
* Implementation of the accessibility peer for the spinner role
*/
@implementation SpinboxAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityIncrementorRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}

- (nullable id)accessibilityValue
- (id _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#import "JavaComponentAccessibility.h"
#import "GroupAccessibility.h"

#import <AppKit/AppKit.h>

@interface SplitpaneAccessibility : GroupAccessibility {

};
- (NSAccessibilityRole _Nonnull)accessibilityRole;
@end
Loading