本文整理汇总了Java中com.notification.types.ProgressBarNotification类的典型用法代码示例。如果您正苦于以下问题:Java ProgressBarNotification类的具体用法?Java ProgressBarNotification怎么用?Java ProgressBarNotification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProgressBarNotification类属于com.notification.types包,在下文中一共展示了ProgressBarNotification类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildNotification
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
@Override
public ProgressBarNotification buildNotification(ThemePackage pack, Object... args) {
if (args.length != 1)
throw new NotificationException("ProgressBarNotifications need one argument: title!");
ProgressBarNotification note = new ProgressBarNotification();
note.setWindowTheme(pack.getTheme(WindowTheme.class));
note.setTextTheme(pack.getTheme(TextTheme.class));
note.setTitle((String) args[0]);
return note;
}
示例2: progressBarShouldStartWith0
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
@Test
public void progressBarShouldStartWith0() {
ProgressBarNotification note = new ProgressBarNotification();
assertEquals("ProgressBarNotification should start with 0 progress", 0, note.getProgress());
}
示例3: progressBarShouldNotExceed100
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
@Test
public void progressBarShouldNotExceed100() {
ProgressBarNotification note = new ProgressBarNotification();
note.setProgress(123);
assertEquals("ProgressBarNotification should not exceed 100 progress", 100, note.getProgress());
}
示例4: progressBarShouldNotGoBelow0
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
@Test
public void progressBarShouldNotGoBelow0() {
ProgressBarNotification note = new ProgressBarNotification();
note.setProgress(-10);
assertEquals("ProgressBarNotification should not go below 0 progress", 0, note.getProgress());
}
示例5: main
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// this will make the Notifications match the limits of the platform
// this will mean no fading on unix machines (since it doesn't look too good)
// Platform.instance().setAdjustForPlatform(true);
// makes a factory with the built-in clean dark theme
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanDark());
// a normal manager that just pops up the notification
NotificationManager plain = new SimpleManager(Location.NORTHWEST);
// a fade manager that will make the window fade in and out over a two second period
SimpleManager fade = new SimpleManager(Location.SOUTHWEST);
fade.setFadeEnabled(true);
fade.setFadeTime(Time.seconds(2));
// adds a text notification to the first manager
TextNotification notification = factory.buildTextNotification("This is the dark theme", "No fade");
notification.setCloseOnClick(true);
// the notification will stay there forever until you click it to exit
plain.addNotification(notification, Time.infinite());
Thread.sleep(2000);
// adds an icon notification that should fade in - note that results may vary depending on the platform
IconNotification icon = factory.buildIconNotification("This is a really really really long title", "See the cutoff?",
IconUtils.createIcon("/com/demo/exclamation.png", 50, 50));
fade.addNotification(icon, Time.seconds(2));
Thread.sleep(6000);
AcceptNotification accept = factory.buildAcceptNotification("Do you accept?", "This is a fading notification.");
fade.addNotification(accept, Time.infinite());
boolean didAccept = accept.blockUntilReply();
ProgressBarNotification reply = null;
if (didAccept) {
reply = factory.buildProgressBarNotification("You accepted");
} else {
reply = factory.buildProgressBarNotification("You did not accept");
}
reply.setCloseOnClick(true);
fade.addNotification(reply, Time.infinite());
for (int i = 0; i < 100; i++) {
reply.setProgress(i);
Thread.sleep(100);
}
fade.removeNotification(reply);
}
示例6: main
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// this will make the Notifications match the limits of the platform
// this will mean no fading on unix machines (since it doesn't look too good)
// Platform.instance().setAdjustForPlatform(true);
// makes a factory with the built-in clean dark theme
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanDark());
// a normal manager that just pops up the notification
NotificationManager plain = new SimpleManager(Location.NORTHWEST);
// a fade manager that will make the window fade in and out over a two second period
SimpleManager fade = new SimpleManager(Location.SOUTHWEST);
fade.setFadeEnabled(true);
fade.setFadeTime(Time.seconds(2));
// adds a text notification to the first manager
TextNotification notification = factory.buildTextNotification("This is the dark theme",
"You can have multiple lines\nOf subtitle text as well\nLine 3");
notification.setCloseOnClick(true);
// the notification will stay there forever until you click it to exit
plain.addNotification(notification, Time.infinite());
Thread.sleep(2000);
// adds an icon notification that should fade in - note that results may vary depending on the platform
IconNotification icon = factory.buildIconNotification("This is a really really really long title", "See the cutoff?",
IconUtils.createIcon("/com/demo/exclamation.png", 50, 50));
fade.addNotification(icon, Time.seconds(2));
Thread.sleep(6000);
AcceptNotification accept = factory.buildAcceptNotification("Do you accept?", "This is a fading notification.");
fade.addNotification(accept, Time.infinite());
boolean didAccept = accept.blockUntilReply();
ProgressBarNotification reply = null;
if (didAccept) {
reply = factory.buildProgressBarNotification("You accepted");
} else {
reply = factory.buildProgressBarNotification("You did not accept");
}
reply.setCloseOnClick(true);
fade.addNotification(reply, Time.infinite());
for (int i = 0; i < 100; i++) {
reply.setProgress(i);
Thread.sleep(100);
}
fade.removeNotification(reply);
}
示例7: testProgressNotification
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
@Test
public void testProgressNotification() {
NotificationFactory factory = new NotificationFactory(s_pack);
ProgressBarNotification note = factory.buildProgressBarNotification(TITLE);
assertEquals("ProgressBarNotification should have the same title", TITLE, note.getTitle());
}
示例8: buildProgressBarNotification
import com.notification.types.ProgressBarNotification; //导入依赖的package包/类
/**
* Builds a ProgressBarNotification.
*
* @param title
* the title to display on the ProgressBarNotification
* @return the built ProgressBarNotification
*/
public ProgressBarNotification buildProgressBarNotification(String title) {
return build(ProgressBarNotification.class, title);
}