Search in sources :

Example 1 with HyperLinkController

use of delta.common.ui.swing.labels.HyperLinkController in project lotro-companion by dmorcellet.

the class AboutPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    GridBagConstraints c;
    int x = 0;
    int y = 0;
    // Icon (if any)
    String iconPath = "/resources/gui/ring/ring48.png";
    Image icon = IconsManager.getImage(iconPath);
    c = new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 20, 10, 5), 0, 0);
    ImageIcon imageIcon = new ImageIcon(icon);
    JLabel lbIcon = new JLabel(imageIcon);
    panel.add(lbIcon, c);
    x++;
    // Project name
    JLabel lbName = new JLabel("LotRO Companion");
    lbName.setFont(lbName.getFont().deriveFont(Font.BOLD, 36));
    c = new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 10, 20), 0, 0);
    panel.add(lbName, c);
    y++;
    // Project version
    String projectVersion = buildProjectVersion();
    JLabel lbVersion = new JLabel(projectVersion);
    lbVersion.setFont(lbVersion.getFont().deriveFont(Font.BOLD, 24));
    c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 10, 5), 0, 0);
    panel.add(lbVersion, c);
    y++;
    // Project contact
    JPanel contactPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.CENTER));
    JLabel contactLabel = GuiFactory.buildLabel("Contact: ");
    Font font = lbVersion.getFont().deriveFont(Font.BOLD, 16);
    contactLabel.setFont(font);
    contactPanel.add(contactLabel);
    MailToHyperlinkAction mailAction = new MailToHyperlinkAction("lotrocompanion@gmail.com", "Contact");
    _mail = new HyperLinkController(mailAction);
    JLabel lbEmail = _mail.getLabel();
    lbEmail.setFont(font);
    contactPanel.add(lbEmail);
    c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 5, 5), 0, 0);
    panel.add(contactPanel, c);
    y++;
    // Source code
    {
        JPanel sourcePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.CENTER));
        JLabel sourceLabel = GuiFactory.buildLabel("Source code: ");
        sourceLabel.setFont(font);
        sourcePanel.add(sourceLabel);
        BrowserHyperlinkAction githubAction = new BrowserHyperlinkAction("https://github.com/dmorcellet/lotro-companion", "lotro-companion@GitHub");
        HyperLinkController github = new HyperLinkController(githubAction);
        JLabel lbGitHub = github.getLabel();
        lbGitHub.setFont(font);
        sourcePanel.add(lbGitHub);
        c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0);
        panel.add(sourcePanel, c);
        y++;
    }
    // Facebook
    {
        JPanel facebookPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.CENTER));
        JLabel seeUsLabel = GuiFactory.buildLabel("News: ");
        seeUsLabel.setFont(font);
        facebookPanel.add(seeUsLabel);
        BrowserHyperlinkAction facebookAction = new BrowserHyperlinkAction("https://www.facebook.com/lotrocompanion/", "lotro-companion@Facebook");
        HyperLinkController facebook = new HyperLinkController(facebookAction);
        JLabel lbFacebook = facebook.getLabel();
        lbFacebook.setFont(font);
        facebookPanel.add(lbFacebook);
        c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 10, 5), 0, 0);
        panel.add(facebookPanel, c);
        y++;
    }
    // Contributors label contrib
    JLabel lbContributors = new JLabel("Contributors:");
    lbContributors.setFont(lbVersion.getFont().deriveFont(Font.BOLD, 24));
    c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 15, 10, 5), 0, 0);
    panel.add(lbContributors, c);
    y++;
    // Project contributors
    JPanel contributorsPanel = buildContributorsPanel();
    c = new GridBagConstraints(0, y, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0);
    panel.add(contributorsPanel, c);
    y++;
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) HyperLinkController(delta.common.ui.swing.labels.HyperLinkController) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Image(java.awt.Image) MailToHyperlinkAction(delta.common.ui.swing.labels.MailToHyperlinkAction) Font(java.awt.Font) BrowserHyperlinkAction(delta.common.ui.swing.labels.BrowserHyperlinkAction)

Example 2 with HyperLinkController

use of delta.common.ui.swing.labels.HyperLinkController in project lotro-companion by dmorcellet.

the class DetailedCharacterStatsPanelController method buildLabelForStat.

private JLabel buildLabelForStat(String text, STAT stat) {
    JLabel label = null;
    if (stat != null) {
        final StatCurvesChartConfiguration config = (_statCurvesMgr != null) ? _statCurvesMgr.getConfigForStat(stat) : null;
        if (config != null) {
            ActionListener al = new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    _statCurvesMgr.showStatCurvesWindow(config);
                }
            };
            LocalHyperlinkAction action = new LocalHyperlinkAction(text, al);
            HyperLinkController controller = new HyperLinkController(action);
            label = controller.getLabel();
        }
    }
    if (label == null) {
        label = GuiFactory.buildLabel(text);
    }
    return label;
}
Also used : HyperLinkController(delta.common.ui.swing.labels.HyperLinkController) ActionListener(java.awt.event.ActionListener) LocalHyperlinkAction(delta.common.ui.swing.labels.LocalHyperlinkAction) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) StatCurvesChartConfiguration(delta.games.lotro.gui.character.stats.curves.StatCurvesChartConfiguration)

Example 3 with HyperLinkController

use of delta.common.ui.swing.labels.HyperLinkController in project lotro-companion by dmorcellet.

the class DeedLinksDisplayPanelController method buildController.

private void buildController(String label, DeedProxy proxy) {
    if (proxy != null) {
        String name = proxy.getName();
        final DeedDescription deed = proxy.getDeed();
        ActionListener listener = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                _parent.setDeed(deed);
            }
        };
        LocalHyperlinkAction action = new LocalHyperlinkAction(name, listener);
        HyperLinkController controller = new HyperLinkController(action);
        _labels.add(label);
        _links.add(controller);
    }
}
Also used : HyperLinkController(delta.common.ui.swing.labels.HyperLinkController) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ActionListener(java.awt.event.ActionListener) LocalHyperlinkAction(delta.common.ui.swing.labels.LocalHyperlinkAction) ActionEvent(java.awt.event.ActionEvent)

Example 4 with HyperLinkController

use of delta.common.ui.swing.labels.HyperLinkController in project lotro-companion by dmorcellet.

the class DeedLinksDisplayPanelController method dispose.

/**
 * Release all managed resources.
 */
public void dispose() {
    // Data
    _labels.clear();
    _deed = null;
    // _parent=null;
    for (HyperLinkController link : _links) {
        link.dispose();
    }
    _links.clear();
    // UI
    if (_panel != null) {
        _panel.removeAll();
        _panel = null;
    }
}
Also used : HyperLinkController(delta.common.ui.swing.labels.HyperLinkController)

Example 5 with HyperLinkController

use of delta.common.ui.swing.labels.HyperLinkController in project lotro-companion by dmorcellet.

the class CreditsPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    GridBagConstraints c;
    int x = 0;
    int y = 0;
    // Icon (if any)
    String iconPath = "/resources/gui/ring/ring48.png";
    Image icon = IconsManager.getImage(iconPath);
    c = new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 20, 10, 5), 0, 0);
    ImageIcon imageIcon = new ImageIcon(icon);
    JLabel lbIcon = new JLabel(imageIcon);
    panel.add(lbIcon, c);
    x++;
    // Credits
    JLabel lbName = new JLabel("Credits");
    lbName.setFont(lbName.getFont().deriveFont(Font.BOLD, 36));
    c = new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 5, 10, 20), 0, 0);
    panel.add(lbName, c);
    y++;
    String[] labels = new String[] { "LotroCalc (Giseldah)", "Item Treasury plugin (Galuhad)", "Item Database (Galuhad)", "LOTRO-Wiki", "TitanBar plugin (Habna, Thorondor, Technical-13)", "DynMap Lotro", "The Lord of Rings Online (Turbine/SSG)" };
    String[] urls = new String[] { "https://www.lotro.com/forums/showthread.php?539545-LotroCalc-calculate-stats-amp-plan-upgrades", "http://www.lotrointerface.com/downloads/info870-ItemTreasury.html", "http://www.lotrointerface.com/downloads/info869-ItemDatabase.html", "http://lotro-wiki.com/", "http://www.lotrointerface.com/downloads/info692-TitanBar.html", "http://dynmap.ruslotro.com/", "https://www.lotro.com/en" };
    // Credit lines
    int nbCredits = Math.min(labels.length, urls.length);
    for (int i = 0; i < nbCredits; i++) {
        BrowserHyperlinkAction creditAction = new BrowserHyperlinkAction(urls[i], labels[i]);
        HyperLinkController creditLink = new HyperLinkController(creditAction);
        JLabel linkLabel = creditLink.getLabel();
        c = new GridBagConstraints(0, y, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0);
        panel.add(linkLabel, c);
        y++;
    }
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) HyperLinkController(delta.common.ui.swing.labels.HyperLinkController) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) BrowserHyperlinkAction(delta.common.ui.swing.labels.BrowserHyperlinkAction) JLabel(javax.swing.JLabel) Image(java.awt.Image)

Aggregations

HyperLinkController (delta.common.ui.swing.labels.HyperLinkController)5 JLabel (javax.swing.JLabel)3 BrowserHyperlinkAction (delta.common.ui.swing.labels.BrowserHyperlinkAction)2 LocalHyperlinkAction (delta.common.ui.swing.labels.LocalHyperlinkAction)2 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Image (java.awt.Image)2 Insets (java.awt.Insets)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 ImageIcon (javax.swing.ImageIcon)2 JPanel (javax.swing.JPanel)2 MailToHyperlinkAction (delta.common.ui.swing.labels.MailToHyperlinkAction)1 StatCurvesChartConfiguration (delta.games.lotro.gui.character.stats.curves.StatCurvesChartConfiguration)1 DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)1 FlowLayout (java.awt.FlowLayout)1 Font (java.awt.Font)1