Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2010, 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.scene.control; 027 028import javafx.scene.Node; 029 030/** 031 * Base class for defining the visual representation of user interface controls 032 * by defining a scene graph of nodes to represent the skin. 033 * A user interface control is abstracted behind the {@link Skinnable} interface. 034 * 035 * @param <C> A subtype of Skinnable that the Skin represents. This allows for 036 * Skin implementation to access the {@link Skinnable} implementation, 037 * which is usually a {@link Control} implementation. 038 */ 039public interface Skin<C extends Skinnable> { 040 /** 041 * Gets the Skinnable to which this Skin is assigned. A Skin must be created 042 * for one and only one Skinnable. This value will only ever go from a 043 * non-null to null value when the Skin is removed from the Skinnable, and 044 * only as a consequence of a call to {@link #dispose()}. 045 * <p> 046 * The caller who constructs a Skinnable must also construct a Skin and 047 * properly establish the relationship between the Control and its Skin. 048 * 049 * @return A non-null Skinnable, or null value if disposed. 050 */ 051 public C getSkinnable(); 052 053 /** 054 * Gets the Node which represents this Skin. This must never be null, except 055 * after a call to {@link #dispose()}, and must never change except when 056 * changing to null. 057 * 058 * @return A non-null Node, except when the Skin has been disposed. 059 */ 060 public Node getNode(); 061 062 /** 063 * Called by a Skinnable when the Skin is replaced on the Skinnable. This method 064 * allows a Skin to implement any logic necessary to clean up itself after 065 * the Skin is no longer needed. It may be used to release native resources. 066 * The methods {@link #getSkinnable()} and {@link #getNode()} 067 * should return null following a call to dispose. Calling dispose twice 068 * has no effect. 069 */ 070 public void dispose(); 071}