use of gaiasky.util.scene2d.OwnTextField in project gaiasky by langurmonkey.
the class LandAtWindow method build.
@Override
protected void build() {
latlonCb = new OwnCheckBox(I18n.txt("context.lonlat"), skin, "radio", pad10);
latlonCb.setChecked(false);
latlonCb.addListener(new EventListener() {
@Override
public boolean handle(com.badlogic.gdx.scenes.scene2d.Event event) {
if (event instanceof ChangeEvent) {
if (latlonCb.isChecked()) {
enableComponents(false, location);
enableComponents(true, longitude, latitude);
stage.setKeyboardFocus(longitude);
}
return true;
}
return false;
}
});
longitude = new OwnTextField("", skin, new FloatValidator(0, 360));
latitude = new OwnTextField("", skin, new FloatValidator(-90, 90));
locationCb = new OwnCheckBox(I18n.txt("context.location"), skin, "radio", pad10);
locationCb.setChecked(true);
locationCb.addListener(new EventListener() {
@Override
public boolean handle(com.badlogic.gdx.scenes.scene2d.Event event) {
if (event instanceof ChangeEvent) {
if (locationCb.isChecked()) {
enableComponents(true, location);
enableComponents(false, longitude, latitude);
stage.setKeyboardFocus(location);
}
return true;
}
return false;
}
});
location = new OwnTextField("", skin, new ExistingLocationValidator(target));
new ButtonGroup<CheckBox>(latlonCb, locationCb);
content.add(locationCb).left().top().padBottom(pad10).colspan(4).row();
content.add(new OwnLabel(I18n.txt("context.location"), skin)).left().top().padRight(pad10);
content.add(location).left().top().padBottom(pad10 * 2).row();
content.add(latlonCb).left().top().padBottom(pad10).colspan(4).row();
content.add(new OwnLabel(I18n.txt("context.longitude"), skin)).left().top().padRight(pad10);
content.add(longitude).left().top().padRight(pad10 * 2);
content.add(new OwnLabel(I18n.txt("context.latitude"), skin)).left().top().padRight(pad10);
content.add(latitude).left().top();
}
use of gaiasky.util.scene2d.OwnTextField in project gaiasky by langurmonkey.
the class AddShapeDialog method build.
@Override
protected void build() {
content.clear();
OwnLabel info = new OwnLabel(I18n.txt("gui.shape.info", object.getName()), skin, "hud-subheader");
content.add(info).left().padBottom(pad15).row();
// Name
addName(content, "1 AU from " + objectName);
// Size
FloatValidator val = new FloatValidator(0f, Float.MAX_VALUE);
size = new OwnTextField("1.0", skin, val);
size.setWidth(fieldWidth * 0.6f);
size.addListener((event) -> {
if (event instanceof ChangeEvent) {
recomputeObjectName();
}
return true;
});
units = new OwnSelectBox<>(skin);
units.setWidth(fieldWidth * 0.3f);
units.setItems(Units.values());
units.setSelected(Units.AU);
units.addListener((event) -> {
if (event instanceof ChangeEvent) {
recomputeObjectName();
}
return true;
});
HorizontalGroup sizeGroup = new HorizontalGroup();
sizeGroup.space(15f);
sizeGroup.addActor(size);
sizeGroup.addActor(units);
content.add(new OwnLabel(I18n.txt("gui.shape.size"), skin, titleWidth)).left().padRight(pad10).padBottom(pad10);
content.add(sizeGroup).left().padBottom(pad10).row();
// Show label
showLabel = new OwnCheckBox(I18n.txt("gui.shape.label"), skin, pad5);
showLabel.setChecked(true);
content.add(showLabel).left().colspan(2).padRight(pad10).padBottom(pad10).row();
// Track
track = new OwnCheckBox(I18n.txt("gui.shape.track"), skin, pad5);
track.setChecked(true);
content.add(track).left().colspan(2).padRight(pad10).padBottom(pad5);
// Separator
addSeparator(2);
// Shape
shape = new OwnSelectBox<>(skin);
shape.setWidth(fieldWidth);
shape.setItems(Shape.values());
shape.setSelected(Shape.SPHERE);
content.add(new OwnLabel(I18n.txt("gui.shape.shape"), skin, titleWidth)).left().padRight(pad10).padBottom(pad10);
content.add(shape).left().padBottom(pad10).row();
// Color
addColor(content);
// Primitive
primitive = new OwnSelectBox<>(skin);
primitive.setWidth(fieldWidth);
primitive.setItems(Primitive.values());
primitive.setSelected(Primitive.LINES);
content.add(new OwnLabel(I18n.txt("gui.shape.primitive"), skin, titleWidth)).left().padRight(pad10).padBottom(pad10);
content.add(primitive).left().padBottom(pad10).row();
}
use of gaiasky.util.scene2d.OwnTextField in project gaiasky by langurmonkey.
the class AddShapeDialog method addName.
private void addName(Table container, String text) {
name = new OwnTextField(text, skin);
name.setWidth(fieldWidth);
name.addListener((event) -> {
if (event instanceof ChangeEvent) {
if (!name.getText().equals(text)) {
canRecomputeName = false;
}
}
return true;
});
container.add(new OwnLabel(I18n.txt("gui.shape.name"), skin, titleWidth)).left().padRight(pad10).padBottom(pad10);
container.add(name).left().padBottom(pad10).row();
}
use of gaiasky.util.scene2d.OwnTextField in project gaiasky by langurmonkey.
the class KeyframePreferencesWindow method build.
@Override
protected void build() {
ComboBoxBean[] interpolation = new ComboBoxBean[] { new ComboBoxBean(I18n.txt("gui.interpolation.linear"), CameraKeyframeManager.PathType.LINEAR.ordinal()), new ComboBoxBean(I18n.txt("gui.interpolation.catmull"), CameraKeyframeManager.PathType.SPLINE.ordinal()) };
OwnLabel generalTitle = new OwnLabel(I18n.txt("gui.general"), skin, "hud-header");
// fps
OwnLabel camfpsLabel = new OwnLabel(I18n.txt("gui.target.fps"), skin);
camrecFps = new OwnTextField(nf3.format(Settings.settings.camrecorder.targetFps), skin, new DoubleValidator(Constants.MIN_FPS, Constants.MAX_FPS));
camrecFps.setWidth(240f);
OwnLabel interpTitle = new OwnLabel(I18n.txt("gui.keyframes.interp"), skin, "hud-header");
// Camera position
OwnLabel pos = new OwnLabel(I18n.txt("gui.cam.pos"), skin);
posMethod = new OwnSelectBox<>(skin);
posMethod.setItems(interpolation);
posMethod.setSelectedIndex(Settings.settings.camrecorder.keyframe.position.ordinal());
posMethod.setItems(interpolation);
posMethod.setWidth(240f);
// Camera orientation
OwnLabel orientation = new OwnLabel(I18n.txt("gui.cam.orientation"), skin);
orientationMethod = new OwnSelectBox<>(skin);
orientationMethod.setItems(interpolation);
orientationMethod.setSelectedIndex(Settings.settings.camrecorder.keyframe.orientation.ordinal());
orientationMethod.setItems(interpolation);
orientationMethod.setWidth(240f);
// Time
OwnLabel time = new OwnLabel(I18n.txt("gui.time"), skin);
OwnLabel timeMethod = new OwnLabel(I18n.txt("gui.interpolation.linear"), skin);
content.add(generalTitle).left().top().colspan(2).padBottom(pad10).row();
content.add(camfpsLabel).left().padRight(pad10).padBottom(pad10 * 3f);
content.add(camrecFps).left().padBottom(pad10 * 3f).row();
content.add(interpTitle).left().top().colspan(2).padBottom(pad10).row();
content.add(pos).left().padRight(pad10).padBottom(pad10);
content.add(posMethod).left().padBottom(pad10).row();
content.add(orientation).left().padRight(pad10).padBottom(pad10);
content.add(orientationMethod).left().padBottom(pad10).row();
content.add(time).left().padRight(pad10).padBottom(pad10 * 3f);
content.add(timeMethod).left().padBottom(pad10 * 3f).row();
}
Aggregations