Revision 1741 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/threadsafedialogs/DefaultThreadSafeDialogsManager.java
DefaultThreadSafeDialogsManager.java | ||
---|---|---|
45 | 45 |
import org.slf4j.Logger; |
46 | 46 |
import org.slf4j.LoggerFactory; |
47 | 47 |
|
48 |
import com.notification.NotificationFactory; |
|
49 |
import com.notification.NotificationFactory.Location; |
|
50 |
import com.notification.NotificationManager; |
|
51 |
import com.notification.manager.SimpleManager; |
|
52 |
import com.notification.types.TextNotification; |
|
53 |
import com.theme.ThemePackagePresets; |
|
54 |
import com.utils.Time; |
|
55 |
|
|
48 | 56 |
/** |
49 | 57 |
* Thread safe functions for showing dialogs |
50 | 58 |
* |
... | ... | |
85 | 93 |
return this.confirmDialog(message, title, optionType, messageType, null); |
86 | 94 |
} |
87 | 95 |
|
96 |
@Override |
|
97 |
public void message(String message, int message_type) { |
|
98 |
try { |
|
99 |
// makes a factory with the built-in clean theme |
|
100 |
// themes are customizeable |
|
101 |
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanLight()); |
|
102 |
// factories build notifications using a theme, while managers handle how |
|
103 |
// how they appear on the screen |
|
104 |
// this manager just simple pops up the notification in the specified location |
|
105 |
// other managers do sliding, queues, etc. |
|
106 |
NotificationManager plain = new SimpleManager(Location.SOUTHWEST); |
|
107 |
|
|
108 |
// creates a text notification; you can also have progress bar Notifications, |
|
109 |
// icon Notifications, Notifications that ask for user feedback, etc. |
|
110 |
TextNotification notification = factory.buildTextNotification( |
|
111 |
"Message", |
|
112 |
message); |
|
113 |
notification.setCloseOnClick(true); |
|
114 |
// the notification will disappear after 2 seconds, or after you click it |
|
115 |
plain.addNotification(notification, Time.seconds(2)); |
|
116 |
} catch(Exception ex) { |
|
117 |
System.out.println("Message: "+message); |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
88 | 121 |
private static class JMessageWithCheck extends JPanel { |
89 | 122 |
|
90 | 123 |
private static final long serialVersionUID = -1902712909850016361L; |
Also available in: Unified diff