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.FXRspecChannel;
import javafx.scene.image.Image;

/**
 * User: twalcari
 * Date: 4/23/2015
 * Time: 15:21
 */
public class RspecChannelCanvasNode extends TestbedAwareCanvasNode {

    private final FXRspecChannel channel;

    public RspecChannelCanvasNode(FXRspecChannel channel, TestbedInfoSource testbedInfoSource, JFedGuiConfig config) {
        super(testbedInfoSource, config);
        this.channel = channel;

        setImage(new Image(ImageUtil.class.getResource("/images/wireless-channel.png").toExternalForm()));

        textProperty().bind(channel.componentNameProperty());

        layoutXProperty().bindBidirectional(channel.editorXProperty());
        layoutYProperty().bindBidirectional(channel.editorYProperty());

        componentManagerId.bind(channel.componentManagerIdProperty());
    }

    public FXRspecChannel getChannel() {
        return channel;
    }

}
