Search in sources :

Example 1 with Link

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);
}
Also used : GenericDialog(gaiasky.interafce.GenericDialog) OwnLabel(gaiasky.util.scene2d.OwnLabel) Link(gaiasky.util.scene2d.Link)

Example 2 with Link

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);
}
Also used : GenericDialog(gaiasky.interafce.GenericDialog) OwnLabel(gaiasky.util.scene2d.OwnLabel) Link(gaiasky.util.scene2d.Link)

Example 3 with Link

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) {
                }
            });
        }
    });
}
Also used : HttpRequest(com.badlogic.gdx.Net.HttpRequest) GaiaSky(gaiasky.GaiaSky) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Constants(gaiasky.util.Constants) Logger(gaiasky.util.Logger) HttpStatus(com.badlogic.gdx.net.HttpStatus) Event(gaiasky.event.Event) Gdx(com.badlogic.gdx.Gdx) HttpResponse(com.badlogic.gdx.Net.HttpResponse) gaiasky.scenegraph(gaiasky.scenegraph) Link(gaiasky.util.scene2d.Link) ChangeEvent(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent) I18n(gaiasky.util.I18n) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Cell(com.badlogic.gdx.scenes.scene2d.ui.Cell) OwnTextTooltip(gaiasky.util.scene2d.OwnTextTooltip) Log(gaiasky.util.Logger.Log) OwnTextButton(gaiasky.util.scene2d.OwnTextButton) EventManager(gaiasky.event.EventManager) HttpMethods(com.badlogic.gdx.Net.HttpMethods) LabelStyle(com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle) HttpResponseListener(com.badlogic.gdx.Net.HttpResponseListener) EventListener(com.badlogic.gdx.scenes.scene2d.EventListener) OwnTextButton(gaiasky.util.scene2d.OwnTextButton) OwnTextTooltip(gaiasky.util.scene2d.OwnTextTooltip) ChangeEvent(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent) Link(gaiasky.util.scene2d.Link)

Example 4 with 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);
}
Also used : Label(com.badlogic.gdx.scenes.scene2d.ui.Label) OwnLabel(gaiasky.util.scene2d.OwnLabel) OwnLabel(gaiasky.util.scene2d.OwnLabel) Link(gaiasky.util.scene2d.Link)

Aggregations

Link (gaiasky.util.scene2d.Link)4 OwnLabel (gaiasky.util.scene2d.OwnLabel)3 GenericDialog (gaiasky.interafce.GenericDialog)2 Gdx (com.badlogic.gdx.Gdx)1 HttpMethods (com.badlogic.gdx.Net.HttpMethods)1 HttpRequest (com.badlogic.gdx.Net.HttpRequest)1 HttpResponse (com.badlogic.gdx.Net.HttpResponse)1 HttpResponseListener (com.badlogic.gdx.Net.HttpResponseListener)1 HttpStatus (com.badlogic.gdx.net.HttpStatus)1 EventListener (com.badlogic.gdx.scenes.scene2d.EventListener)1 Cell (com.badlogic.gdx.scenes.scene2d.ui.Cell)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 LabelStyle (com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle)1 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 ChangeEvent (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent)1 GaiaSky (gaiasky.GaiaSky)1 Event (gaiasky.event.Event)1 EventManager (gaiasky.event.EventManager)1 gaiasky.scenegraph (gaiasky.scenegraph)1