use of gaiasky.util.scene2d.Link in project gaiasky by langurmonkey.
the class GuiUtils method addNoConnectionWindow.
public static void addNoConnectionWindow(Skin skin, Stage stage, Runnable ok) {
GenericDialog exitw = new GenericDialog(I18n.txt("notif.error", I18n.txt("gui.download.noconnection.title")), skin, stage) {
@Override
protected void build() {
OwnLabel info = new OwnLabel(I18n.txt("gui.download.noconnection.continue"), skin);
Link manualDownload = new Link(I18n.txt("gui.download.manual"), skin, "link", Settings.settings.program.url.dataMirror);
content.add(info).pad(10).row();
content.add(manualDownload).pad(10);
}
@Override
protected void accept() {
if (ok != null) {
ok.run();
}
}
@Override
protected void cancel() {
}
@Override
public void dispose() {
}
};
exitw.setAcceptText(I18n.txt("gui.ok"));
exitw.setCancelText(null);
exitw.buildSuper();
exitw.show(stage);
}
use of gaiasky.util.scene2d.Link in project gaiasky by langurmonkey.
the class GuiUtils method addNoConnectionExit.
public static void addNoConnectionExit(Skin skin, Stage stage) {
GenericDialog exitw = new GenericDialog(I18n.txt("notif.error", I18n.txt("gui.download.noconnection.title")), skin, stage) {
@Override
protected void build() {
OwnLabel info = new OwnLabel(I18n.txt("gui.download.noconnection"), skin);
OwnLabel gsExit = new OwnLabel(I18n.txt("notif.gaiasky.exit"), skin);
Link manualDownload = new Link(I18n.txt("gui.download.manual"), skin, "link", "https://gaia.ari.uni-heidelberg.de/gaiasky/files/autodownload");
content.add(info).left().pad(10).row();
content.add(gsExit).left().pad(10).row();
content.add(manualDownload).pad(10);
}
@Override
protected void accept() {
Gdx.app.exit();
}
@Override
protected void cancel() {
Gdx.app.exit();
}
@Override
public void dispose() {
}
};
exitw.setAcceptText(I18n.txt("gui.exit"));
exitw.setCancelText(null);
exitw.buildSuper();
exitw.show(stage);
}
use of gaiasky.util.scene2d.Link in project gaiasky by langurmonkey.
the class ExternalInformationUpdater method update.
public void update(final IFocus focus) {
GaiaSky.postRunnable(() -> {
if (focus != null) {
logger.debug("Looking up network resources for '" + focus.getName() + "'");
infoCell = table.add().left();
gaiaCell = table.add().left();
simbadCell = table.add().left();
// Add table
if (focus instanceof IStarFocus) {
EventManager.publish(Event.UPDATE_ARCHIVE_VIEW_ACTION, this, focus);
if (gaiaButton != null)
gaiaButton.remove();
gaiaButton = new OwnTextButton(I18n.txt("gui.focusinfo.archive"), skin);
gaiaButton.pad(pad / 3f, pad, pad / 3f, pad);
gaiaButton.addListener(new GaiaButtonListener((IStarFocus) focus));
gaiaButton.addListener(new OwnTextTooltip(I18n.txt("gui.tooltip.gaiaarchive"), skin));
gaiaCell.setActor(gaiaButton).padRight(pad);
} else {
gaiaCell.padRight(0);
}
String wikiname = focus.getName().replace(' ', '_');
setWikiLink(wikiname, focus, new LinkListener() {
@Override
public void ok(String link) {
if (infoCell != null) {
try {
String actualWikiname = link.substring(Constants.URL_WIKIPEDIA.length());
EventManager.publish(Event.UPDATE_WIKI_INFO_ACTION, this, actualWikiname);
if (infoButton != null)
infoButton.remove();
infoButton = new OwnTextButton(I18n.txt("gui.focusinfo.moreinfo"), skin);
infoButton.addListener(new OwnTextTooltip(I18n.txt("gui.tooltip.wiki"), skin));
infoButton.pad(pad / 3f, pad, pad / 3f, pad);
infoButton.addListener((event) -> {
if (event instanceof ChangeEvent) {
EventManager.publish(Event.SHOW_WIKI_INFO_ACTION, this, actualWikiname);
return true;
}
return false;
});
infoCell.setActor(infoButton).padRight(pad);
} catch (Exception ignored) {
}
}
}
@Override
public void ko(String link) {
if (infoCell != null)
infoCell.padRight(0);
}
});
setSimbadLink(focus, new LinkListener() {
@Override
public void ok(String link) {
if (simbadCell != null) {
try {
if (simbadLink != null) {
simbadLink.remove();
}
simbadLink = new Link(I18n.txt("gui.focusinfo.simbad"), linkStyle, "");
simbadLink.addListener(new OwnTextTooltip(I18n.txt("gui.tooltip.simbad"), skin));
simbadLink.setLinkURL(link);
simbadCell.setActor(simbadLink);
} catch (Exception ignored) {
}
}
}
@Override
public void ko(String link) {
}
});
}
});
}
use of gaiasky.util.scene2d.Link in project gaiasky by langurmonkey.
the class UpdatePopup method build.
@Override
protected void build() {
float padb = 8f;
content.clear();
content.pad(16f);
content.add(new OwnLabel(I18n.txt("gui.newversion.new.current") + ":", skin)).left().padRight(padb).padBottom(padb);
content.add(new OwnLabel(Settings.settings.version.version, skin)).left().padBottom(padb).row();
content.add(new OwnLabel(I18n.txt("gui.newversion.new.new") + ":", skin)).left().padRight(padb).padBottom(padb * 2);
content.add(new OwnLabel(tagVersion, skin, "header")).left().padBottom(padb * 2).row();
Label.LabelStyle linkStyle = skin.get("link", Label.LabelStyle.class);
content.add(new Link(I18n.txt("gui.newversion.getit"), linkStyle, Settings.WEBPAGE_DOWNLOADS)).center().colspan(2);
}
Aggregations