Search in sources :

Example 26 with VisLabel

use of com.kotcrab.vis.ui.widget.VisLabel in project gdx-graph by MarcinSc.

the class GraphBoxImpl method addOutputGraphPart.

public void addOutputGraphPart(GraphNodeOutput graphNodeOutput) {
    VisTable table = new VisTable();
    VisLabel outputLabel = new VisLabel(graphNodeOutput.getFieldName());
    outputLabel.setAlignment(Align.right);
    table.add(outputLabel).grow().row();
    GraphBoxPartImpl graphBoxPart = new GraphBoxPartImpl(table, null);
    graphBoxPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, graphNodeOutput);
    addGraphBoxPart(graphBoxPart);
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable) VisLabel(com.kotcrab.vis.ui.widget.VisLabel)

Example 27 with VisLabel

use of com.kotcrab.vis.ui.widget.VisLabel in project gdx-graph by MarcinSc.

the class ValueVector3BoxProducer method createValuePart.

private GraphBoxPartImpl createValuePart(float v1, float v2, float v3) {
    final VisValidatableTextField v1Input = new VisValidatableTextField(Validators.FLOATS) {

        @Override
        public float getPrefWidth() {
            return 50;
        }
    };
    v1Input.setText(String.valueOf(v1));
    v1Input.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            v1Input.fire(new GraphChangedEvent(false, true));
        }
    });
    final VisValidatableTextField v2Input = new VisValidatableTextField(Validators.FLOATS) {

        @Override
        public float getPrefWidth() {
            return 50;
        }
    };
    v2Input.setText(String.valueOf(v2));
    v2Input.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            v2Input.fire(new GraphChangedEvent(false, true));
        }
    });
    final VisValidatableTextField v3Input = new VisValidatableTextField(Validators.FLOATS) {

        @Override
        public float getPrefWidth() {
            return 50;
        }
    };
    v3Input.setText(String.valueOf(v3));
    v3Input.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            v3Input.fire(new GraphChangedEvent(false, true));
        }
    });
    HorizontalGroup horizontalGroup = new HorizontalGroup();
    horizontalGroup.addActor(new VisLabel("x"));
    horizontalGroup.addActor(v1Input);
    horizontalGroup.addActor(new VisLabel("y"));
    horizontalGroup.addActor(v2Input);
    horizontalGroup.addActor(new VisLabel("z"));
    horizontalGroup.addActor(v3Input);
    GraphBoxPartImpl colorPart = new GraphBoxPartImpl(horizontalGroup, new GraphBoxPartImpl.Callback() {

        @Override
        public void serialize(JsonValue object) {
            object.addChild("v1", new JsonValue(Float.parseFloat(v1Input.getText())));
            object.addChild("v2", new JsonValue(Float.parseFloat(v2Input.getText())));
            object.addChild("v3", new JsonValue(Float.parseFloat(v3Input.getText())));
        }
    });
    colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
    return colorPart;
}
Also used : Actor(com.badlogic.gdx.scenes.scene2d.Actor) JsonValue(com.badlogic.gdx.utils.JsonValue) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) HorizontalGroup(com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup) VisValidatableTextField(com.kotcrab.vis.ui.widget.VisValidatableTextField)

Example 28 with VisLabel

use of com.kotcrab.vis.ui.widget.VisLabel in project gdx-graph by MarcinSc.

the class ValueVector2BoxProducer method createValuePart.

private GraphBoxPartImpl createValuePart(float v1, float v2) {
    final VisValidatableTextField v1Input = new VisValidatableTextField(Validators.FLOATS) {

        @Override
        public float getPrefWidth() {
            return 50;
        }
    };
    v1Input.setText(String.valueOf(v1));
    v1Input.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            v1Input.fire(new GraphChangedEvent(false, true));
        }
    });
    final VisValidatableTextField v2Input = new VisValidatableTextField(Validators.FLOATS) {

        @Override
        public float getPrefWidth() {
            return 50;
        }
    };
    v2Input.setText(String.valueOf(v2));
    v2Input.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            v2Input.fire(new GraphChangedEvent(false, true));
        }
    });
    HorizontalGroup horizontalGroup = new HorizontalGroup();
    horizontalGroup.addActor(new VisLabel("x"));
    horizontalGroup.addActor(v1Input);
    horizontalGroup.addActor(new VisLabel("y"));
    horizontalGroup.addActor(v2Input);
    GraphBoxPartImpl colorPart = new GraphBoxPartImpl(horizontalGroup, new GraphBoxPartImpl.Callback() {

        @Override
        public void serialize(JsonValue object) {
            object.addChild("v1", new JsonValue(Float.parseFloat(v1Input.getText())));
            object.addChild("v2", new JsonValue(Float.parseFloat(v2Input.getText())));
        }
    });
    colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
    return colorPart;
}
Also used : Actor(com.badlogic.gdx.scenes.scene2d.Actor) JsonValue(com.badlogic.gdx.utils.JsonValue) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) HorizontalGroup(com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup) VisValidatableTextField(com.kotcrab.vis.ui.widget.VisValidatableTextField)

Aggregations

VisLabel (com.kotcrab.vis.ui.widget.VisLabel)28 VisTable (com.kotcrab.vis.ui.widget.VisTable)10 Actor (com.badlogic.gdx.scenes.scene2d.Actor)4 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)4 JsonValue (com.badlogic.gdx.utils.JsonValue)4 VisValidatableTextField (com.kotcrab.vis.ui.widget.VisValidatableTextField)4 HorizontalGroup (com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup)3 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)3 VisTextButton (com.kotcrab.vis.ui.widget.VisTextButton)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 VisImageButton (com.kotcrab.vis.ui.widget.VisImageButton)2 Color (com.badlogic.gdx.graphics.Color)1 Batch (com.badlogic.gdx.graphics.g2d.Batch)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 Vector2 (com.badlogic.gdx.math.Vector2)1 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)1 BaseDrawable (com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable)1 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)1