001package conexp.fx.gui.properties;
002
003/*
004 * #%L
005 * Concept Explorer FX
006 * %%
007 * Copyright (C) 2010 - 2023 Francesco Kriegel
008 * %%
009 * This program is free software: you can redistribute it and/or modify
010 * it under the terms of the GNU General Public License as
011 * published by the Free Software Foundation, either version 3 of the
012 * License, or (at your option) any later version.
013 * 
014 * This program is distributed in the hope that it will be useful,
015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017 * GNU General Public License for more details.
018 * 
019 * You should have received a copy of the GNU General Public
020 * License along with this program.  If not, see
021 * <http://www.gnu.org/licenses/gpl-3.0.html>.
022 * #L%
023 */
024
025import conexp.fx.core.collections.IntPair;
026import javafx.beans.property.SimpleObjectProperty;
027
028public class SimpleIntPairProperty extends SimpleObjectProperty<IntPair> {
029
030  public SimpleIntPairProperty(IntPair initialValue) {
031    super(initialValue);
032  }
033
034  public SimpleIntPairProperty(final int x, final int y) {
035    this(IntPair.valueOf(x, y));
036  }
037
038  public SimpleIntPairProperty() {
039    this(IntPair.zero());
040  }
041
042  public void set(final int x, final int y) {
043    super.set(IntPair.valueOf(x, y));
044  }
045
046//  public final void set(final IntPair coordinates) {
047//    super.set(coordinates.clone());
048//  }
049
050  public SimpleIntPairProperty add(final int x, final int y) {
051    set(super.get().plus(x, y));
052    return this;
053  }
054
055  public SimpleIntPairProperty add(final IntPair coordinates) {
056    set(super.get().plus(coordinates));
057    return this;
058  }
059
060  public SimpleIntPairProperty subtract(final int x, final int y) {
061    set(super.get().minus(x, y));
062    return this;
063  }
064
065  public SimpleIntPairProperty subtract(final IntPair coordinates) {
066    set(super.get().minus(coordinates));
067    return this;
068  }
069
070}