Ignore:
Timestamp:
2017-09-07T00:41:30+02:00 (4 years ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - remove GUI stuff from MessageNotifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12760 r12766  
    88import java.awt.Dimension;
    99import java.awt.GraphicsEnvironment;
     10import java.awt.GridBagLayout;
    1011import java.awt.event.KeyEvent;
    1112import java.io.File;
     
    4849import javax.swing.InputMap;
    4950import javax.swing.JComponent;
     51import javax.swing.JLabel;
    5052import javax.swing.JOptionPane;
     53import javax.swing.JPanel;
    5154import javax.swing.KeyStroke;
    5255import javax.swing.LookAndFeel;
     
    8083import org.openstreetmap.josm.data.osm.DataSet;
    8184import org.openstreetmap.josm.data.osm.OsmPrimitive;
     85import org.openstreetmap.josm.data.osm.UserInfo;
    8286import org.openstreetmap.josm.data.osm.search.SearchMode;
    8387import org.openstreetmap.josm.data.validation.OsmValidator;
     
    107111import org.openstreetmap.josm.gui.util.RedirectInputMap;
    108112import org.openstreetmap.josm.gui.util.WindowGeometry;
     113import org.openstreetmap.josm.gui.widgets.UrlLabel;
    109114import org.openstreetmap.josm.io.CertificateAmendment;
    110115import org.openstreetmap.josm.io.DefaultProxySelector;
     
    122127import org.openstreetmap.josm.plugins.PluginInformation;
    123128import org.openstreetmap.josm.tools.FontsManager;
     129import org.openstreetmap.josm.tools.GBC;
    124130import org.openstreetmap.josm.tools.HttpClient;
    125131import org.openstreetmap.josm.tools.I18n;
     
    968974
    969975    static void setupCallbacks() {
     976        MessageNotifier.setNotifierCallback(MainApplication::notifyNewMessages);
    970977        DeleteCommand.setDeletionCallback(DeleteAction.defaultDeletionCallback);
    971978    }
     
    13071314        }
    13081315    }
     1316
     1317    static void notifyNewMessages(UserInfo userInfo) {
     1318        GuiHelper.runInEDT(() -> {
     1319            JPanel panel = new JPanel(new GridBagLayout());
     1320            panel.add(new JLabel(trn("You have {0} unread message.", "You have {0} unread messages.",
     1321                    userInfo.getUnreadMessages(), userInfo.getUnreadMessages())),
     1322                    GBC.eol());
     1323            panel.add(new UrlLabel(Main.getBaseUserUrl() + '/' + userInfo.getDisplayName() + "/inbox",
     1324                    tr("Click here to see your inbox.")), GBC.eol());
     1325            panel.setOpaque(false);
     1326            new Notification().setContent(panel)
     1327                .setIcon(JOptionPane.INFORMATION_MESSAGE)
     1328                .setDuration(Notification.TIME_LONG)
     1329                .show();
     1330        });
     1331    }
    13091332}
Note: See TracChangeset for help on using the changeset viewer.