use of com.kotcrab.vis.ui.widget.VisLabel in project gdx-graph by MarcinSc.
the class ValueColorBoxProducer method createValuePart.
private GraphBoxPartImpl createValuePart(String value) {
Color color = Color.valueOf(value);
final TextureRegionDrawable drawable = new TextureRegionDrawable(WhitePixel.sharedInstance.texture);
BaseDrawable baseDrawable = new BaseDrawable(drawable) {
@Override
public void draw(Batch batch, float x, float y, float width, float height) {
drawable.draw(batch, x, y, width, height);
}
};
baseDrawable.setMinSize(20, 20);
final VisImage image = new VisImage(baseDrawable);
image.setColor(color);
final ColorPicker picker = new ColorPicker(new ColorPickerAdapter() {
@Override
public void finished(Color newColor) {
image.setColor(newColor);
image.fire(new GraphChangedEvent(false, true));
}
});
picker.setColor(color);
image.addListener(new ClickListener(Input.Buttons.LEFT) {
@Override
public void clicked(InputEvent event, float x, float y) {
// displaying picker with fade in animation
image.getStage().addActor(picker.fadeIn());
}
});
VisTable table = new VisTable();
table.add(new VisLabel("Color")).growX();
table.add(image);
table.row();
GraphBoxPartImpl colorPart = new GraphBoxPartImpl(table, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(JsonValue object) {
object.addChild("color", new JsonValue(image.getColor().toString()));
}
}) {
@Override
public void dispose() {
picker.dispose();
}
};
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
return colorPart;
}
use of com.kotcrab.vis.ui.widget.VisLabel in project gdx-graph by MarcinSc.
the class ValueFloatBoxProducer method createValuePart.
private GraphBoxPartImpl createValuePart(float v1) {
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));
}
});
HorizontalGroup horizontalGroup = new HorizontalGroup();
horizontalGroup.addActor(new VisLabel("x"));
horizontalGroup.addActor(v1Input);
GraphBoxPartImpl colorPart = new GraphBoxPartImpl(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(JsonValue object) {
float value;
try {
value = Float.parseFloat(v1Input.getText());
} catch (NumberFormatException exp) {
value = 0f;
}
object.addChild("v1", new JsonValue(value));
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
return colorPart;
}
use of com.kotcrab.vis.ui.widget.VisLabel in project vis-ui by kotcrab.
the class TestMultiSplitPane method addVisWidgets.
private void addVisWidgets() {
VisLabel label = new VisLabel("Label #1");
VisLabel label2 = new VisLabel("Label #2");
VisLabel label3 = new VisLabel("Label #3");
MultiSplitPane splitPane = new MultiSplitPane(vertical);
splitPane.setWidgets(label, label2, label3);
add(splitPane).fill().expand();
}
use of com.kotcrab.vis.ui.widget.VisLabel in project vis-ui by kotcrab.
the class TestGenerateDisabledImage method addVisWidgets.
private void addVisWidgets() {
Drawable icon = VisUI.getSkin().getDrawable("icon-folder");
VisImageButton normal = new VisImageButton(icon);
VisImageButton disabled = new VisImageButton(icon);
disabled.setGenerateDisabledImage(true);
disabled.setDisabled(true);
add(new VisLabel("VisImageButton normal"));
add(normal).row();
add(new VisLabel("VisImageButton disabled"));
add(disabled).row();
VisImageTextButton normalText = new VisImageTextButton("text", icon);
VisImageTextButton disabledText = new VisImageTextButton("text", icon);
disabledText.setGenerateDisabledImage(true);
disabledText.setDisabled(true);
add(new VisLabel("VisImageTextButton normal"));
add(normalText).row();
add(new VisLabel("VisImageTextButton disabled"));
add(disabledText).padBottom(3f).row();
}
use of com.kotcrab.vis.ui.widget.VisLabel in project vis-ui by kotcrab.
the class TestSplitPane method addVisWidgets.
private void addVisWidgets() {
VisLabel label = new VisLabel("Lorem \nipsum \ndolor \nsit \namet");
VisLabel label2 = new VisLabel("Consectetur \nadipiscing \nelit");
VisTable table = new VisTable(true);
VisTable table2 = new VisTable(true);
table.add(label);
table2.add(label2);
VisSplitPane splitPane = new VisSplitPane(table, table2, vertical);
add(splitPane).fill().expand();
}
Aggregations