< prev index next >

src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2014, 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


1958                 }
1959                 return false;
1960             }
1961 
1962             /**
1963              * Returns the selected rows in a table.
1964              *
1965              * @return an array of selected rows where each element is a
1966              * zero-based row of the table
1967              */
1968             public int [] getSelectedAccessibleRows() {
1969                 if (validateIfNecessary()) {
1970                     int nRows = getAccessibleRowCount();
1971                     Vector<Integer> vec = new Vector<Integer>();
1972 
1973                     for (int i = 0; i < nRows; i++) {
1974                         if (isAccessibleRowSelected(i)) {
1975                             vec.addElement(Integer.valueOf(i));
1976                         }
1977                     }
1978                     int retval[] = new int[vec.size()];
1979                     for (int i = 0; i < retval.length; i++) {
1980                         retval[i] = vec.elementAt(i).intValue();
1981                     }
1982                     return retval;
1983                 }
1984                 return new int[0];
1985             }
1986 
1987             /**
1988              * Returns the selected columns in a table.
1989              *
1990              * @return an array of selected columns where each element is a
1991              * zero-based column of the table
1992              */
1993             public int [] getSelectedAccessibleColumns() {
1994                 if (validateIfNecessary()) {
1995                     int nColumns = getAccessibleRowCount();
1996                     Vector<Integer> vec = new Vector<Integer>();
1997 
1998                     for (int i = 0; i < nColumns; i++) {
1999                         if (isAccessibleColumnSelected(i)) {
2000                             vec.addElement(Integer.valueOf(i));
2001                         }
2002                     }
2003                     int retval[] = new int[vec.size()];
2004                     for (int i = 0; i < retval.length; i++) {
2005                         retval[i] = vec.elementAt(i).intValue();
2006                     }
2007                     return retval;
2008                 }
2009                 return new int[0];
2010             }
2011 
2012             // begin AccessibleExtendedTable implementation -------------
2013 
2014             /**
2015              * Returns the row number of an index in the table.
2016              *
2017              * @param index the zero-based index in the table
2018              * @return the zero-based row of the table if one exists;
2019              * otherwise -1.
2020              */
2021             public int getAccessibleRow(int index) {
2022                 if (validateIfNecessary()) {
2023                     int numCells = getAccessibleColumnCount() *


   1 /*
   2  * Copyright (c) 2000, 2018, 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


1958                 }
1959                 return false;
1960             }
1961 
1962             /**
1963              * Returns the selected rows in a table.
1964              *
1965              * @return an array of selected rows where each element is a
1966              * zero-based row of the table
1967              */
1968             public int [] getSelectedAccessibleRows() {
1969                 if (validateIfNecessary()) {
1970                     int nRows = getAccessibleRowCount();
1971                     Vector<Integer> vec = new Vector<Integer>();
1972 
1973                     for (int i = 0; i < nRows; i++) {
1974                         if (isAccessibleRowSelected(i)) {
1975                             vec.addElement(Integer.valueOf(i));
1976                         }
1977                     }
1978                     int[] retval = new int[vec.size()];
1979                     for (int i = 0; i < retval.length; i++) {
1980                         retval[i] = vec.elementAt(i).intValue();
1981                     }
1982                     return retval;
1983                 }
1984                 return new int[0];
1985             }
1986 
1987             /**
1988              * Returns the selected columns in a table.
1989              *
1990              * @return an array of selected columns where each element is a
1991              * zero-based column of the table
1992              */
1993             public int [] getSelectedAccessibleColumns() {
1994                 if (validateIfNecessary()) {
1995                     int nColumns = getAccessibleRowCount();
1996                     Vector<Integer> vec = new Vector<Integer>();
1997 
1998                     for (int i = 0; i < nColumns; i++) {
1999                         if (isAccessibleColumnSelected(i)) {
2000                             vec.addElement(Integer.valueOf(i));
2001                         }
2002                     }
2003                     int[] retval = new int[vec.size()];
2004                     for (int i = 0; i < retval.length; i++) {
2005                         retval[i] = vec.elementAt(i).intValue();
2006                     }
2007                     return retval;
2008                 }
2009                 return new int[0];
2010             }
2011 
2012             // begin AccessibleExtendedTable implementation -------------
2013 
2014             /**
2015              * Returns the row number of an index in the table.
2016              *
2017              * @param index the zero-based index in the table
2018              * @return the zero-based row of the table if one exists;
2019              * otherwise -1.
2020              */
2021             public int getAccessibleRow(int index) {
2022                 if (validateIfNecessary()) {
2023                     int numCells = getAccessibleColumnCount() *


< prev index next >