javafx.beans.property.BooleanProperty Java Examples

The following examples show how to use javafx.beans.property.BooleanProperty. 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 check out the related API usage on the sidebar.
Example #1
Source File: AxesTab.java    From phoebus with Eclipse Public License 1.0 8 votes vote down vote up
private TableColumn<AxisConfig, Boolean> createCheckboxColumn(final String label,
        final Function<AxisConfig, Boolean> getter,
        final BiConsumer<AxisConfig, Boolean> setter)
{
    final TableColumn<AxisConfig, Boolean> check_col = new TableColumn<>(label);
    check_col.setCellValueFactory(cell ->
    {
        final AxisConfig axis = cell.getValue();
        final BooleanProperty prop = new SimpleBooleanProperty(getter.apply(axis));
        prop.addListener((p, old, value) ->
        {
            final ChangeAxisConfigCommand command = new ChangeAxisConfigCommand(undo, axis);
            updating = true;
            setter.accept(axis, value);
            updating = false;
            command.rememberNewConfig();
        });
        return prop;
    });
    check_col.setCellFactory(CheckBoxTableCell.forTableColumn(check_col));
    return check_col;
}
 
Example #2
Source File: TowerDefenseApp.java    From FXGLGames with MIT License 6 votes vote down vote up
@Override
protected void initGame() {
    getGameWorld().addEntityFactory(new TowerDefenseFactory());

    // TODO: read this from external level data
    waypoints.addAll(Arrays.asList(
            new Point2D(700, 0),
            new Point2D(700, 300),
            new Point2D(50, 300),
            new Point2D(50, 450),
            new Point2D(700, 500)
    ));

    BooleanProperty enemiesLeft = new SimpleBooleanProperty();
    enemiesLeft.bind(getGameState().intProperty("numEnemies").greaterThan(0));

    getGameTimer().runAtIntervalWhile(this::spawnEnemy, Duration.seconds(1), enemiesLeft);

    getEventBus().addEventHandler(EnemyKilledEvent.ANY, this::onEnemyKilled);
    getEventBus().addEventHandler(EnemyReachedGoalEvent.ANY, e -> gameOver());
}
 
Example #3
Source File: SegmentMeshInfo.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public SegmentMeshInfo(
		final Long segmentId,
		final MeshSettings meshSettings,
		final BooleanProperty isManaged,
		final FragmentSegmentAssignment assignment,
		final MeshManagerWithAssignmentForSegments meshManager)
{
	this.segmentId = segmentId;
	this.meshSettings = meshSettings;
	this.isManaged = isManaged;
	this.assignment = assignment;
	this.meshManager = meshManager;

	final MeshGenerator.State meshGeneratorState = meshManager.getStateFor(segmentId);
	this.meshProgress = meshGeneratorState == null ? null : meshGeneratorState.getProgress();
}
 
Example #4
Source File: Converters.java    From FxDock with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> StringConverter<T> get(Property<T> p)
{
	if(p instanceof BooleanProperty)
	{
		return (StringConverter<T>)BOOLEAN();
	}
	else if(p instanceof IntegerProperty)
	{
		return (StringConverter<T>)INT();
	}
	else if(p instanceof DoubleProperty)
	{
		return (StringConverter<T>)NUMBER_DOUBLE();
	}
	else if(p instanceof StringProperty)
	{
		return (StringConverter<T>)STRING();
	}
	else
	{
		throw new Error("?" + p);
	}
}
 
Example #5
Source File: MenuItemBuilder.java    From Enzo with Apache License 2.0 5 votes vote down vote up
@Override public final MenuItem build() {
    final MenuItem CONTROL = new MenuItem();

    properties.forEach((key, property) -> {
        if ("tooltip".equals(key)) {
            CONTROL.setTooltip(((StringProperty) property).get());
        } else if("size".equals(key)) {
            CONTROL.setSize(((DoubleProperty) property).get());
        } else if ("backgroundColor".equals(key)) {
            CONTROL.setBackgroundColor(((ObjectProperty<Color>) property).get());
        } else if ("borderColor".equals(key)) {
            CONTROL.setBorderColor(((ObjectProperty<Color>) property).get());
        } else if ("foregroundColor".equals(key)) {
            CONTROL.setForegroundColor(((ObjectProperty<Color>) property).get());
        } else if ("selectedBackgroundColor".equals(key)) {
            CONTROL.setSelectedBackgroundColor(((ObjectProperty<Color>) property).get());
        } else if ("selectedForegroundColor".equals(key)) {
            CONTROL.setSelectedForegroundColor(((ObjectProperty<Color>) property).get());
        } else if ("symbol".equals(key)) {
            CONTROL.setSymbolType(((ObjectProperty<SymbolType>) property).get());
        } else if ("thumbnailImageName".equals(key)) {
            CONTROL.setThumbnailImageName(((StringProperty) property).get());
        } else if ("text".equals(key)) {
            CONTROL.setText(((StringProperty) property).get());
        } else if ("selectable".equals(key)) {
            CONTROL.setSelectable(((BooleanProperty) property).get());
        } else if ("selected".equals(key)) {
            CONTROL.setSelected(((BooleanProperty) property).get());
        }
    });

    return CONTROL;
}
 
Example #6
Source File: ChartDataBuilder.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public final ChartData build() {
    final ChartData DATA = new ChartData();
    for (String key : properties.keySet()) {
        if ("name".equals(key)) {
            DATA.setName(((StringProperty) properties.get(key)).get());
        } else if("value".equals(key)) {
            DATA.setValue(((DoubleProperty) properties.get(key)).get());
        } else if ("timestamp".equals(key)) {
            DATA.setTimestamp(((ObjectProperty<Instant>) properties.get(key)).get());
        } else if ("duration".equals(key)) {
            DATA.setDuration(((ObjectProperty<java.time.Duration>) properties.get(key)).get());
        } else if ("location".equals(key)) {
            DATA.setLocation(((ObjectProperty<Location>) properties.get(key)).get());
        } else if ("fillColor".equals(key)) {
            DATA.setFillColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("strokeColor".equals(key)) {
            DATA.setStrokeColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("textColor".equals(key)) {
            DATA.setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("animated".equals(key)) {
            DATA.setAnimated(((BooleanProperty) properties.get(key)).get());
        } else if("formatString".equals(key)) {
            DATA.setFormatString(((StringProperty) properties.get(key)).get());
        } else if("minValue".equals(key)) {
            DATA.setMinValue(((DoubleProperty) properties.get(key)).get());
        } else if("maxValue".equals(key)) {
            DATA.setMaxValue(((DoubleProperty) properties.get(key)).get());
        } else if ("gradientLookup".equals(key)) {
            DATA.setGradientLookup(((ObjectProperty<GradientLookup>) properties.get(key)).get());
        } else if ("useChartDataColor".equals(key)) {
            DATA.setUseChartDataColors(((BooleanProperty) properties.get(key)).get());
        } else if ("onChartDataEvent".equals(key)) {
            DATA.setOnChartDataEvent(((ObjectProperty<ChartDataEventListener>) properties.get(key)).get());
        } else if ("image".equals(key)) {
            DATA.setImage(((ObjectProperty<Image>) properties.get(key)).get());
        }
    }
    return DATA;
}
 
Example #7
Source File: FXMLResultsController.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
public void removeOutputDestination(ActionEvent fxevent){
    BooleanProperty inUse = new SimpleBooleanProperty(FALSE);
    StringBuilder inUseBy = new StringBuilder("In use by the following reports:\n");
    ReportDestination rd = outputDestinationsListView.getSelectionModel().getSelectedItem();
    if (rd == null) return;
    // Make sure it is  not in use anywhere, then remove it.
    raceDAO.listRaces().forEach(r -> {
        System.out.println("  Race: " + r.getRaceName());
        r.getRaceReports().forEach(rr -> {
            System.out.println("  Report: " + rr.getReportType().toString());
            rr.getRaceOutputTargets().forEach(rot -> {
                System.out.println("  Target: " + rot.getUUID() );
                if (rd.getID().equals(rot.getOutputDestination()) ) {
                    // the ReportDestination is in use
                    inUse.set(true);
                    inUseBy.append(r.getRaceName() + ": " + rr.getReportType().toString() +"\n" );
                }
            });
        });
    });
    
    if (inUse.getValue()) {
        // Alert dialog box time
        Alert alert = new Alert(AlertType.WARNING);
        alert.setTitle("Unable to Remove ");
        alert.setHeaderText("Unable to Remove the selected Output Destination");
        alert.setContentText(inUseBy.toString());

        alert.showAndWait();
    } else resultsDAO.removeReportDestination(outputDestinationsListView.getSelectionModel().getSelectedItem());
}
 
Example #8
Source File: PainteraAlerts.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
@Deprecated
public static boolean askConvertDeprecatedStatesShowAndWait(
		final BooleanProperty choiceProperty,
		final BooleanProperty rememberChoiceProperty,
		final Class<?> deprecatedStateType,
		final Class<?> convertedStateType,
		final Object datasetDescriptor) {
	if (rememberChoiceProperty.get())
		return choiceProperty.get();
	final Alert alert = askConvertDeprecatedStates(rememberChoiceProperty, deprecatedStateType, convertedStateType, datasetDescriptor);
	boolean choice = alert.showAndWait().filter(ButtonType.OK::equals).isPresent();
	choiceProperty.setValue(choice);
	return choice;
}
 
Example #9
Source File: PreferencesDialog.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public static Setting getPositionSelector(String label, boolean horizontal, String selectedValue, BooleanProperty booleanBind, HashMap<Field, ObservableValue> bindings) {
    Setting setting;
    if (horizontal)
        setting = Setting.of(label, FXCollections.observableArrayList(LabelGrabber.INSTANCE.getLabel("left"), LabelGrabber.INSTANCE.getLabel("right")), new SimpleObjectProperty<>(LabelGrabber.INSTANCE.getLabel(selectedValue.toLowerCase())));
    else
        setting = Setting.of(label, FXCollections.observableArrayList(LabelGrabber.INSTANCE.getLabel("top.text.position"), LabelGrabber.INSTANCE.getLabel("bottom.text.position")), new SimpleObjectProperty<>(LabelGrabber.INSTANCE.getLabel(selectedValue.toLowerCase())));
    if (booleanBind != null)
        bindings.put(setting.getField(), booleanBind.not());
    return setting;
}
 
Example #10
Source File: FileInformation.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public void setSelectedProperty(BooleanProperty selectedProperty) {
    if (selectedProperty == null) {
        this.selectedProperty = new SimpleBooleanProperty(false);
    } else {
        this.selectedProperty = selectedProperty;
    }
}
 
Example #11
Source File: HeatMapBuilder.java    From charts with Apache License 2.0 5 votes vote down vote up
public final HeatMap build() {
    double              width               = 400;
    double              height              = 400;
    ColorMapping        colorMapping        = ColorMapping.LIME_YELLOW_RED;
    double              spotRadius          = 15.5;
    boolean             fadeColors          = false;
    double              heatMapOpacity      = 0.5;
    OpacityDistribution opacityDistribution = OpacityDistribution.CUSTOM;

    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            width  = dim.getWidth();
            height = dim.getHeight();
        } else if ("width".equals(key)) {
            width = ((DoubleProperty) properties.get(key)).get();
        } else if ("height".equals(key)) {
            height = ((DoubleProperty) properties.get(key)).get();
        } else if ("colorMapping".equals(key)) {
            colorMapping = ((ObjectProperty<ColorMapping>) properties.get(key)).get();
        } else if ("spotRadius".equals(key)) {
            spotRadius = ((DoubleProperty) properties.get(key)).get();
        } else if ("fadeColors".equals(key)) {
            fadeColors = ((BooleanProperty) properties.get(key)).get();
        } else if ("heatMapOpacity".equals(key)) {
            heatMapOpacity = ((DoubleProperty) properties.get(key)).get();
        } else if ("opacityDistribution".equals(key)) {
            opacityDistribution = ((ObjectProperty<OpacityDistribution>) properties.get(key)).get();
        }
    }
    return new HeatMap(width,  height, colorMapping, spotRadius, fadeColors, heatMapOpacity, opacityDistribution);
}
 
Example #12
Source File: TitleBar.java    From desktoppanefx with Apache License 2.0 4 votes vote down vote up
public BooleanProperty disableCloseProperty() {
    return disableClose;
}
 
Example #13
Source File: DataViewWindow.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
public BooleanProperty restoredProperty() {
    return restoredWindow;
}
 
Example #14
Source File: InternalWindow.java    From desktoppanefx with Apache License 2.0 4 votes vote down vote up
public BooleanProperty detachedProperty() {
    return detached;
}
 
Example #15
Source File: FreehandImpl.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull BooleanProperty openedProperty() {
	return open;
}
 
Example #16
Source File: Settings.java    From PDF4Teachers with Apache License 2.0 4 votes vote down vote up
public BooleanProperty autoSavingProperty(){
    return this.autoSave;
}
 
Example #17
Source File: AgeGroups.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public BooleanProperty useCustomIncrementsProperty() {
    return customIncrementsProperty;
}
 
Example #18
Source File: MainViewModel.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
BooleanProperty getUseTorForBTC() {
    return bisqSetup.getUseTorForBTC();
}
 
Example #19
Source File: NumberRangeControl.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public BooleanProperty outOfRangeProperty() {
  return outOfRange;
}
 
Example #20
Source File: MaskedSource.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public BooleanProperty showCanvasOverBackgroundProperty()
{
	return showCanvasOverBackground;
}
 
Example #21
Source File: PikaOutreachDirectReader.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BooleanProperty getReadingStatus() {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
Example #22
Source File: AwardCategory.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public BooleanProperty filteredProperty(){
    return customFilteredProperty;
}
 
Example #23
Source File: ValueProviderParameterModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * @return the observable encrypted property
 */
public BooleanProperty encryptedProperty() {
	return encrypted;
}
 
Example #24
Source File: FeaturePanel.java    From phoenicis with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Constructor
 *
 * @param initialized A property containing the initialization state of this view
 */
protected FeaturePanel(BooleanProperty initialized) {
    super();

    this.initialized = initialized;
}
 
Example #25
Source File: UnitConverter.java    From tornadofx-controls with Apache License 2.0 4 votes vote down vote up
public BooleanProperty binaryProperty() {
    return binaryProperty;
}
 
Example #26
Source File: Preferences.java    From bisq-core with GNU Affero General Public License v3.0 4 votes vote down vote up
public BooleanProperty useCustomWithdrawalTxFeeProperty() {
    return useCustomWithdrawalTxFeeProperty;
}
 
Example #27
Source File: Settings.java    From PDF4Teachers with Apache License 2.0 4 votes vote down vote up
public BooleanProperty showOnlyStartInTextsListProperty() {
    return showOnlyStartInTextsList;
}
 
Example #28
Source File: GridRenderer.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public BooleanProperty showInLegendProperty() {
    return null;
}
 
Example #29
Source File: TableAttributeEntity.java    From Vert.X-generator with MIT License 4 votes vote down vote up
public BooleanProperty tdCreateProperty() {
	return tdCreate;
}
 
Example #30
Source File: BaseQuickbarButtonsPane.java    From pdfsam with GNU Affero General Public License v3.0 4 votes vote down vote up
public final BooleanProperty displayTextProperty() {
    return displayText;
}