package be.iminds.ilabt.jfed.experimenter_gui.gts_editor.views;

import be.iminds.ilabt.jfed.experimenter_gui.editor.views.EditorViewType;
import be.iminds.ilabt.jfed.experimenter_gui.ui.code.GroovyCodeView;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.layout.Region;

/**
 * User: twalcari
 * Date: 1/29/14
 * Time: 5:03 PM
 */
public class RawGtsDslEditor extends GroovyCodeView implements EditableGtsDslView {

    private final String input;
    private boolean dirty = false;

    private final StringProperty status = new SimpleStringProperty();

    RawGtsDslEditor(String input, boolean dirty) {
        super(input, true);
        this.input = input;
        this.dirty = dirty;
    }


    public String getResultDsl() {
        return getContent();
    }

    @Override
    public boolean isDirty() {
        return dirty || super.isDirty();
    }

    @Override
    public Region getView() {
        return this;
    }

    @Override
    public EditorViewType getType() {
        return EditorViewType.RAW;
    }

    @Override
    public void dispose() {

    }

    @Override
    public ReadOnlyStringProperty statusProperty() {
        return status;
    }
}
