Package javax.accessibility

Examples of javax.accessibility.AccessibleStateSet


            return getContentType();
        }

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

        }
        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

    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
    harness.check(events.size(), 0);
    harness.check(!b);
   
    // check the state settings...
    AccessibleStateSet set = ac.getAccessibleStateSet();
    harness.check(set.contains(AccessibleState.ENABLED));
    harness.check(set.contains(AccessibleState.FOCUSABLE));
    harness.check(set.contains(AccessibleState.VISIBLE));
    harness.check(set.contains(AccessibleState.OPAQUE));
    harness.check(set.contains(AccessibleState.HORIZONTAL));
   
    // each call creates a new set...
    AccessibleStateSet set2 = ac.getAccessibleStateSet();
    harness.check(set != set2);
   
    // check the orientation state setting...
    scrollBar.setOrientation(JSlider.VERTICAL);
    set = ac.getAccessibleStateSet();
View Full Code Here

    harness.check(child.isVisible(), true);

    // The only thing left is that isVisible depends on the values
    // of JList.getFirstVisibleIndex and JList.getLastVisibleIndex
    AccessibleContext ctx = (AccessibleContext) child;
    AccessibleStateSet states;
    l.first = 0;
    l.last = 0;
    harness.check(child.isVisible(), true);
    states = ctx.getAccessibleStateSet();
    harness.check(states.contains(AccessibleState.VISIBLE));
    l.first = 1;
    l.last = 1;
    harness.check(child.isVisible(), false);
    states = ctx.getAccessibleStateSet();
    harness.check(!states.contains(AccessibleState.VISIBLE));
  }
View Full Code Here

    MyTestList l = new MyTestList(new String[]{"item"});
    TestList.AccessibleTestList al =
      (TestList.AccessibleTestList) l.getAccessibleContext();
    AccessibleComponent child = (AccessibleComponent) al.getAccessibleChild(0);
    AccessibleContext ctx = (AccessibleContext) child;
    AccessibleStateSet states;
    l.first = 0;
    l.last = 0;
    l.showing = true;
    harness.check(child.isShowing(), true);
    states = ctx.getAccessibleStateSet();
    harness.check(states.contains(AccessibleState.SHOWING));
    l.showing = false;
    harness.check(child.isShowing(), false);
    states = ctx.getAccessibleStateSet();
    harness.check(!states.contains(AccessibleState.SHOWING));

    // Make list child invisible. Should make isShowing false in all cases.
    l.first = 1;
    l.last = 1;
    l.showing = true;
    harness.check(child.isShowing(), false);
    states = ctx.getAccessibleStateSet();
    harness.check(!states.contains(AccessibleState.SHOWING));
    l.showing = false;
    harness.check(child.isShowing(), false);
    states = ctx.getAccessibleStateSet();
    harness.check(!states.contains(AccessibleState.SHOWING));
  }
View Full Code Here

    TestList l = new TestList(new String[]{"item"});
    TestList.AccessibleTestList al =
      (TestList.AccessibleTestList) l.getAccessibleContext();
    AccessibleContext child = (AccessibleContext) al.getAccessibleChild(0);
    AccessibleComponent childC = (AccessibleComponent) child;
    AccessibleStateSet states;
    // We test the visible state in isVisible.
    // We test the showing state in isShowing.
    states = child.getAccessibleStateSet();
    harness.check(states.contains(AccessibleState.TRANSIENT));
  }
View Full Code Here

    harness.check(av.getCurrentAccessibleValue(), new Integer(90));
    harness.check(events.size(), 0);
    harness.check(!b);
   
    // check the state settings...
    AccessibleStateSet set = ac.getAccessibleStateSet();
    harness.check(set.contains(AccessibleState.ENABLED));
    harness.check(set.contains(AccessibleState.FOCUSABLE));
    harness.check(set.contains(AccessibleState.VISIBLE));
    harness.check(set.contains(AccessibleState.OPAQUE));
    harness.check(set.contains(AccessibleState.HORIZONTAL));
   
    // each call creates a new set...
    AccessibleStateSet set2 = ac.getAccessibleStateSet();
    harness.check(set != set2);
   
    // check the orientation state setting...
    progressBar.setOrientation(JSlider.VERTICAL);
    set = ac.getAccessibleStateSet();
View Full Code Here

    TestList l = new TestList();
    TestList.AccessibleTestList al =
      (TestList.AccessibleTestList) l.getAccessibleContext();

    l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    AccessibleStateSet ss = al.getAccessibleStateSet();
    harness.check(ss.contains(AccessibleState.MULTISELECTABLE));

    l.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    ss = al.getAccessibleStateSet();
    harness.check(ss.contains(AccessibleState.MULTISELECTABLE));

    l.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ss = al.getAccessibleStateSet();
    harness.check(! ss.contains(AccessibleState.MULTISELECTABLE));
  }
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.