Package org.openstreetmap.josm.io
Class MessageNotifier
- java.lang.Object
-
- org.openstreetmap.josm.io.MessageNotifier
-
public final class MessageNotifier extends java.lang.Object
Notifies user periodically of new received (unread) messages- Since:
- 6349
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMessageNotifier.NotifierCallbackCalled when new new messages are detected.private static classMessageNotifier.Worker
-
Field Summary
Fields Modifier and Type Field Description private static MessageNotifier.NotifierCallbackcallbackprivate static java.util.concurrent.ScheduledExecutorServiceEXECUTORstatic IntegerPropertyPROP_INTERVALProperty defining the update interval in minutesstatic BooleanPropertyPROP_NOTIFIER_ENABLEDProperty defining if this task is enabled or notprivate static java.util.concurrent.ScheduledFuture<?>taskprivate static java.lang.RunnableWORKER
-
Constructor Summary
Constructors Modifier Constructor Description privateMessageNotifier()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisRunning()Determines if the message notifier is currently runningstatic booleanisUserEnoughIdentified()Determines if user set enough information in JOSM preferences to make the request to OSM API without prompting him for a password.static voidsetNotifierCallback(MessageNotifier.NotifierCallback notifierCallback)Sets theMessageNotifier.NotifierCallbackresponsible of notifying the user when new messages are received.static voidstart()Starts the message notifier task if not already started and if user is fully identifiedstatic voidstop()Stops the message notifier task if started
-
-
-
Field Detail
-
callback
private static volatile MessageNotifier.NotifierCallback callback
-
PROP_NOTIFIER_ENABLED
public static final BooleanProperty PROP_NOTIFIER_ENABLED
Property defining if this task is enabled or not
-
PROP_INTERVAL
public static final IntegerProperty PROP_INTERVAL
Property defining the update interval in minutes
-
EXECUTOR
private static final java.util.concurrent.ScheduledExecutorService EXECUTOR
-
WORKER
private static final java.lang.Runnable WORKER
-
task
private static volatile java.util.concurrent.ScheduledFuture<?> task
-
-
Constructor Detail
-
MessageNotifier
private MessageNotifier()
-
-
Method Detail
-
setNotifierCallback
public static void setNotifierCallback(MessageNotifier.NotifierCallback notifierCallback)
Sets theMessageNotifier.NotifierCallbackresponsible of notifying the user when new messages are received.- Parameters:
notifierCallback- the newNotifierCallback
-
start
public static void start()
Starts the message notifier task if not already started and if user is fully identified
-
stop
public static void stop()
Stops the message notifier task if started
-
isRunning
public static boolean isRunning()
Determines if the message notifier is currently running- Returns:
trueif the notifier is running,falseotherwise
-
isUserEnoughIdentified
public static boolean isUserEnoughIdentified()
Determines if user set enough information in JOSM preferences to make the request to OSM API without prompting him for a password.- Returns:
trueif user chose an OAuth token or supplied both its username and password,false otherwise
-
-