Package javax.accessibility

Examples of javax.accessibility.AccessibleStateSet


        }
        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

    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

            return getContentType();
        }

        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet set = super.getAccessibleStateSet();
            set.add(AccessibleState.MULTI_LINE);
            return set;
        }
View Full Code Here

            return null;
        }

        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet stateSet = super.getAccessibleStateSet();
            if (isShowing()) {
                stateSet.add(AccessibleState.SHOWING);
            }
            return stateSet;
        }
View Full Code Here

        public Number getMaximumAccessibleValue() {
            return new Integer(model.getMaximum());
        }

        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet stateSet = super.getAccessibleStateSet();
            if (orientation == JProgressBar.HORIZONTAL) {
                stateSet.add(AccessibleState.HORIZONTAL);
            } else {
                stateSet.add(AccessibleState.VERTICAL);
            }
            return stateSet;
        }
View Full Code Here

        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            toolkit.lockAWT();
            try {
                AccessibleStateSet set = super.getAccessibleStateSet();
                if (isFocused()) {
                    set.add(AccessibleState.ACTIVE);
                }
                if (isResizable()) {
                    set.add(AccessibleState.RESIZABLE);
                }
                return set;
            } finally {
                toolkit.unlockAWT();
            }
View Full Code Here

            return AccessibleRole.FRAME;
        }
       
        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet set = super.getAccessibleStateSet();
            Window owner = null;
            for (Component c = Applet.this; c != null; c = c.getParent()) {
                if (c instanceof Window) {
                    owner = (Window)c;
                    break;
                }
            }
           
            if (owner != null) {
                if (owner.isActive()) {
                    set.add(AccessibleState.ACTIVE);
                }
            }
            return set;
        }
View Full Code Here

            JTextComponent.AccessibleJTextComponent {
        /**
         * Adds state AccessibleState.MULTI_LINE to super class states
         */
        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet ass = super.getAccessibleStateSet();
            ass.add(AccessibleState.MULTI_LINE);
            return ass;
        }
View Full Code Here

            return AccessibleRole.CHECK_BOX;
        }

        @Override
        public AccessibleStateSet getAccessibleStateSet() {
            AccessibleStateSet aStateSet = super.getAccessibleStateSet();
            if (getState()) {
                aStateSet.add(AccessibleState.CHECKED);
            }
            return aStateSet;
        }
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.