javafx.beans.property.SimpleBooleanProperty Java Examples

The following examples show how to use javafx.beans.property.SimpleBooleanProperty. 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: WordStateHandler.java    From VocabHunter with Apache License 2.0 6 votes vote down vote up
public void initialise(final Button buttonUnseen, final Button buttonKnown, final Button buttonUnknown, final SessionModel sessionModel,
                        final ObjectBinding<WordState> wordStateProperty, final Runnable nextWordSelector) {
    this.sessionModel = sessionModel;
    this.nextWordSelector = nextWordSelector;

    SimpleBooleanProperty editableProperty = sessionModel.editableProperty();
    BooleanBinding resettableProperty = editableProperty.and(notEqual(WordState.UNSEEN, wordStateProperty));

    buttonUnseen.visibleProperty().bind(resettableProperty);
    buttonKnown.visibleProperty().bind(editableProperty);
    buttonUnknown.visibleProperty().bind(editableProperty);

    buttonUnseen.setOnAction(e -> processResponse(WordState.UNSEEN, false));
    buttonKnown.setOnAction(e -> processResponse(WordState.KNOWN, true));
    buttonUnknown.setOnAction(e -> processResponse(WordState.UNKNOWN, true));
}
 
Example #3
Source File: BatchController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@Override
public void initValues() {
    try {
        super.initValues();
        optionsValid = new SimpleBooleanProperty(true);

    } catch (Exception e) {
        logger.error(e.toString());
    }
}
 
Example #4
Source File: HeatControl.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public HeatControl() {
    getStyleClass().add("heat-control");
    value             = new DoublePropertyBase(0) {
        @Override protected void invalidated() {
            set(clamp(getMinValue(), getMaxValue(), get()));
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "value"; }
    };
    minValue          = new DoublePropertyBase(0) {
        @Override protected void invalidated() {
            if (getValue() < get()) setValue(get());
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "minValue"; }
    };
    maxValue          = new DoublePropertyBase(40) {
        @Override protected void invalidated() {
            if (getValue() > get()) setValue(get());
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "maxValue"; }
    };
    oldValue          = 0;
    target            = new DoublePropertyBase(20) {
        @Override protected void invalidated() {
            set(clamp(getMinValue(), getMaxValue(), get()));
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "target"; }
    };
    _minMeasuredValue = maxValue.getValue();
    _maxMeasuredValue = 0;
    _decimals         = 0;
    _infoText         = "";
    targetEnabled     = new SimpleBooleanProperty(this, "targetEnabled", false);
    _startAngle       = 325;
    _angleRange       = 290;                
}
 
Example #5
Source File: OptionsRecordingPanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public Category getRecordingsTab() {
    bindings.put(useConvertSetting.getField(), new SimpleBooleanProperty(hasVLC));

    return Category.of(LabelGrabber.INSTANCE.getLabel("recordings.options.heading"), new ImageView(new Image("file:icons/recordingssettingsicon.png")),
            Setting.of(LabelGrabber.INSTANCE.getLabel("recordings.path"), recordingsDirectoryField, recordingsDirectoryChooserProperty).customKey(recPathKey),
            useConvertSetting
    );
}
 
Example #6
Source File: Main.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
  // set loading state
  loading(false);
  // create assembling property
  assembling = new SimpleBooleanProperty(false);
  // init other controllers
  editorController.initialize(this);
  simulatorController.initialize(this);
  // init controls
  initControls();
}
 
Example #7
Source File: PanningGestures.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
public static <T extends Node & IPannablePane> PanningGestures<T> attachViewPortGestures(T pannableCanvas, boolean configurable) {
    PanningGestures<T> panningGestures = new PanningGestures<>(pannableCanvas);
    if (configurable) {
        panningGestures.useViewportGestures = new SimpleBooleanProperty(true);
        panningGestures.useViewportGestures.addListener((o, oldVal, newVal) -> {
            final Parent parent = pannableCanvas.parentProperty().get();
            if (parent == null) {
                return;
            }
            if (newVal) {
                parent.addEventHandler(MouseEvent.MOUSE_PRESSED, panningGestures.onMousePressedEventHandler);
                parent.addEventHandler(MouseEvent.MOUSE_DRAGGED, panningGestures.onMouseDraggedEventHandler);
                parent.addEventHandler(ScrollEvent.ANY, panningGestures.onScrollEventHandler);
            } else {
                parent.removeEventHandler(MouseEvent.MOUSE_PRESSED, panningGestures.onMousePressedEventHandler);
                parent.removeEventHandler(MouseEvent.MOUSE_DRAGGED, panningGestures.onMouseDraggedEventHandler);
                parent.removeEventHandler(ScrollEvent.ANY, panningGestures.onScrollEventHandler);
            }
        });
    }
    pannableCanvas.parentProperty().addListener((o, oldVal, newVal) -> {
        if (oldVal != null) {
            oldVal.removeEventHandler(MouseEvent.MOUSE_PRESSED, panningGestures.onMousePressedEventHandler);
            oldVal.removeEventHandler(MouseEvent.MOUSE_DRAGGED, panningGestures.onMouseDraggedEventHandler);
            oldVal.removeEventHandler(ScrollEvent.ANY, panningGestures.onScrollEventHandler);
        }
        if (newVal != null) {
            newVal.addEventHandler(MouseEvent.MOUSE_PRESSED, panningGestures.onMousePressedEventHandler);
            newVal.addEventHandler(MouseEvent.MOUSE_DRAGGED, panningGestures.onMouseDraggedEventHandler);
            newVal.addEventHandler(ScrollEvent.ANY, panningGestures.onScrollEventHandler);
        }
    });
    return panningGestures;
}
 
Example #8
Source File: ImageSplitController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
private void initCommon() {
    opBox.disableProperty().bind(imageView.imageProperty().isNull());
    optionsBox.disableProperty().bind(imageView.imageProperty().isNull());
    showBox.disableProperty().bind(imageView.imageProperty().isNull());

    splitValid = new SimpleBooleanProperty(false);

    displaySizeCheck.selectedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> ov,
                Boolean old_val, Boolean new_val) {
            indicateSplit();
        }
    });

    saveImagesButton.disableProperty().bind(
            splitValid.not()
    );
    savePdfButton.disableProperty().bind(
            splitValid.not()
                    .or(customWidthInput.styleProperty().isEqualTo(badStyle))
                    .or(customHeightInput.styleProperty().isEqualTo(badStyle))
    );
    saveTiffButton.disableProperty().bind(
            splitValid.not()
    );
}
 
Example #9
Source File: SuspendedWhenTest.java    From ReactFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void test() {
    Property<Integer> p = new SimpleObjectProperty<>(0);
    BooleanProperty suspended = new SimpleBooleanProperty(true);
    List<Integer> emitted = new ArrayList<>();
    SuspendableEventStream<Integer> pausable = EventStreams.valuesOf(p).pausable();
    Subscription sub = pausable.suspendedWhen(suspended).subscribe(emitted::add);

    // test that the stream started suspended
    assertEquals(Arrays.asList(), emitted);

    suspended.set(false);
    assertEquals(Arrays.asList(0), emitted);

    p.setValue(1);
    assertEquals(Arrays.asList(0, 1), emitted);

    suspended.set(true);
    p.setValue(2);
    p.setValue(3);
    p.setValue(4);
    assertEquals(Arrays.asList(0, 1), emitted);

    List<Integer> emitted2 = new ArrayList<>();
    pausable.subscribe(emitted2::add);
    assertEquals(Arrays.asList(), emitted2);

    suspended.set(false);
    assertEquals(Arrays.asList(0, 1, 2, 3, 4), emitted);
    assertEquals(Arrays.asList(2, 3, 4), emitted2);

    suspended.set(true);
    p.setValue(5);
    p.setValue(6);
    assertEquals(Arrays.asList(2, 3, 4), emitted2);
    sub.unsubscribe(); // testing resume on unsubscribe
    assertEquals(Arrays.asList(0, 1, 2, 3, 4), emitted);
    assertEquals(Arrays.asList(2, 3, 4, 5, 6), emitted2);
}
 
Example #10
Source File: AbstractFileEditor.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new Abstract file editor.
 */
protected AbstractFileEditor() {
    this.showedTime = LocalTime.now();
    this.editor3DParts = ArrayFactory.newArray(Editor3DPart.class);
    this.dirtyProperty = new SimpleBooleanProperty(this, "dirty", false);
    this.fileChangedHandler = this::processChangedFile;
    createContent();
}
 
Example #11
Source File: DialogControlTest.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
  this.stage = stage;
  MockitoAnnotations.initMocks(this);

  robot = new FxRobot();

  blocking = new SimpleBooleanProperty();
  mockDialog = mock(WorkbenchDialog.class);
  buttonTypes = FXCollections.observableArrayList(BUTTON_TYPE_1);
  when(mockDialog.getButtonTypes()).thenReturn(buttonTypes);
  when(mockDialog.getOnResult()).thenReturn(mockOnResult);
  when(mockDialog.blockingProperty()).thenReturn(blocking);

  mockBench = mock(Workbench.class);

  dialogControl = new MockDialogControl();

  // simulate call of workbench to set itself in the dialogControl
  dialogControl.setWorkbench(mockBench);
  // simulate call of WorkbenchDialog to set itself in the dialogControl
  dialogControl.setDialog(mockDialog);

  // setup mocks for listeners
  dialogControl.setOnHidden(mockHiddenHandler);
  dialogControl.setOnShown(mockShownHandler);

  // setup second dialog control that isn't showing, to test behavior of skin listeners
  dialogControl2 = new MockDialogControl();
  dialogControl2.setDialog(mockDialog);
  dialogControl2.setOnShown(mockShownHandler2);
  dialogControl2.setOnHidden(mockHiddenHandler2);

  Scene scene = new Scene(dialogControl, 100, 100);
  this.stage.setScene(scene);
  stage.show();
}
 
Example #12
Source File: ScheduleItem.java    From G-Earth with MIT License 5 votes vote down vote up
protected void construct(int index, boolean paused, Interval delay, HPacket packet, HMessage.Direction destination) {
    this.indexProperty = new SimpleIntegerProperty(index);
    this.pausedProperty = new SimpleBooleanProperty(paused);
    this.delayProperty = new SimpleObjectProperty<>(delay);
    this.packetProperty = new SimpleObjectProperty<>(packet);
    this.destinationProperty = new SimpleObjectProperty<>(destination);
}
 
Example #13
Source File: TileBuilder.java    From OEE-Designer with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
public final B snapToTicks(final boolean SNAP) {
       properties.put("snapToTicks", new SimpleBooleanProperty(SNAP));
       return (B)this;
   }
 
Example #14
Source File: ClockBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B sectionsVisible(final boolean VISIBLE) {
    properties.put("sectionsVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #15
Source File: TileBuilder.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public final B tickLabelsYVisible(final boolean VISIBLE) {
    properties.put("tickLabelsYVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #16
Source File: ClockBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B hourTickMarksVisible(final boolean VISIBLE) {
    properties.put("hourTickMarksVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #17
Source File: GaugeBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B oldValueVisible(final boolean VISIBLE) {
    properties.put("oldValueVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #18
Source File: GaugeBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B majorTickMarksVisible(final boolean VISIBLE) {
    properties.put("majorTickMarksVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #19
Source File: FGaugeBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B foregroundVisible(final boolean VISIBLE) {
    properties.put("foregroundVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #20
Source File: LcdBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final LcdBuilder textMode(final boolean TEXT_MODE) {
    properties.put("textMode", new SimpleBooleanProperty(TEXT_MODE));
    return this;
}
 
Example #21
Source File: BaseController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
public void setIsPickingColor(SimpleBooleanProperty isPickingColor) {
    this.isPickingColor = isPickingColor;
}
 
Example #22
Source File: TileBuilder.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public final B maxValueVisible(final boolean VISIBLE) {
    properties.put("maxValueVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #23
Source File: LcdClockBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final LcdClockBuilder crystalOverlayVisible(final boolean CRYSTAL_OVERLAY_VISIBLE) {
    properties.put("crystalOverlayVisible", new SimpleBooleanProperty(CRYSTAL_OVERLAY_VISIBLE));
    return this;
}
 
Example #24
Source File: TileBuilder.java    From OEE-Designer with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
public final B sunburstUseChartDataTextColor(final boolean USE) {
       properties.put("sunburstUseChartDataTextColor", new SimpleBooleanProperty(USE));
       return (B)this;
   }
 
Example #25
Source File: TileBuilder.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public final B sectionTextVisible(final boolean VISIBLE) {
    properties.put("sectionTextVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #26
Source File: ClockBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B areasVisible(final boolean VISIBLE) {
    properties.put("areasVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #27
Source File: GaugeBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B checkAreasForValue(final boolean CHECK) {
    properties.put("checkAreasForValue", new SimpleBooleanProperty(CHECK));
    return (B)this;
}
 
Example #28
Source File: GridBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B mediumHGridLinesVisible(final boolean VISIBLE) {
    properties.put("mediumHGridLinesVisible", new SimpleBooleanProperty(VISIBLE));
    return (B)this;
}
 
Example #29
Source File: MainModel.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
public SimpleBooleanProperty enableFiltersProperty() {
    return enableFilters;
}
 
Example #30
Source File: TileBuilder.java    From OEE-Designer with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
public final B dataPointsVisible(final boolean VISIBLE) {
       properties.put("dataPointsVisible", new SimpleBooleanProperty(VISIBLE));
       return (B)this;
   }