Package javax.accessibility

Examples of javax.accessibility.AccessibleStateSet


        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            toolkit.lockAWT();
            try {
                AccessibleStateSet set = new AccessibleStateSet();
                if (isEnabled()) {
                    set.add(AccessibleState.ENABLED);
                }
                if (isFocusable()) {
                    set.add(AccessibleState.FOCUSABLE);
                }
                if (hasFocus()) {
                    set.add(AccessibleState.FOCUSED);
                }
                if (isOpaque()) {
                    set.add(AccessibleState.OPAQUE);
                }
                if (isShowing()) {
                    set.add(AccessibleState.SHOWING);
                }
                if (isVisible()) {
                    set.add(AccessibleState.VISIBLE);
                }
                return set;
            } finally {
                toolkit.unlockAWT();
            }
View Full Code Here


    public void testAccessibleJTextField() {
        AccessibleContext accessible = jtf.getAccessibleContext();
        assertTrue(accessible instanceof JTextField.AccessibleJTextField);
        assertEquals(jtf.getAccessibleContext(), accessible);
        JTextField.AccessibleJTextField access = (JTextField.AccessibleJTextField) accessible;
        AccessibleStateSet ass = access.getAccessibleStateSet();
        assertNotSame(ass, access.getAccessibleStateSet());
        assertTrue(ass.contains(AccessibleState.SINGLE_LINE));
        assertFalse(ass.contains(AccessibleState.MULTI_LINE));
    }
View Full Code Here

    public void testGetAccessibleContext() {
        AccessibleContext accessible = jta.getAccessibleContext();
        assertTrue(accessible instanceof JTextArea.AccessibleJTextArea);
        assertEquals(jta.getAccessibleContext(), accessible);
        JTextArea.AccessibleJTextArea access = (JTextArea.AccessibleJTextArea) accessible;
        AccessibleStateSet ass = access.getAccessibleStateSet();
        assertNotSame(ass, access.getAccessibleStateSet());
        assertTrue(ass.contains(AccessibleState.MULTI_LINE));
    }
View Full Code Here

        }
        assertEquals(0, ass.toArray().length);
    }

    public void testGetAccessibleStateSet() throws Exception {
        AccessibleStateSet ass = accessible.getAccessibleStateSet();
        assertTrue(ass.contains(AccessibleState.MULTI_LINE));
        assertTrue(ass.contains(AccessibleState.EDITABLE));
        ass.remove(AccessibleState.MULTI_LINE);
        ass.remove(AccessibleState.EDITABLE);
        checkStateSet(ass);
        jtc.setEditable(false);
        ass = accessible.getAccessibleStateSet();
        assertTrue(ass.contains(AccessibleState.MULTI_LINE));
        ass.remove(AccessibleState.MULTI_LINE);
        checkStateSet(ass);
    }
View Full Code Here

    }

    public void testGetAccessibleStateSet() {
        Component component1 = new JPanel();
        Component component3 = new JDialog();
        AccessibleStateSet stateSet = SwingUtilities.getAccessibleStateSet(component1);
        assertTrue(stateSet.contains(AccessibleState.ENABLED));
        assertTrue(stateSet.contains(AccessibleState.FOCUSABLE));
        assertTrue(stateSet.contains(AccessibleState.VISIBLE));
        assertTrue(stateSet.contains(AccessibleState.OPAQUE));
        assertTrue(stateSet.toArray().length == 4);
        stateSet = SwingUtilities.getAccessibleStateSet(component3);
        assertTrue(stateSet.contains(AccessibleState.ENABLED));
        assertTrue(stateSet.contains(AccessibleState.FOCUSABLE));
        assertTrue(stateSet.contains(AccessibleState.RESIZABLE));
        //        assertTrue(stateSet.toArray().length == 3);
    }
View Full Code Here

        }
        return null;
    }
   
    public static AccessibleStateSet getDefunctStateSet() {
        AccessibleStateSet ass = new AccessibleStateSet();
        ass.add(AccessibleExtendedState.DEFUNCT);
        return ass;
    }
View Full Code Here

        public AccessibleRole getAccessibleRole() {
            return AccessibleRole.PAGE_TAB;
        }

        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet states;
            states = _parent.getAccessibleContext().getAccessibleStateSet();
            states.add(AccessibleState.SELECTABLE);

            int i = _parent.indexOfShade(_button.getText());

            if (i == _parent.getSelectedIndex()) {
                states.add(AccessibleState.SELECTED);
            }

            return states;
        }
View Full Code Here

        }
        return null;
    }
   
    public static AccessibleStateSet getDefunctStateSet() {
        AccessibleStateSet ass = new AccessibleStateSet();
        ass.add(AccessibleExtendedState.DEFUNCT);
        return ass;
    }
View Full Code Here

    public static AccessibleStateSet getAccessibleStateSet(java.awt.Component c,
            XAccessibleStateSet xAccessibleStateSet) {
               
        try {
            if (xAccessibleStateSet != null) {
                AccessibleStateSet as = new AccessibleStateSet();
                short[] unoStateTypes = xAccessibleStateSet.getStates();
                for (int i=0; i<unoStateTypes.length; i++) {
                    if (unoStateTypes[i] > 0 &&
                            unoStateTypes[i] < stateTypeMap.length) {
                        as.add(stateTypeMap[unoStateTypes[i]]);
                    }
                }
           
                // Note: COLLAPSED does not exists in the UAA.
                if (as.contains(AccessibleState.EXPANDABLE) &&
                        ! as.contains(AccessibleState.EXPANDED)) {
                    as.add(AccessibleState.COLLAPSED);
                }
           
                // Sync office and Java FOCUSED state
                boolean isFocusInSync;
                if (c.isFocusOwner()) {
                    isFocusInSync = !as.add(AccessibleState.FOCUSED);
                } else {
                    isFocusInSync = !as.remove(AccessibleState.FOCUSED);
                }
               
                // Sync office and Java ACTIVE state
                boolean isActiveInSync;
                if (c instanceof java.awt.Window && ((java.awt.Window) c).isActive()) {
                    isActiveInSync = !as.add(AccessibleState.ACTIVE);
                } else {
                    isActiveInSync = !as.remove(AccessibleState.ACTIVE);
                }

                // Report out-of-sync messages
                if (!Build.PRODUCT) {
                    if (!isFocusInSync) {
                        printOutOfSyncMessage(AccessibleState.FOCUSED, c, c.isFocusOwner());
                    }
                    if (!isActiveInSync) {
                        printOutOfSyncMessage(AccessibleState.ACTIVE, c, ((java.awt.Window) c).isActive());
                    }
                    if (as.contains(AccessibleState.ENABLED) != c.isEnabled()) {
                        printOutOfSyncMessage(AccessibleState.ENABLED, c, c.isEnabled());
                    }
                    if (as.contains(AccessibleState.FOCUSABLE) != c.isFocusable()) {
                        printOutOfSyncMessage(AccessibleState.FOCUSABLE, c, c.isFocusable());
                    }
                    if (as.contains(AccessibleState.SHOWING) != c.isShowing()) {
                        printOutOfSyncMessage(AccessibleState.SHOWING, c, c.isShowing());
                    }
                    if (as.contains(AccessibleState.VISIBLE) != c.isVisible()) {
                        printOutOfSyncMessage(AccessibleState.VISIBLE, c, c.isVisible());
                    }
               
                    // The following states are for toplevel windows only
                    if (! (c instanceof java.awt.Window)) {
                        if (as.contains(AccessibleState.ACTIVE)) {
                            printToplevelStateMessage(AccessibleState.ACTIVE, c);
                        }
                        if (as.contains(AccessibleState.ICONIFIED)) {
                            printToplevelStateMessage(AccessibleState.ICONIFIED, c);
                        }
                        if (as.contains(AccessibleState.MODAL)) {
                            printToplevelStateMessage(AccessibleState.MODAL, c);
                        }
                    }
                }
                return as;
View Full Code Here

        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            toolkit.lockAWT();
            try {
                AccessibleStateSet set = new AccessibleStateSet();
                if (isEnabled()) {
                    set.add(AccessibleState.ENABLED);
                }
                if (isFocusable()) {
                    set.add(AccessibleState.FOCUSABLE);
                }
                if (hasFocus()) {
                    set.add(AccessibleState.FOCUSED);
                }
                if (isOpaque()) {
                    set.add(AccessibleState.OPAQUE);
                }
                if (isShowing()) {
                    set.add(AccessibleState.SHOWING);
                }
                if (isVisible()) {
                    set.add(AccessibleState.VISIBLE);
                }
                return set;
            } finally {
                toolkit.unlockAWT();
            }
View Full Code Here

TOP

Related Classes of javax.accessibility.AccessibleStateSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.