package be.iminds.ilabt.jfed.experimenter_gui.canvas.rspec;

import be.iminds.ilabt.jfed.experimenter_gui.config.JFedGuiConfig;
import be.iminds.ilabt.jfed.experimenter_gui.canvas.TestbedAwareCanvasNode;
import be.iminds.ilabt.jfed.experimenter_gui.util.ImageUtil;

import be.iminds.ilabt.jfed.lowlevel.TestbedInfoSource;
import be.iminds.ilabt.jfed.rspec.model.javafx_impl.FXAddressPool;
import javafx.scene.image.Image;

/**
 * User: twalcari
 * Date: 10/28/2015
 * Time: 12:16
 */
public class AddressPoolCanvasNode  extends TestbedAwareCanvasNode {

    private final FXAddressPool addressPool;

    public AddressPoolCanvasNode(FXAddressPool addressPool, TestbedInfoSource testbedInfoSource, JFedGuiConfig config) {
        super(testbedInfoSource, config);
        setImage(new Image(ImageUtil.class.getResource("/images/node_types/32/addresspool.png").toExternalForm()));
        this.addressPool = addressPool;

        textProperty().bind(addressPool.clientIdProperty());
        componentManagerId.bind(addressPool.componentManagerIdProperty());

        layoutXProperty().bindBidirectional(addressPool.editorXProperty());
        layoutYProperty().bindBidirectional(addressPool.editorYProperty());
    }

    public FXAddressPool getAddressPool() {
        return addressPool;
    }
}
