Java Code Examples for javafx.scene.control.Button#setManaged()

The following examples show how to use javafx.scene.control.Button#setManaged() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
private void enableSummonTargets(final HumanTargetOptions targetOptions) {
	int playerId = targetOptions.getPlayerId();
	GameContext context = targetOptions.getContext();
	for (final GameAction action : targetOptions.getActionGroup().getActionsInGroup()) {
		Entity target = context.resolveSingleTarget(action.getTargetKey());
		GameToken token = getToken(target);
		Button summonHelper = playerId == 0 ? summonHelperMap1.get(token) : summonHelperMap2.get(token);
		summonHelper.setVisible(true);
		summonHelper.setManaged(true);
		EventHandler<ActionEvent> clickedHander = new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				disableTargetSelection();
				targetOptions.getActionSelectionListener().onActionSelected(action);
			}
		};
		summonHelper.setOnAction(clickedHander);
	}
}
 
Example 2
Source Project: houdoku   File: LayoutHelpers.java    License: MIT License 5 votes vote down vote up
/**
 * Set whether all Button children of the given Parent are visible.
 *
 * @param parent  the parent node
 * @param visible whether the buttons should be visible
 */
public static void setChildButtonVisible(Parent parent, boolean visible) {
    for (Node child : parent.getChildrenUnmodifiable()) {
        if (child instanceof Button) {
            Button button = (Button) child;
            button.setVisible(visible);
            button.setManaged(visible);
        } else if (child instanceof Parent) {
            setChildButtonVisible((Parent) child, visible);
        }
    }
}
 
Example 3
private Button createSummonHelper() {
	ImageView icon = new ImageView(IconFactory.getSummonHelper());
	icon.setFitWidth(32);
	icon.setFitHeight(32);
	Button helper = new Button("", icon);
	helper.setStyle("-fx-padding: 2 2 2 2;");
	helper.setVisible(false);
	helper.setManaged(false);
	return helper;
}
 
Example 4
Source Project: constellation   File: ActionInputPane.java    License: Apache License 2.0 4 votes vote down vote up
public ActionInputPane(final PluginParameter<?> parameter) {
    field = new Button();
    String label = parameter.getStringValue();
    if (label == null || label.isEmpty()) {
        label = parameter.getName();
    }
    field.setText(label);

    String icon = parameter.getIcon();
    if (icon != null) {
        ImageView img = new ImageView(icon);
        field.setGraphic(img);
    }
    field.setManaged(parameter.isVisible());
    field.setVisible(parameter.isVisible());
    this.setManaged(parameter.isVisible());
    this.setVisible(parameter.isVisible());

    field.setOnAction(event -> {
        // Set a new Object every time so the change event fires.
        //            parameter.setObjectValue(new Object());
        parameter.fireNoChange();
    });

    parameter.addListener((final PluginParameter<?> pluginParameter, final ParameterChange change) -> {
        Platform.runLater(() -> {
            switch (change) {
                case ENABLED:
                    field.setDisable(!pluginParameter.isEnabled());
                    break;
                case VISIBLE:
                    field.setManaged(parameter.isVisible());
                    field.setVisible(parameter.isVisible());
                    this.setVisible(parameter.isVisible());
                    this.setManaged(parameter.isVisible());
                    break;
                default:
                    LOGGER.log(Level.FINE, "ignoring parameter change type {0}.", change);
                    break;
            }

        });
    });

    getChildren().add(field);
}