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
23 * questions.
24 */
25
26 package com.sun.javafx.scene.layout.region;
27
28 import javafx.css.ParsedValue;
29 import com.sun.javafx.css.StyleConverterImpl;
30 import com.sun.javafx.css.Size;
31 import javafx.scene.layout.BorderWidths;
32 import javafx.scene.text.Font;
33
34 /**
35 * User: richardbair
36 * Date: 8/10/12
37 * Time: 8:27 PM
38 */
39 public class BorderImageWidthsSequenceConverter extends StyleConverterImpl<ParsedValue<ParsedValue[], BorderWidths>[], BorderWidths[]> {
40 private static final BorderImageWidthsSequenceConverter CONVERTER =
41 new BorderImageWidthsSequenceConverter();
42
43 public static BorderImageWidthsSequenceConverter getInstance() {
44 return CONVERTER;
45 }
46
47 @Override
48 public BorderWidths[] convert(ParsedValue<ParsedValue<ParsedValue[], BorderWidths>[], BorderWidths[]> value, Font font) {
49 // For 'border-image-slice: 10% fill, 20% 30%', the value arg will be
50 // ParsedValue { values: [
51 // ParsedValue { values: [ ParsedValue {parsed: 10%}, ParsedValue {parsed: fill}] } ,
52 // ParsedValue { values: [ ParsedValue {parsed: 20%}, ParsedValue {parsed: 30%}] }
53 // ]}
54 //
55 // For 'border-image-slice: 10% fill', the value arg will be
56 // ParsedValue { values: [ ParsedValue {parsed: 10%}, ParsedValue {parsed: fill}] }
57 //
58 // For 'border-image-slice: 10%', the value arg will be
59 // ParsedValue {parsed: 10%}
|
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
23 * questions.
24 */
25
26 package com.sun.javafx.scene.layout.region;
27
28 import javafx.css.ParsedValue;
29 import javafx.css.Size;
30 import javafx.css.StyleConverter;
31 import javafx.scene.layout.BorderWidths;
32 import javafx.scene.text.Font;
33
34 /**
35 * User: richardbair
36 * Date: 8/10/12
37 * Time: 8:27 PM
38 */
39 public class BorderImageWidthsSequenceConverter extends StyleConverter<ParsedValue<ParsedValue[], BorderWidths>[], BorderWidths[]> {
40 private static final BorderImageWidthsSequenceConverter CONVERTER =
41 new BorderImageWidthsSequenceConverter();
42
43 public static BorderImageWidthsSequenceConverter getInstance() {
44 return CONVERTER;
45 }
46
47 @Override
48 public BorderWidths[] convert(ParsedValue<ParsedValue<ParsedValue[], BorderWidths>[], BorderWidths[]> value, Font font) {
49 // For 'border-image-slice: 10% fill, 20% 30%', the value arg will be
50 // ParsedValue { values: [
51 // ParsedValue { values: [ ParsedValue {parsed: 10%}, ParsedValue {parsed: fill}] } ,
52 // ParsedValue { values: [ ParsedValue {parsed: 20%}, ParsedValue {parsed: 30%}] }
53 // ]}
54 //
55 // For 'border-image-slice: 10% fill', the value arg will be
56 // ParsedValue { values: [ ParsedValue {parsed: 10%}, ParsedValue {parsed: fill}] }
57 //
58 // For 'border-image-slice: 10%', the value arg will be
59 // ParsedValue {parsed: 10%}
|