Skip to content

Commit 2730768

Browse files
committed
8359257: Create accessibility protocol for TabGroup component
Create implementation of the TabGroup protocol and assign it to TAB_PANE and PAGINATION roles.
1 parent 11f3114 commit 2730768

3 files changed

Lines changed: 113 additions & 2 deletions

File tree

modules/javafx.graphics/src/main/native-glass/mac/a11y/AccessibleBase.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ + (void) initializeRolesMap {
4040
* All JavaFX roles and corresponding available properties are defined in
4141
* enum javafx.scene.AccessibleRole
4242
*/
43-
rolesMap = [[NSMutableDictionary alloc] initWithCapacity:14];
43+
rolesMap = [[NSMutableDictionary alloc] initWithCapacity:16];
4444

4545
[rolesMap setObject:@"JFXButtonAccessibility" forKey:@"BUTTON"];
4646
[rolesMap setObject:@"JFXButtonAccessibility" forKey:@"DECREMENT_BUTTON"];
@@ -58,6 +58,8 @@ + (void) initializeRolesMap {
5858
[rolesMap setObject:@"JFXProgressIndicatorAccessibility" forKey:@"PROGRESS_INDICATOR"];
5959
[rolesMap setObject:@"JFXImageAccessibility" forKey:@"IMAGE"];
6060
[rolesMap setObject:@"JFXImageAccessibility" forKey:@"IMAGE_VIEW"];
61+
[rolesMap setObject:@"JFXTabGroupAccessibility" forKey:@"TAB_PANE"];
62+
[rolesMap setObject:@"JFXTabGroupAccessibility" forKey:@"PAGINATION"];
6163

6264
}
6365

@@ -175,7 +177,16 @@ - (id)accessibilityTitleUIElement
175177
return variantToID(env, jresult);
176178
}
177179

178-
180+
- (NSArray *)accessibilityChildren
181+
{
182+
jobject jresult = NULL;
183+
GET_MAIN_JENV;
184+
if (env == NULL) return NULL;
185+
jresult = (jobject)(*env)->CallLongMethod(env, self->jAccessible,
186+
jAccessibilityAttributeValue, (jlong)@"AXChildren");
187+
GLASS_CHECK_EXCEPTION(env);
188+
return variantToID(env, jresult);
189+
}
179190

180191
// Actions support
181192
- (BOOL)performAccessibleAction:(NSString *)action
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
27+
#import "AccessibleBase.h"
28+
#import <AppKit/NSAccessibility.h>
29+
30+
@interface JFXTabGroupAccessibility : AccessibleBase {
31+
};
32+
33+
- (NSAccessibilityRole)accessibilityRole;
34+
- (NSRect)accessibilityFrame;
35+
- (id)accessibilityParent;
36+
- (NSArray *)accessibilityTabs;
37+
@end
38+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
#import "JFXTabGroupAccessibility.h"
27+
#import "GlassMacros.h"
28+
#import "GlassAccessible.h"
29+
30+
@implementation JFXTabGroupAccessibility
31+
- (NSAccessibilityRole)accessibilityRole
32+
{
33+
return NSAccessibilityTabGroupRole;
34+
}
35+
36+
- (NSArray *)accessibilityChildren
37+
{
38+
return [super accessibilityChildren];
39+
}
40+
41+
- (NSRect)accessibilityFrame
42+
{
43+
return [super accessibilityFrame];
44+
}
45+
46+
- (id)accessibilityParent
47+
{
48+
return [super accessibilityParent];
49+
}
50+
51+
- (NSArray *)accessibilityTabs
52+
{
53+
jobject jresult = NULL;
54+
GET_MAIN_JENV;
55+
if (env == NULL) return NULL;
56+
jresult = (jobject)(*env)->CallLongMethod(env, [self getJAccessible],
57+
jAccessibilityAttributeValue, (jlong)@"AXTabs");
58+
GLASS_CHECK_EXCEPTION(env);
59+
return variantToID(env, jresult);
60+
}
61+
62+
@end

0 commit comments

Comments
 (0)