< prev index next >

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

Print this page


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


  53 @SuppressWarnings("serial") // Superclass is not serializable across versions
  54 class CSSBorder extends AbstractBorder {
  55 
  56     /** Indices for the attribute groups.  */
  57     static final int COLOR = 0, STYLE = 1, WIDTH = 2;
  58 
  59     /** Indices for the box sides within the attribute group.  */
  60     static final int TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3;
  61 
  62     /** The attribute groups.  */
  63     static final Attribute[][] ATTRIBUTES = {
  64         { Attribute.BORDER_TOP_COLOR, Attribute.BORDER_RIGHT_COLOR,
  65           Attribute.BORDER_BOTTOM_COLOR, Attribute.BORDER_LEFT_COLOR, },
  66         { Attribute.BORDER_TOP_STYLE, Attribute.BORDER_RIGHT_STYLE,
  67           Attribute.BORDER_BOTTOM_STYLE, Attribute.BORDER_LEFT_STYLE, },
  68         { Attribute.BORDER_TOP_WIDTH, Attribute.BORDER_RIGHT_WIDTH,
  69           Attribute.BORDER_BOTTOM_WIDTH, Attribute.BORDER_LEFT_WIDTH, },
  70     };
  71 
  72     /** Parsers for the border properties.  */
  73     static final CssValue PARSERS[] = {
  74         new ColorValue(), new BorderStyle(), new BorderWidthValue(null, 0),
  75     };
  76 
  77     /** Default values for the border properties.  */
  78     static final Object[] DEFAULTS = {
  79         Attribute.BORDER_COLOR, // marker: value will be computed on request
  80         PARSERS[1].parseCssValue(Attribute.BORDER_STYLE.getDefaultValue()),
  81         PARSERS[2].parseCssValue(Attribute.BORDER_WIDTH.getDefaultValue()),
  82     };
  83 
  84     /** Attribute set containing border properties.  */
  85     final AttributeSet attrs;
  86 
  87     /**
  88      * Initialize the attribute set.
  89      */
  90     CSSBorder(AttributeSet attrs) {
  91         this.attrs = attrs;
  92     }
  93 


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


  53 @SuppressWarnings("serial") // Superclass is not serializable across versions
  54 class CSSBorder extends AbstractBorder {
  55 
  56     /** Indices for the attribute groups.  */
  57     static final int COLOR = 0, STYLE = 1, WIDTH = 2;
  58 
  59     /** Indices for the box sides within the attribute group.  */
  60     static final int TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3;
  61 
  62     /** The attribute groups.  */
  63     static final Attribute[][] ATTRIBUTES = {
  64         { Attribute.BORDER_TOP_COLOR, Attribute.BORDER_RIGHT_COLOR,
  65           Attribute.BORDER_BOTTOM_COLOR, Attribute.BORDER_LEFT_COLOR, },
  66         { Attribute.BORDER_TOP_STYLE, Attribute.BORDER_RIGHT_STYLE,
  67           Attribute.BORDER_BOTTOM_STYLE, Attribute.BORDER_LEFT_STYLE, },
  68         { Attribute.BORDER_TOP_WIDTH, Attribute.BORDER_RIGHT_WIDTH,
  69           Attribute.BORDER_BOTTOM_WIDTH, Attribute.BORDER_LEFT_WIDTH, },
  70     };
  71 
  72     /** Parsers for the border properties.  */
  73     static final CssValue[] PARSERS = {
  74         new ColorValue(), new BorderStyle(), new BorderWidthValue(null, 0),
  75     };
  76 
  77     /** Default values for the border properties.  */
  78     static final Object[] DEFAULTS = {
  79         Attribute.BORDER_COLOR, // marker: value will be computed on request
  80         PARSERS[1].parseCssValue(Attribute.BORDER_STYLE.getDefaultValue()),
  81         PARSERS[2].parseCssValue(Attribute.BORDER_WIDTH.getDefaultValue()),
  82     };
  83 
  84     /** Attribute set containing border properties.  */
  85     final AttributeSet attrs;
  86 
  87     /**
  88      * Initialize the attribute set.
  89      */
  90     CSSBorder(AttributeSet attrs) {
  91         this.attrs = attrs;
  92     }
  93 


< prev index next >