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.beans.property.BooleanProperty; 029import javafx.beans.property.ObjectProperty; 030import javafx.collections.ObservableMap; 031 032/** 033 * Represents a control that can be toggled between selected and non-selected 034 * states. In addition, a Toggle can be assigned a 035 * <code>{@link ToggleGroup}</code>, which manages all assigned Toggles such 036 * that only a single Toggle within the <code>{@link ToggleGroup}</code> may be 037 * selected at any one time. 038 */ 039public interface Toggle { 040 041 /** 042 * Returns The {@link ToggleGroup} to which this {@code Toggle} belongs. 043 * @return The {@link ToggleGroup} to which this {@code Toggle} belongs. 044 */ 045 ToggleGroup getToggleGroup(); 046 047 /** 048 * Sets the {@link ToggleGroup} to which this {@code Toggle} belongs. 049 * @param toggleGroup The new {@link ToggleGroup}. 050 */ 051 void setToggleGroup(ToggleGroup toggleGroup); 052 053 /** 054 * The {@link ToggleGroup} to which this {@code Toggle} belongs. 055 */ 056 ObjectProperty<ToggleGroup> toggleGroupProperty(); 057 058 /** 059 * Indicates whether this {@code Toggle} is selected. 060 * @return {@code true} if this {@code Toggle} is selected. 061 */ 062 boolean isSelected(); 063 064 /** 065 * Sets this {@code Toggle} as selected or unselected. 066 * 067 * @param selected {@code true} to make this {@code Toggle} selected. 068 */ 069 void setSelected(boolean selected); 070 071 /** 072 * The selected state for this {@code Toggle}. 073 */ 074 BooleanProperty selectedProperty(); 075 076 /** 077 * Returns a previously set Object property, or null if no such property 078 * has been set using the {@code Node.setUserData(java.lang.Object)} method. 079 * 080 * @return The Object that was previously set, or null if no property 081 * has been set or if null was set. 082 */ 083 Object getUserData(); 084 085 /** 086 * Convenience method for setting a single Object property that can be 087 * retrieved at a later date. This is functionally equivalent to calling 088 * the getProperties().put(Object key, Object value) method. This can later 089 * be retrieved by calling {@code Node.getUserData()}. 090 * 091 * @param value The value to be stored - this can later be retrieved by calling 092 * {@code Node.getUserData()}. 093 */ 094 void setUserData(Object value); 095 096 /** 097 * Returns an observable map of properties on this toggle for use primarily 098 * by application developers. 099 * 100 * @return An observable map of properties on this toggle for use primarily 101 * by application developers 102 */ 103 ObservableMap<Object, Object> getProperties(); 104}