javafx.beans.property.IntegerProperty Java Examples

The following examples show how to use javafx.beans.property.IntegerProperty. 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: 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 #2
Source File: ListMapTest.java    From ReactFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testLazinessOnChangeAccumulation() {
    ObservableList<String> strings = FXCollections.observableArrayList("1", "22", "333");
    IntegerProperty evaluations = new SimpleIntegerProperty(0);
    LiveList<Integer> lengths = LiveList.map(strings, s -> {
        evaluations.set(evaluations.get() + 1);
        return s.length();
    });
    SuspendableList<Integer> suspendable = lengths.suspendable();

    suspendable.observeChanges(ch -> {});
    suspendable.suspendWhile(() -> {
        strings.remove(1);
        strings.set(1, "abcd");
    });

    assertEquals(0, evaluations.get());
}
 
Example #3
Source File: MipMapLevel.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
private MipMapLevel(
		SpatialField<IntegerProperty> relativeDownsamplingFactors,
		NumberField<IntegerProperty> maxNumberOfEntriesPerSet,
		final double fieldWidth,
		final double nameWidth)
{
	this.relativeDownsamplingFactors = relativeDownsamplingFactors;
	this.maxNumberOfEntriesPerSet = maxNumberOfEntriesPerSet;
	this.fieldWidth = fieldWidth;

	this.node = new HBox(
			NamedNode.nameIt("Relative factors", nameWidth, false, relativeDownsamplingFactors.getNode()),
			NamedNode.nameIt( "Max Num Entries", nameWidth, false, maxNumberOfEntriesPerSet.textField())
	                );
}
 
Example #4
Source File: LocationBuilder.java    From worldfx with Apache License 2.0 5 votes vote down vote up
public final Location build() {
    final Location LOCATION = new Location();

    for (String key : properties.keySet()) {
        if ("name".equals(key)) {
            LOCATION.setName(((StringProperty) properties.get(key)).get());
        } else if ("latitude".equals(key)) {
            LOCATION.setLatitude(((DoubleProperty) properties.get(key)).get());
        } else if ("longitude".equals(key)) {
            LOCATION.setLongitude(((DoubleProperty) properties.get(key)).get());
        } else if ("info".equals(key)) {
            LOCATION.setInfo(((StringProperty) properties.get(key)).get());
        } else if ("color".equals(key)) {
            LOCATION.setColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("iconCode".equals(key)) {
            LOCATION.setIconCode(((ObjectProperty<Ikon>) properties.get(key)).get());
        } else if ("iconSize".equals(key)) {
            LOCATION.setIconSize(((IntegerProperty) properties.get(key)).get());
        } else if ("mouseEnterHandler".equals(key)) {
            LOCATION.setMouseEnterHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
        } else if ("mousePressHandler".equals(key)) {
            LOCATION.setMousePressHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
        } else if ("mouseReleaseHandler".equals(key)) {
            LOCATION.setMouseReleaseHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
        } else if ("mouseExitHandler".equals(key)) {
            LOCATION.setMouseExitHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get());
        }
        
    }
    return LOCATION;
}
 
Example #5
Source File: SessionContext.java    From jfxvnc with Apache License 2.0 5 votes vote down vote up
public Optional<IntegerProperty> getIntegerBinding(String key) {
  Optional<Property<?>> b = getBinding(key);
  if (!b.isPresent() || !IntegerProperty.class.isInstance(b.get())) {
    return Optional.empty();
  }
  return Optional.of((IntegerProperty) b.get());
}
 
Example #6
Source File: AreaHeatMapBuilder.java    From charts with Apache License 2.0 5 votes vote down vote up
public final AreaHeatMap build() {
    final AreaHeatMap CONTROL = new AreaHeatMap();
    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("colorMapping".equals(key)) {
            CONTROL.setColorMapping(((ObjectProperty<ColorMapping>) properties.get(key)).get());
        } else if("useColorMapping".equals(key)) {
            CONTROL.setUseColorMapping(((BooleanProperty) properties.get(key)).get());
        } else if ("quality".equals(key)) {
            CONTROL.setQuality(((IntegerProperty) properties.get(key)).get());
        } else if ("heatMapOpacity".equals(key)) {
            CONTROL.setHeatMapOpacity(((DoubleProperty) properties.get(key)).get());
        } else if ("dataPointsVisible".equals(key)) {
            CONTROL.setDataPointsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("smoothedHull".equals(key)) {
            CONTROL.setSmoothedHull(((BooleanProperty) properties.get(key)).get());
        } else if ("discreteColors".equals(key)) {
            CONTROL.setDiscreteColors(((BooleanProperty) properties.get(key)).get());
        } else if ("noOfCloserInfluentPoints".equals(key)) {
            CONTROL.setNoOfCloserInfluentPoints(((IntegerProperty) properties.get(key)).get());
        }
    }
    if (properties.keySet().contains("dataPointsArray")) {
        CONTROL.setDataPoints(((ObjectProperty<DataPoint[]>) properties.get("dataPointsArray")).get());
    }
    if(properties.keySet().contains("dataPointsList")) {
        CONTROL.setDataPoints(((ObjectProperty<List<DataPoint>>) properties.get("dataPointsList")).get());
    }
    return CONTROL;
}
 
Example #7
Source File: BezierMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty lengthCropProperty() {
    return lengthCrop;
}
 
Example #8
Source File: IcosahedronMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public final IntegerProperty levelProperty() {
    return level;
}
 
Example #9
Source File: GoogleMap.java    From GMapsFX with Apache License 2.0 4 votes vote down vote up
public IntegerProperty zoomProperty() {
    return zoom;
}
 
Example #10
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public SliderOption(Node graphic, String caption, String description, String category, IntegerProperty value, 
        boolean isEditable, int min, int max) {
    super(graphic, caption, description, category, (Property<Number>) value, isEditable);
    this.min = min;
    this.max = max;
}
 
Example #11
Source File: Wave.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty idProperty() {
    return IDProperty; 
}
 
Example #12
Source File: ReportDestination.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty idProperty() {
    return IDProperty; 
}
 
Example #13
Source File: CardComponent.java    From FXGLGames with MIT License 4 votes vote down vote up
public IntegerProperty levelProperty() {
    return level;
}
 
Example #14
Source File: PacketLossController.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
public PacketLossController(final IntegerProperty interval) {
    super(interval);
}
 
Example #15
Source File: CurvedSpringMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty lengthDivisionsProperty() {
    return lengthDivisions;
}
 
Example #16
Source File: KafkaSenderConfig.java    From kafka-message-tool with MIT License 4 votes vote down vote up
public IntegerProperty repeatCountProperty() {
    return repeatCount;
}
 
Example #17
Source File: LabelMapItem.java    From OpenLabeler with Apache License 2.0 4 votes vote down vote up
public IntegerProperty idProperty() {
    return id;
}
 
Example #18
Source File: SegmentedSphereMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty radiusCropYProperty() {
    return radiusCropY;
}
 
Example #19
Source File: SettingsHandler.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static IntegerProperty maxPotionSpellLevel()
{
	return maxPotionSpellLevel;
}
 
Example #20
Source File: RxBpsController.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
public RxBpsController(final IntegerProperty interval) {
    super(interval);
}
 
Example #21
Source File: Participant.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty ageProperty() {
    return ageProperty; 
}
 
Example #22
Source File: JFXMasonryPane.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public final IntegerProperty limitRowProperty() {
    return this.limitRow;
}
 
Example #23
Source File: MemoizationListTest.java    From ReactFX with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Test
public void test() {
    ObservableList<String> source = new LiveArrayList<>("1", "22", "333");
    IntegerProperty counter = new SimpleIntegerProperty(0);
    MemoizationList<Integer> memoizing = LiveList.map(source, s -> {
        counter.set(counter.get() + 1);
        return s.length();
    }).memoize();
    LiveList<Integer> memoized = memoizing.memoizedItems();
    List<Integer> memoMirror = new ArrayList<>();
    memoized.observeModifications(mod -> {
        memoMirror.subList(mod.getFrom(), mod.getFrom() + mod.getRemovedSize()).clear();
        memoMirror.addAll(mod.getFrom(), mod.getAddedSubList());
    });

    assertEquals(0, memoized.size());

    source.add("4444");
    assertEquals(Collections.emptyList(), memoized);
    assertEquals(0, memoMirror.size());
    assertEquals(0, counter.get());

    memoizing.get(2);
    assertEquals(Arrays.asList(3), memoized);
    assertEquals(Arrays.asList(3), memoMirror);
    assertEquals(1, counter.get());

    counter.set(0);
    memoizing.get(0);
    assertEquals(Arrays.asList(1, 3), memoized);
    assertEquals(Arrays.asList(1, 3), memoMirror);
    assertEquals(1, counter.get());

    counter.set(0);
    source.subList(2, 4).replaceAll(s -> s + s);
    assertEquals(Arrays.asList(1), memoized);
    assertEquals(Arrays.asList(1), memoMirror);
    assertEquals(0, counter.get());

    counter.set(0);
    memoizing.observeModifications(mod -> {
        if(mod.getAddedSize() == 3) { // when three items added
            mod.getAddedSubList().get(0); // force evaluation of the first
            mod.getAddedSubList().get(1); // and second one
            source.remove(0); // and remove the first element from source
        }
    });
    source.remove(1, 4);
    assertEquals(Arrays.asList(1), memoized);
    assertEquals(Arrays.asList(1), memoMirror);
    assertEquals(0, counter.get());
    source.addAll("22", "333", "4444");
    assertEquals(Arrays.asList(2, 3), memoized);
    assertEquals(Arrays.asList(2, 3), memoMirror);
    assertEquals(2, counter.get());

    assertEquals(Arrays.asList(2, 3, 4), memoizing);
    assertEquals(3, counter.get());
    assertEquals(Arrays.asList(2, 3, 4), memoized);
    assertEquals(Arrays.asList(2, 3, 4), memoMirror);
}
 
Example #24
Source File: EquipmentPreferencesModel.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
IntegerProperty maxPotionLevelProperty()
{
	return maxPotionLevel;
}
 
Example #25
Source File: HighlightingStreamConverter.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
@Override
public IntegerProperty activeFragmentAlphaProperty()
{
	return this.activeFragmentAlpha;
}
 
Example #26
Source File: IntegerJavaFXBidirectionalBinder.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
public IntegerJavaFXBidirectionalBinder(final IntegerProperty javaFxProperty) {
    super(javaFxProperty);
}
 
Example #27
Source File: CurvedSpringMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty lengthCropProperty() {
    return lengthCrop;
}
 
Example #28
Source File: SegmentedTorusMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty minorRadiusDivisionsProperty() {
    return minorRadiusDivisions;
}
 
Example #29
Source File: MGMVRemoveSelectedModal.java    From youtube-comment-suite with MIT License 4 votes vote down vote up
public IntegerProperty itemsRemovedProperty() {
    return itemsRemoved;
}
 
Example #30
Source File: Text3DMesh.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
public IntegerProperty fontSizeProperty() {
    return fontSize;
}