package be.iminds.ilabt.jfed.gts.model.impl;

import be.iminds.ilabt.jfed.gts.model.GtsPort;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;

/**
 * User: twalcari
 * Date: 6/5/2015
 * Time: 15:58
 */
public class FXGtsPort implements GtsPort {

    private final StringProperty id = new SimpleStringProperty();
    private final StringProperty mode = new SimpleStringProperty();
    private final ObjectProperty<Integer> lineRate = new SimpleObjectProperty<>();
    private final StringProperty directionality = new SimpleStringProperty();

    private final DoubleProperty editorX = new SimpleDoubleProperty(-1.0);
    private final DoubleProperty editorY = new SimpleDoubleProperty(-1.0);

    private final ObservableMap<String,String> extraProperties = FXCollections.observableHashMap();

    FXGtsPort(){}

    FXGtsPort(GtsPort port) {
        this.id.set(port.getId());

    }

    public String getId() {
        return id.get();
    }

    public StringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }

    @Override
    public String getMode() {
        return mode.get();
    }

    public StringProperty modeProperty() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode.set(mode);
    }

    @Override
    public Integer getLineRate() {
        return lineRate.get();
    }

    public ObjectProperty<Integer> lineRateProperty() {
        return lineRate;
    }

    public void setLineRate(Integer lineRate) {
        this.lineRate.set(lineRate);
    }

    @Override
    public String getDirectionality() {
        return directionality.get();
    }

    public StringProperty directionalityProperty() {
        return directionality;
    }

    public void setDirectionality(String directionality) {
        this.directionality.set(directionality);
    }

    @Override
    public double getEditorX() {
        return editorX.get();
    }

    public DoubleProperty editorXProperty() {
        return editorX;
    }

    public void setEditorX(double editorX) {
        this.editorX.set(editorX);
    }

    @Override
    public double getEditorY() {
        return editorY.get();
    }

    public DoubleProperty editorYProperty() {
        return editorY;
    }

    public void setEditorY(double editorY) {
        this.editorY.set(editorY);
    }

    public ObservableMap<String, String> getExtraProperties() {
        return extraProperties;
    }
}
