Java Code Examples for javafx.beans.property.ObjectProperty#get()

The following examples show how to use javafx.beans.property.ObjectProperty#get() . 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: RaceDAO.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
public Race getRaceByID (int id){
    ObjectProperty<Race> result = new SimpleObjectProperty();
    listRaces().forEach(r -> {
        if (r.getID().intValue() == id) result.set(r);
    });
    return result.get();
}
 
Example 2
Source File: BezierOffsetSnippet.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
public HBox ToggleButtonColor(String text,
		ObjectProperty<Color> colorProperty,
		BooleanProperty toggledProperty, boolean isToggled) {
	HBox hbox = new HBox();
	ToggleButton toggleButton = new ToggleButton(text);
	toggleButton.setOnAction((ae) -> {
		refreshAll();
	});
	ColorPicker colorPicker = new ColorPicker(colorProperty.get());
	colorProperty.bind(colorPicker.valueProperty());
	hbox.getChildren().addAll(toggleButton, colorPicker);
	toggledProperty.bind(toggleButton.selectedProperty());
	toggleButton.setSelected(isToggled);
	return hbox;
}
 
Example 3
Source File: SearchHandler.java    From VocabHunter with Apache License 2.0 5 votes vote down vote up
private void selectWord(final ObjectProperty<WordModel> property) {
    WordModel word = property.get();

    if (word != null) {
        wordListHandler.selectWord(word);
    }
}
 
Example 4
Source File: SaveFileDialog.java    From archivo with GNU General Public License v3.0 5 votes vote down vote up
private FileType saveFileType(ObjectProperty<FileChooser.ExtensionFilter> selectedExtensionFilterProperty) {
    FileChooser.ExtensionFilter filter = selectedExtensionFilterProperty.get();
    FileType fileType = null;
    if (filter != null) {
        String description = filter.getDescription();
        logger.info("Selected extension filter: {}", description);
        fileType = FileType.fromDescription(description);
        userPrefs.setMostRecentType(fileType);
    }
    return fileType;
}
 
Example 5
Source File: ParagraphText.java    From RichTextFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Java Quirk! Using {@code t.get[border/underline]DashArray()} throws a ClassCastException
 * "Double cannot be cast to Number". However, using {@code t.getDashArrayProperty().get()}
 * works without issue
 */
LineAttributesBase(Paint color, Number width, ObjectProperty<Number[]> dashArrayProp) {
    this.color = color;
    if (color == null || width == null || width.doubleValue() <= 0) {
        // null value
        this.width = -1;
        dashArray = null;
    } else {
        // real value
        this.width = width.doubleValue();

        // get the dash array - JavaFX CSS parser seems to return either a Number[] array
        // or a single value, depending on whether only one or more than one value has been
        // specified in the CSS
        Object dashArrayProperty = dashArrayProp.get();
        if (dashArrayProperty != null) {
            if (dashArrayProperty.getClass().isArray()) {
                Number[] numberArray = (Number[]) dashArrayProperty;
                dashArray = new Double[numberArray.length];
                int idx = 0;
                for (Number d : numberArray) {
                    dashArray[idx++] = (Double) d;
                }
            } else {
                dashArray = new Double[1];
                dashArray[0] = ((Double) dashArrayProperty).doubleValue();
            }
        } else {
            dashArray = null;
        }
    }
}
 
Example 6
Source File: ShapeInterpolationMode.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
private void editSelection(final PainteraBaseView paintera, final ActiveSection section)
{
	interruptInterpolation();

	if (activeSection.get() == section)
		return;

	if (activeSection.get() != null)
	{
		if (selectedObjects.isEmpty())
			return;
		fixSelection(paintera);
	}

	final ObjectProperty<SectionInfo> sectionInfoPropertyToEdit = section == ActiveSection.First ? sectionInfo1 : sectionInfo2;
	final SectionInfo sectionInfo = sectionInfoPropertyToEdit.get();

	if (sectionInfo == null)
	{
		advanceMode(paintera);
		return;
	}

	resetMask();
	try {
		source.setMask(sectionInfo.mask, FOREGROUND_CHECK);
	} catch (final MaskInUse e) {
		e.printStackTrace();
	}
	mask = sectionInfo.mask;

	paintera.manager().setTransform(sectionInfo.globalTransform);

	selectedObjects.clear();
	selectedObjects.putAll(sectionInfo.selectedObjects);

	sectionInfoPropertyToEdit.set(null);
	activeSection.set(section);

	modeState.set(ModeState.Select);
}
 
Example 7
Source File: IntersectingSourceStateOpener.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(PainteraBaseView viewer, Supplier<String> projectDirectory) {
	final ObjectProperty<SourceState<?, ?>> labelSourceState = new SimpleObjectProperty<>();
	final ObjectProperty<ThresholdingSourceState<?, ?>> thresholdingState = new SimpleObjectProperty<>();
	final StringProperty name = new SimpleStringProperty(null);
	final ObjectProperty<Color> color = new SimpleObjectProperty<>(Color.WHITE);
	final Alert dialog = makeDialog(viewer, labelSourceState, thresholdingState, name, color);
	final Optional<ButtonType> returnType = dialog.showAndWait();
	if (
			Alert.AlertType.CONFIRMATION.equals(dialog.getAlertType())
					&& ButtonType.OK.equals(returnType.orElse(ButtonType.CANCEL))) {
		try {
			final SourceState<?, ?> labelState = labelSourceState.get();
			final IntersectingSourceState intersectingState;
			if (labelState instanceof ConnectomicsLabelState<?, ?>) {
				intersectingState = new IntersectingSourceState(
						thresholdingState.get(),
						(ConnectomicsLabelState) labelState,
						new ARGBCompositeAlphaAdd(),
						name.get(),
						viewer.getQueue(),
						0,
						viewer.viewer3D().meshesGroup(),
						viewer.viewer3D().viewFrustumProperty(),
						viewer.viewer3D().eyeToWorldTransformProperty(),
						viewer.viewer3D().meshesEnabledProperty(),
						viewer.getMeshManagerExecutorService(),
						viewer.getMeshWorkerExecutorService());
			} else if (labelState instanceof LabelSourceState<?, ?>) {
				intersectingState = new IntersectingSourceState(
						thresholdingState.get(),
						(LabelSourceState) labelState,
						new ARGBCompositeAlphaAdd(),
						name.get(),
						viewer.getQueue(),
						0,
						viewer.viewer3D().meshesGroup(),
						viewer.viewer3D().viewFrustumProperty(),
						viewer.viewer3D().eyeToWorldTransformProperty(),
						viewer.viewer3D().meshesEnabledProperty(),
						viewer.getMeshManagerExecutorService(),
						viewer.getMeshWorkerExecutorService());
			} else {
				intersectingState = null;
			}

			if (intersectingState != null) {
				intersectingState.converter().setColor(Colors.toARGBType(color.get()));
				viewer.addState(intersectingState);
			} else {
				LOG.error(
						"Unable to create intersecting state. Expected a label state of class {} or {} but got {} instead.",
						ConnectomicsLabelState.class,
						LabelSourceState.class,
						labelState);
			}
		} catch (final Exception e) {
			LOG.error("Unable to create intersecting state", e);
			Exceptions.exceptionAlert(Paintera.Constants.NAME, "Unable to create intersecting state", e).show();
		}
	}
}
 
Example 8
Source File: JFXBackgroundProperty.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public JFXBackgroundProperty(ObjectProperty<Background> target) {
	this.defaultValue = target.get();
	this.target = target;
	this.bind = new SimpleObjectProperty<Background>(this.defaultValue);
}
 
Example 9
Source File: JFXFontProperty.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public JFXFontProperty(ObjectProperty<Font> target) {
	this.defaultValue = target.get();
	this.target = target;
	this.bind = new SimpleObjectProperty<Font>(this.defaultValue);
}
 
Example 10
Source File: JFXTextFillProperty.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public JFXTextFillProperty(ObjectProperty<Paint> target) {
	this.defaultValue = target.get();
	this.target = target;
	this.bind = new SimpleObjectProperty<Paint>(this.defaultValue);
}