modules/controls/src/main/java/javafx/scene/control/ButtonBar.java
Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization
*** 22,33 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javafx.scene.control;
! import javafx.beans.InvalidationListener;
! import javafx.beans.Observable;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
--- 22,32 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javafx.scene.control;
! import com.sun.javafx.scene.control.Properties;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
*** 36,50 ****
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import com.sun.javafx.util.Utils;
! import com.sun.javafx.scene.control.skin.ButtonBarSkin;
! import com.sun.javafx.scene.traversal.Algorithm;
! import com.sun.javafx.scene.traversal.Direction;
! import com.sun.javafx.scene.traversal.ParentTraversalEngine;
! import com.sun.javafx.scene.traversal.TraversalContext;
import javafx.beans.value.WritableValue;
import javafx.css.StyleableProperty;
import java.util.Map;
--- 35,45 ----
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import com.sun.javafx.util.Utils;
! import javafx.scene.control.skin.ButtonBarSkin;
import javafx.beans.value.WritableValue;
import javafx.css.StyleableProperty;
import java.util.Map;
*** 365,391 ****
*/
public static void setButtonData(Node button, ButtonData buttonData) {
final Map<Object,Object> properties = button.getProperties();
final ObjectProperty<ButtonData> property =
(ObjectProperty<ButtonData>) properties.getOrDefault(
! ButtonBarSkin.BUTTON_DATA_PROPERTY,
new SimpleObjectProperty<>(button, "buttonData", buttonData));
property.set(buttonData);
! properties.putIfAbsent(ButtonBarSkin.BUTTON_DATA_PROPERTY, property);
}
/**
* Returns the previously set ButtonData property on the given button. If this
* was never set, this method will return null.
*
* @param button The button to return the previously set ButtonData for.
*/
public static ButtonData getButtonData(Node button) {
final Map<Object,Object> properties = button.getProperties();
! if (properties.containsKey(ButtonBarSkin.BUTTON_DATA_PROPERTY)) {
! ObjectProperty<ButtonData> property = (ObjectProperty<ButtonData>) properties.get(ButtonBarSkin.BUTTON_DATA_PROPERTY);
return property == null ? null : property.get();
}
return null;
}
--- 360,386 ----
*/
public static void setButtonData(Node button, ButtonData buttonData) {
final Map<Object,Object> properties = button.getProperties();
final ObjectProperty<ButtonData> property =
(ObjectProperty<ButtonData>) properties.getOrDefault(
! Properties.BUTTON_DATA_PROPERTY,
new SimpleObjectProperty<>(button, "buttonData", buttonData));
property.set(buttonData);
! properties.putIfAbsent(Properties.BUTTON_DATA_PROPERTY, property);
}
/**
* Returns the previously set ButtonData property on the given button. If this
* was never set, this method will return null.
*
* @param button The button to return the previously set ButtonData for.
*/
public static ButtonData getButtonData(Node button) {
final Map<Object,Object> properties = button.getProperties();
! if (properties.containsKey(Properties.BUTTON_DATA_PROPERTY)) {
! ObjectProperty<ButtonData> property = (ObjectProperty<ButtonData>) properties.get(Properties.BUTTON_DATA_PROPERTY);
return property == null ? null : property.get();
}
return null;
}
*** 406,428 ****
*/
public static void setButtonUniformSize(Node button, boolean uniformSize) {
// we store the false, but remove the true (as the isButtonUniformSize
// method returns true by default)
if (uniformSize) {
! button.getProperties().remove(ButtonBarSkin.BUTTON_SIZE_INDEPENDENCE);
} else {
! button.getProperties().put(ButtonBarSkin.BUTTON_SIZE_INDEPENDENCE, uniformSize);
}
}
/**
* Returns whether the given node is part of the uniform sizing calculations
* or not. By default all nodes that have not opted out (via
* {@link #setButtonUniformSize(Node, boolean)}) will return true here.
*/
public static boolean isButtonUniformSize(Node button) {
! return (boolean) button.getProperties().getOrDefault(ButtonBarSkin.BUTTON_SIZE_INDEPENDENCE, true);
}
/**************************************************************************
--- 401,423 ----
*/
public static void setButtonUniformSize(Node button, boolean uniformSize) {
// we store the false, but remove the true (as the isButtonUniformSize
// method returns true by default)
if (uniformSize) {
! button.getProperties().remove(Properties.BUTTON_SIZE_INDEPENDENCE);
} else {
! button.getProperties().put(Properties.BUTTON_SIZE_INDEPENDENCE, uniformSize);
}
}
/**
* Returns whether the given node is part of the uniform sizing calculations
* or not. By default all nodes that have not opted out (via
* {@link #setButtonUniformSize(Node, boolean)}) will return true here.
*/
public static boolean isButtonUniformSize(Node button) {
! return (boolean) button.getProperties().getOrDefault(Properties.BUTTON_SIZE_INDEPENDENCE, true);
}
/**************************************************************************