Spec-Zone .ru
спецификации, руководства, описания, API
001/*
002 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.  Oracle designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Oracle in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
022 * or visit www.oracle.com if you need additional information or have any
023 * questions.
024 */
025
026package javafx.css;
027
028import javafx.beans.value.WritableValue;
029import javafx.scene.Node;
030
031/**
032 * StyleableProperty allows a {@link javafx.beans.property} to be styled from
033 * CSS. 
034 * <p>This interface allows coordination between CSS 
035 * processing and a <code>javafx.beans.property</code>. The implementation
036 * ensure that the priority for setting the value is, in increasing order
037 * and assuming equal importance:
038 * <ol>
039 * <li>a style from a user agent stylesheet in 
040 * {@link javafx.application.Application#setUserAgentStylesheet(java.lang.String)}</li>
041 * <li>value set from code, for example calling {@link javafx.scene.Node#setOpacity(double)}</li>
042 * <li>a style from an author stylesheet in {@link javafx.scene.Scene#getStylesheets()}
043 * or {@link javafx.scene.Parent#getStylesheets()}</li>
044 * <li>a style from {@link javafx.scene.Node#setStyle(java.lang.String)}</li>
045 * </ol>
046 */
047public interface StyleableProperty<T> extends WritableValue<T> {
048    
049    /** 
050     * This method is called from CSS code to set the value of the property. 
051     */
052    void applyStyle(StyleOrigin origin, T value);
053        
054    /**
055     * Tells the origin of the value of the property. This is needed to 
056     * determine whether or not CSS can override the value.
057     */
058    StyleOrigin getStyleOrigin();
059    
060    /**
061     * Reflect back the CssMetaData that corresponds to this 
062     * <code>javafx.beans.property.StyleableProperty</code>
063     */
064    CssMetaData<? extends Styleable, T> getCssMetaData();
065       
066}