< prev index next >

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

Print this page
rev 55815 : 8225372: accessibility errors in tables in java.desktop files
Reviewed-by: aivanov
   1 /*
   2  * Copyright (c) 1997, 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


3560          *   <tr>
3561          *     <th scope="row">input, type password
3562          *     <td>{@link PlainDocument}
3563          *   <tr>
3564          *     <th scope="row">input, type radio
3565          *     <td>{@link JToggleButton.ToggleButtonModel}
3566          *   <tr>
3567          *     <th scope="row">input, type reset
3568          *     <td>{@link DefaultButtonModel}
3569          *   <tr>
3570          *     <th scope="row">input, type submit
3571          *     <td>{@link DefaultButtonModel}
3572          *   <tr>
3573          *     <th scope="row">input, type text or type is null.
3574          *     <td>{@link PlainDocument}
3575          *   <tr>
3576          *     <th scope="row">select
3577          *     <td>{@link DefaultComboBoxModel} or an {@link DefaultListModel},
3578          *     with an item type of Option
3579          *   <tr>
3580          *     <td>textarea
3581          *     <td>{@link PlainDocument}
3582          * </tbody>
3583          * </table>
3584          */
3585         public class FormAction extends SpecialAction {
3586 
3587             public void start(HTML.Tag t, MutableAttributeSet attr) {
3588                 if (t == HTML.Tag.INPUT) {
3589                     String type = (String)
3590                         attr.getAttribute(HTML.Attribute.TYPE);
3591                     /*
3592                      * if type is not defined the default is
3593                      * assumed to be text.
3594                      */
3595                     if (type == null) {
3596                         type = "text";
3597                         attr.addAttribute(HTML.Attribute.TYPE, "text");
3598                     }
3599                     setModel(type, attr);
3600                 } else if (t == HTML.Tag.TEXTAREA) {


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


3560          *   <tr>
3561          *     <th scope="row">input, type password
3562          *     <td>{@link PlainDocument}
3563          *   <tr>
3564          *     <th scope="row">input, type radio
3565          *     <td>{@link JToggleButton.ToggleButtonModel}
3566          *   <tr>
3567          *     <th scope="row">input, type reset
3568          *     <td>{@link DefaultButtonModel}
3569          *   <tr>
3570          *     <th scope="row">input, type submit
3571          *     <td>{@link DefaultButtonModel}
3572          *   <tr>
3573          *     <th scope="row">input, type text or type is null.
3574          *     <td>{@link PlainDocument}
3575          *   <tr>
3576          *     <th scope="row">select
3577          *     <td>{@link DefaultComboBoxModel} or an {@link DefaultListModel},
3578          *     with an item type of Option
3579          *   <tr>
3580          *     <th scope="row">textarea
3581          *     <td>{@link PlainDocument}
3582          * </tbody>
3583          * </table>
3584          */
3585         public class FormAction extends SpecialAction {
3586 
3587             public void start(HTML.Tag t, MutableAttributeSet attr) {
3588                 if (t == HTML.Tag.INPUT) {
3589                     String type = (String)
3590                         attr.getAttribute(HTML.Attribute.TYPE);
3591                     /*
3592                      * if type is not defined the default is
3593                      * assumed to be text.
3594                      */
3595                     if (type == null) {
3596                         type = "text";
3597                         attr.addAttribute(HTML.Attribute.TYPE, "text");
3598                     }
3599                     setModel(type, attr);
3600                 } else if (t == HTML.Tag.TEXTAREA) {


< prev index next >