use of com.kotcrab.vis.ui.widget.VisValidatableTextField in project HyperLap2D by rednblackgames.
the class ValueFloatBoxProducer method createValuePart.
private GraphBoxPartImpl<T> createValuePart(Skin skin, float v1) {
final VisValidatableTextField v1Input = new VisValidatableTextField(Validators.FLOATS) {
@Override
public float getPrefWidth() {
return 80;
}
};
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 Label("Value: ", skin));
horizontalGroup.addActor(v1Input);
GraphBoxPartImpl<T> colorPart = new GraphBoxPartImpl<T>(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(Map<String, String> object) {
object.put("v1", v1Input.getText());
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
return colorPart;
}
use of com.kotcrab.vis.ui.widget.VisValidatableTextField in project HyperLap2D by rednblackgames.
the class ValueParamBoxProducer method createValuePart.
private GraphBoxPartImpl<T> createValuePart(Skin skin, String name) {
final VisValidatableTextField v1Input = new VisValidatableTextField(new StringNameValidator()) {
@Override
public float getPrefWidth() {
return 80;
}
};
v1Input.setText(name);
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 Label("Name: ", skin));
horizontalGroup.addActor(v1Input);
GraphBoxPartImpl<T> colorPart = new GraphBoxPartImpl<T>(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(Map<String, String> object) {
object.put("v", v1Input.getText());
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
return colorPart;
}
use of com.kotcrab.vis.ui.widget.VisValidatableTextField in project HyperLap2D by rednblackgames.
the class ValueVector2BoxProducer method createValuePart.
private GraphBoxPartImpl<T> createValuePart(Skin skin, 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 Label("X: ", skin));
horizontalGroup.addActor(v1Input);
horizontalGroup.addActor(new Label(" Y: ", skin));
horizontalGroup.addActor(v2Input);
GraphBoxPartImpl<T> colorPart = new GraphBoxPartImpl<T>(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(Map<String, String> object) {
object.put("v1", v1Input.getText());
object.put("v2", v2Input.getText());
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
return colorPart;
}
use of com.kotcrab.vis.ui.widget.VisValidatableTextField in project HyperLap2D by rednblackgames.
the class EventActionBoxProducer method createValuePart.
private GraphBoxPartImpl<T> createValuePart(Skin skin, String name) {
final VisValidatableTextField v1Input = new VisValidatableTextField(new StringNameValidator()) {
@Override
public float getPrefWidth() {
return 80;
}
};
v1Input.setText(name);
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 Label("Name: ", skin));
horizontalGroup.addActor(v1Input);
GraphBoxPartImpl<T> colorPart = new GraphBoxPartImpl<T>(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(Map<String, String> object) {
object.put("v", v1Input.getText());
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("action"));
return colorPart;
}
use of com.kotcrab.vis.ui.widget.VisValidatableTextField in project gdx-graph by MarcinSc.
the class Vector4BoxPart method createInput.
private VisValidatableTextField createInput(InputValidator inputValidator, float defaultValue) {
final VisValidatableTextField result;
if (inputValidator != null) {
result = new VisValidatableTextField(Validators.FLOATS, inputValidator) {
@Override
public float getPrefWidth() {
return 50;
}
};
} else
result = new VisValidatableTextField(Validators.FLOATS) {
@Override
public float getPrefWidth() {
return 50;
}
};
result.setText(String.valueOf(defaultValue));
result.setAlignment(Align.right);
result.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
result.fire(new GraphChangedEvent(false, true));
}
});
return result;
}
Aggregations