Package net.rim.device.api.ui.accessibility

Examples of net.rim.device.api.ui.accessibility.AccessibleContext


                    AccessibleState.ACTIVE)) {
                // Dialog became active, read it.
                Util.speak("New dialog opened " + context.getAccessibleName());

                for (int i = 0; i < context.getAccessibleChildCount(); i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    ChildReader.readChildElement(child);
                }
            }
        }
View Full Code Here


                // Read a maximum of 10 items.
                final int maxRead = Math.min(10, childCount);

                for (int i = 0; i < maxRead; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    if (child != null) {
                        final int childState = child.getAccessibleStateSet();
                        final boolean childSelected =
                                (childState & AccessibleState.SELECTED) != 0;
                        Util.speak(child.getAccessibleName()
                                + (childSelected ? " selected" : ""));
                    }
                }
            } else if (Util.hasTransitionedToState(oldValue, newValue,
                    AccessibleState.COLLAPSED)) {
                Util.speak("Choice field " + name + " collapsed ");
                final AccessibleContext child =
                        context.getAccessibleSelectionAt(0);
                if (child != null) {
                    Util.speak(child.getAccessibleName() + " selected");
                }
            } else if (Util.hasTransitionedToState(oldValue, newValue,
                    AccessibleState.FOCUSED)) {
                Util.speak("Choice field " + name + " focused");
                final AccessibleContext child =
                        context.getAccessibleSelectionAt(0);
                if (child != null) {
                    Util.speak("Current value " + child.getAccessibleName());
                }
            } else if (Util.hasTransitionedToState(oldValue, newValue,
                    AccessibleState.MOUSE_OVER)) {
                Util.speak("Mouse over choice field " + name);
            }
            break;

        case AccessibleContext.ACCESSIBLE_SELECTION_CHANGED:
            final AccessibleContext child = context.getAccessibleSelectionAt(0);
            if (child != null) {
                Util.speak(child.getAccessibleName() + " selected");
            }
            break;
        }
    }
View Full Code Here

            }
            break;

        case AccessibleContext.ACCESSIBLE_CHILD_CHANGED:
            // New values in the combo box drop-down list.
            final AccessibleContext comboDropDownList =
                    context.getAccessibleChildAt(1);
            final int childCount =
                    comboDropDownList != null ? comboDropDownList
                            .getAccessibleChildCount() : 0;
            final int maxCount = Math.min(childCount, 10);
            Util.speak("combo box " + name + " drop down values changed");

            for (int i = 0; i < maxCount; i++) {
                final AccessibleContext child =
                        comboDropDownList.getAccessibleChildAt(i);
                ChildReader.readChildElement(child);
            }
            break;
        }
View Full Code Here

            }

            Util.speak("One cell selected column " + colCaption + " row "
                    + rowCaption);

            final AccessibleContext cell = table.getAccessibleAt(row, col);
            if (cell != null) {
                ChildReader.readChildElement(cell);
            } else {
                Util.speak("cell empty");
            }

        } else if (selectedColumns.length == 1) {
            // Multiple rows in one cell selected.
            final int col = selectedColumns[0];
            final int rowCount = selectedRows.length;

            String startRowCaption =
                    tableRows != null ? tableRows[selectedRows[0]]
                            .getAccessibleName() : "" + (selectedRows[0] + 1);
            final String endRowCaption =
                    tableRows != null ? tableRows[selectedRows[rowCount - 1]]
                            .getAccessibleName() : ""
                            + (selectedRows[rowCount - 1] + 1);
            String colCaption =
                    tableColumns != null ? tableColumns[col]
                            .getAccessibleName() : "column " + (col + 1);

            if (startRowCaption == null) {
                startRowCaption = "" + (selectedRows[0] + 1);
            }
            if (colCaption == null) {
                colCaption = "" + (selectedRows[rowCount - 1] + 1);
            }

            Util.speak(rowCount + " cells selected in column " + colCaption);
            Util.speak("start row " + startRowCaption + " end row "
                    + endRowCaption);

            boolean cellFilled = false;
            for (int i = 0; i < selectedRows.length; i++) {
                final AccessibleContext selected =
                        table.getAccessibleAt(selectedRows[i], col);
                if (selected != null) {
                    ChildReader.readChildElement(selected);
                    cellFilled = true;
                }
View Full Code Here

                Util.speak(orientation + " menu opened total " + childCount
                        + " items");

                final int readMax = Math.min(10, childCount);
                for (int i = 0; i < readMax; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    ChildReader.readChildElement(child);
                }
            } else if (Util.hasTransitionedFromState(oldValue, newValue,
                    AccessibleState.ACTIVE)) {
View Full Code Here

        }

        if (selectedCount == 0) {
            Util.speak("no elements selected");
        } else if (selectedCount == 1) {
            final AccessibleContext selectedChild =
                    list.getAccessibleSelectionAt(0);
            if (selectedChild == null) {
                Util.speak("null Selection! in the list " + name);
            } else {
                Util.speak(selectedChild.getAccessibleName()
                        + " selected in the list " + name);
            }
        } else {
            Util.speak(selectedCount + " rows selected");
View Full Code Here

                ++index;
                break;
            }
        }

        final AccessibleContext item = context.getAccessibleSelectionAt(0);
        final String output =
                "Symbol: " + item.getAccessibleName() + ". " + index
                        + " out of " + count;
        Util.speak(output);
    }
View Full Code Here

     */
    static void handleTreeField(final int event, final int oldValue,
            final int newValue, final AccessibleContext context) {
        switch (event) {
        case AccessibleContext.ACCESSIBLE_SELECTION_CHANGED:
            final AccessibleContext selectedChild =
                    context.getAccessibleSelectionAt(0);
            String name = selectedChild.getAccessibleName();
            if (name == null) {
                name = "";
            }

            final int states = selectedChild.getAccessibleStateSet();
            final String expandableText =
                    (states & AccessibleState.EXPANDABLE) != 0 ? " expandable"
                            : "";
            Util.speak(name + " node selected" + expandableText);
            break;

        case AccessibleContext.ACCESSIBLE_STATE_CHANGED:
            AccessibleContext item = null;
            final int count = context.getAccessibleChildCount();

            if (count != 0) {
                item = context.getAccessibleSelectionAt(0);
                if (item != null) {
                    String name2 = item.getAccessibleName();
                    if (name2 == null) {
                        name2 = "";
                    }
                    if (Util.hasTransitionedToState(oldValue, newValue,
                            AccessibleState.EXPANDED)) {
View Full Code Here

            if (busy) {
                Util.speak("Screen " + name + " loading");
            } else {
                Util.speak("Screen " + name);
                for (int i = 0; i < childCount; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    readChildElement(child);
                }
            }
            break;

        case AccessibleRole.TEXT_FIELD:
            if (text != null) {
                String currentText = text.getWholeText();
                currentText = currentText != null ? currentText.trim() : "";
                final String textToSpeak =
                        currentText.length() > 0 ? " with text " + currentText
                                : " empty";
                toSpeak.append(name + " text field " + textToSpeak);
                toSpeak.append(focusedText);
                toSpeak.append(editableText);
            }
            break;

        case AccessibleRole.LABEL:
            toSpeak.append(name);
            toSpeak.append(focusableText);
            toSpeak.append(focusedText);
            toSpeak.append(selectedText);
            toSpeak.append(expandedText);
            break;

        case AccessibleRole.APP_ICON:
            toSpeak.append(name + "application icon");
            toSpeak.append(focusedText);
            break;

        case AccessibleRole.ICON:
            toSpeak.append(name + " icon ");
            toSpeak.append(focusedText);
            break;

        case AccessibleRole.DATE:
            toSpeak.append(name + " date field ");
            toSpeak.append(selectedText);
            if (text != null) {
                toSpeak.append(" with current value " + text.getWholeText());
            }
            break;

        case AccessibleRole.LIST:
            if (busy) {
                Util.speak(orientation + "list " + name + " loading");
            } else {
                Util.speak(orientation + name + "list with " + childCount
                        + " elements" + focusedText + multiSelectableText);
                for (int i = 0; i < childCount; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    readChildElement(child);
                }
            }
            break;

        case AccessibleRole.PANEL:
            if (busy) {
                Util.speak("panel " + name + " loading");
            } else {
                Util.speak(name + " panel with " + childCount + " items");
                for (int i = 0; i < childCount; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    readChildElement(child);
                }
            }
            break;

        case AccessibleRole.GAUGE:
            if (busy) {
                Util.speak("gauge " + name + " loading");
            } else {
                Util.speak(name
                        + " gauge with value "
                        + context.getAccessibleValue()
                                .getCurrentAccessibleValue());
            }
            break;

        case AccessibleRole.PUSH_BUTTON:
            toSpeak.append(name + " button");
            toSpeak.append(focusedText);
            break;

        case AccessibleRole.MENU_ITEM:
            toSpeak.append(name + " menu item ");
            toSpeak.append(selectedText);
            break;

        case AccessibleRole.CHECKBOX:
            toSpeak.append(name);
            toSpeak.append(" check box ");
            toSpeak.append(focusedText);
            toSpeak.append(checkedText);
            break;

        case AccessibleRole.TABLE:
            if (busy) {
                Util.speak("table " + name + " loading");
            } else {
                final AccessibleTable table = context.getAccessibleTable();
                if (table != null) {
                    readTableElement(context);
                    if (selectable) {
                        ScreenReaderHandler.handleTableSelection(table);
                    }
                }
            }
            break;

        case AccessibleRole.BITMAP:
            Util.speak(name + " image");
            break;

        case AccessibleRole.COMBO:
            toSpeak.append(name + " combobox ");
            toSpeak.append(expandedText);
            if (expanded) {
                Util.speak(toSpeak.toString());
                toSpeak.setLength(0);
                for (int i = 0; i < childCount; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    readChildElement(child);
                }
            } else {
                final String value = context.getAccessibleText().getWholeText();
                if (value != null && value.length() > 0) {
                    toSpeak.append(" current value " + value);
                } else {
                    toSpeak.append(" empty");
                }
            }
            break;

        case AccessibleRole.HYPERLINK:
            toSpeak.append(name + " hyperlink ");
            break;

        case AccessibleRole.SEPARATOR:
            toSpeak.append("separator");
            break;

        case AccessibleRole.TREE_FIELD:
            Util.speak(name + " tree field" + expandableText + collapsedText
                    + expandedText + selectedText);
            for (int i = 0; i < childCount; i++) {
                final AccessibleContext child = context.getAccessibleChildAt(i);
                readChildElement(child);
            }
            break;

        case AccessibleRole.CHOICE:
            toSpeak.append(name + " choice with " + childCount + " elements");
            toSpeak.append(focusedText);
            toSpeak.append(expandedText);
            if (expanded) {
                Util.speak(toSpeak.toString());
                toSpeak.setLength(0);
                for (int i = 0; i < childCount; i++) {
                    final AccessibleContext child =
                            context.getAccessibleChildAt(i);
                    readChildElement(child);
                }
            } else {
                toSpeak.append(" current value "
View Full Code Here

                table.getAccessibleColumnHeader();

        if (tableColumnsNames != null) {
            // Read cells, column by column
            for (int i = 0; i < tableColumnsNames.length; i++) {
                final AccessibleContext column = tableColumnsNames[i];
                Util.speak("column " + (i + 1));
                if (column == null) {
                    Util.speak("empty");
                } else {
                    readChildElement(column);
                }

                // Read cells in the column
                for (int row = 0; row < tableRowCount; row++) {
                    final AccessibleContext accessibleCell =
                            table.getAccessibleAt(row, i);
                    if (accessibleCell == null) {
                        Util.speak("empty");
                    } else {
                        readChildElement(accessibleCell);
                    }
                }
            }
        } else {
            // Read cells, row by row
            Util.speak("table data");
            for (int row = 0; row < tableRowCount; row++) {
                for (int col = 0; col < tableColCount; col++) {
                    final AccessibleContext accessibleCell =
                            table.getAccessibleAt(row, col);
                    if (accessibleCell == null) {
                        Util.speak("empty");
                    } else {
                        readChildElement(accessibleCell);
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.accessibility.AccessibleContext

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.