use of gaiasky.util.validator.ExistingLocationValidator 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();
}
Aggregations