当前位置: 首页>>代码示例>>Java>>正文


Java Notifications类代码示例

本文整理汇总了Java中org.controlsfx.control.Notifications的典型用法代码示例。如果您正苦于以下问题:Java Notifications类的具体用法?Java Notifications怎么用?Java Notifications使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Notifications类属于org.controlsfx.control包,在下文中一共展示了Notifications类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldShowDesktopNotificationWithNewNotifications

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@Test public void shouldShowDesktopNotificationWithNewNotifications(){
   ArgumentCaptor< Notifications > captor = ArgumentCaptor.forClass( Notifications.class );
   
   systemUnderTest.showDesktopNotification();
   verify( desktopNotification ).showNotification( 
            Mockito.eq( systemUnderTest ), Mockito.any(), Mockito.eq( BuildResultStatusNotification.NOTIFICATION_DELAY ) 
   );
   systemUnderTest.showDesktopNotification();
   verify( desktopNotification, times( 2 ) ).showNotification( 
            Mockito.eq( systemUnderTest ), Mockito.any(), Mockito.eq( BuildResultStatusNotification.NOTIFICATION_DELAY ) 
   );
   systemUnderTest.showDesktopNotification();
   verify( desktopNotification, times( 3 ) ).showNotification( 
            Mockito.eq( systemUnderTest ), captor.capture(), Mockito.eq( BuildResultStatusNotification.NOTIFICATION_DELAY ) 
   );
   
   assertThat( captor.getAllValues(), hasSize( 3 ) );
   Notifications first = captor.getAllValues().get( 0 );
   Notifications second = captor.getAllValues().get( 1 );
   Notifications third = captor.getAllValues().get( 2 );
   
   assertThat( first, is( not( second ) ) );
   assertThat( second, is( not( third ) ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:25,代码来源:BuildResultStatusNotificationTest.java

示例2: upload

import org.controlsfx.control.Notifications; //导入依赖的package包/类
public void upload(File toUpload) throws IOException {

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    lastResult = cloudinary.uploader().upload(toUpload, ObjectUtils.emptyMap());
                    last_public_id = (String) lastResult.get("public_id");
                } catch (IOException e) {
                    Platform.runLater(()->{
                        Notifications.create().title("Error").text("Network is unreachable").showError();
                    });
                    e.printStackTrace();
                }
            }
        });
        thread.run();

    }
 
开发者ID:maximova136,项目名称:j-demo,代码行数:20,代码来源:CloudHost.java

示例3: testSimulatorPane

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@Test
public void testSimulatorPane() throws Exception {
  LogPlayer logPlayer = new LogPlayerImpl();
  logPlayer.setLogFile(TestSimulatorLogReader.getTestFile());
  SimulatorPane simulatorPane = new SimulatorPane(logPlayer, null);
  logPlayer.open();
  SampleApp sampleApp = new SampleApp("simulator", simulatorPane);
  sampleApp.show();
  sampleApp.waitOpen();
  Notifications notification = Notifications.create();
  notification.hideAfter(new Duration(SHOW_TIME / 2));
  notification.title("simulator running");
  notification.text("Simulation started");
  Platform.runLater(() -> notification.showInformation());
  int loops = 50;
  for (int i = 0; i < loops; i++) {
    Thread.sleep(SHOW_TIME / loops);
    double seconds = simulatorPane.getDuration().toSeconds() / loops * i;
    Platform.runLater(() -> simulatorPane.setElapsed(seconds));
  }
  sampleApp.close();
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:23,代码来源:TestAppGUI.java

示例4: sendMessage

import org.controlsfx.control.Notifications; //导入依赖的package包/类
private void sendMessage(String text) {
    new Thread(() -> {
        try {
            Message message = new Message(text);
            message.setClient(client());
            message.setReceived(false);
            message.setViewed(true);
            message.setTime(new Date());
            client().sendMessage(message);
            Platform.runLater(() -> messageText.setText(""));

        } catch (Exception ex) {
            if (showNotification.isSelected()) {
                Platform.runLater(() -> {
                    Notifications.create()
                            .title("Message send failure")
                            .text(ex.getMessage())
                            .hideAfter(Duration.seconds(15))
                            .showError();
                    errorLabel.setText(ex.getMessage());
                });
            }
        }
    }).start();
}
 
开发者ID:dipu-bd,项目名称:Tuntuni,代码行数:26,代码来源:MessagingController.java

示例5: onAvailableUpdate

import org.controlsfx.control.Notifications; //导入依赖的package包/类
private void onAvailableUpdate(GithubRelease githubRelease) {
    Notifications n = Notifications.create()
            .title("New release available!")
            .text("You are currently running binjr version " + AppEnvironment.getInstance().getManifestVersion() + "\t\t.\nVersion " + githubRelease.getVersion() + " is now available.")
            .hideAfter(Duration.seconds(20))
            .position(Pos.BOTTOM_RIGHT)
            .owner(root);
    n.action(new Action("Download", actionEvent -> {
        String newReleaseUrl = githubRelease.getHtmlUrl();
        if (newReleaseUrl != null && newReleaseUrl.trim().length() > 0) {
            try {
                Dialogs.launchUrlInExternalBrowser(newReleaseUrl);
            } catch (IOException | URISyntaxException e) {
                logger.error("Failed to launch url in browser " + newReleaseUrl, e);
            }
        }
        n.hideAfter(Duration.seconds(0));
    }));
    n.showInformation();
}
 
开发者ID:fthevenet,项目名称:binjr,代码行数:21,代码来源:MainViewController.java

示例6: showNotifications

import org.controlsfx.control.Notifications; //导入依赖的package包/类
private void showNotifications(List<Stream> oldStreamList) {
    if (settings.isNotifications()) {
        streamList.getItems().stream()
                .filter(Objects::nonNull)
                .filter(s -> !oldStreamList.contains(s)).forEach(s -> {

            ImageView img = new ImageView(s.getLogo());
            img.setFitHeight(40.0);
            img.setFitWidth(40.0);

            Notifications.create()
                    .title(s.getName() + " just went live!")
                    .text(s.getStatus())
                    .graphic(img)
                    .onAction(e -> launchLivestreamer(s.getUrl()))
                    .hideAfter(Duration.seconds(NOTIFICATION_DURATION))
                    .darkStyle()
                    .show();
        });
    }
}
 
开发者ID:squallified,项目名称:livestreamer-twitch-gui,代码行数:22,代码来源:MainController.java

示例7: viewNotification

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@Override
public void viewNotification(String title, String content, Integer hideAfter, Pos p) {
     Notifications notificationBuilder = Notifications.create()
            .title(title)
            .text(content)
            .graphic(null)
            .hideAfter(Duration.seconds(hideAfter))
            .position(p);
    notificationBuilder.show();
}
 
开发者ID:Obsidiam,项目名称:amelia,代码行数:11,代码来源:AlertController.java

示例8: initialize

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	button.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> {
		Notifications notify = Notifications.create().title("Downloading")
				.text("Download Started")
				.hideAfter(javafx.util.Duration.seconds(5))
				.position(Pos.BOTTOM_RIGHT);
		notify.darkStyle();
		notify.show();
	});
	
}
 
开发者ID:naeemkhan12,项目名称:JavaFx-Material-Design,代码行数:13,代码来源:Controller.java

示例9: done

import org.controlsfx.control.Notifications; //导入依赖的package包/类
private void done() {
    System.out.println("done service: " + getValue());
    close();
    Main.stage.show();

    if (getValue())
        System.out.println("Successfull Capturing, image is saved at:" + filePath);
    else {
        System.out.println("Error, failed to capture screen");
        Notifications.create().title("Error").text("Failed to capture the Screen!").showError();
    }
}
 
开发者ID:maximova136,项目名称:j-demo,代码行数:13,代码来源:CaptureWindowController.java

示例10: cancelled

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@Override
protected void cancelled() {
    super.cancelled();
    System.out.println("cancelled service");
    Main.stage.show();
    close();
    System.out.println("Error, failed to capture screen");
    Notifications.create().title("Error").text("Failed to capture the Screen!").showError();
}
 
开发者ID:maximova136,项目名称:j-demo,代码行数:10,代码来源:CaptureWindowController.java

示例11: failed

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@Override
        protected void failed() {
            super.failed();
            System.out.println("failed service");
            Main.stage.show();
            close();
            System.out.println("Error, failed to capture screen");
            Notifications.create().title("Error").text("Failed to capture the Screen!").showError();
//            reset();
        }
 
开发者ID:maximova136,项目名称:j-demo,代码行数:11,代码来源:CaptureWindowController.java

示例12: copyTextToClipboard

import org.controlsfx.control.Notifications; //导入依赖的package包/类
public void copyTextToClipboard(String text) {
    ClipboardContent content = new ClipboardContent();
    content.putString(text);
    Platform.runLater(() -> {
        Main.clipboard.setContent(content);
        Notifications.create().title("Notification").text("Link has been copied to the clipboard").showInformation();
    });
}
 
开发者ID:maximova136,项目名称:j-demo,代码行数:9,代码来源:ScreenshotController.java

示例13: copyImageToClipboard

import org.controlsfx.control.Notifications; //导入依赖的package包/类
public void copyImageToClipboard(WritableImage image) {
    ClipboardContent content = new ClipboardContent();
    content.putImage(image);
    Platform.runLater(() -> {
        Main.clipboard.setContent(content);
        Notifications.create().title("Notification").text("Image has been copied to the clipboard").showInformation();
    });
}
 
开发者ID:maximova136,项目名称:j-demo,代码行数:9,代码来源:ScreenshotController.java

示例14: showNotification

import org.controlsfx.control.Notifications; //导入依赖的package包/类
/**
 * Show a notification.
 *
 * @param title
 *            The notification title
 * @param text
 *            The notification text
 * @param d
 *            The duration that notification will be visible
 * @param t
 *            The notification type
 */
public static void showNotification(String title , String text , Duration d , NotificationType t) {
	
	//Check if it is JavaFX Application Thread
	if (!Platform.isFxApplicationThread()) {
		Platform.runLater(() -> showNotification(title, text, d, t));
		return;
	}
	
	Notifications notification1 = Notifications.create().title(title).text(text);
	notification1.hideAfter(d);
	
	switch (t) {
		case CONFIRM:
			notification1.showConfirm();
			break;
		case ERROR:
			notification1.showError();
			break;
		case INFORMATION:
			notification1.showInformation();
			break;
		case SIMPLE:
			notification1.show();
			break;
		case WARNING:
			notification1.showWarning();
			break;
		default:
			break;
	}
	
}
 
开发者ID:goxr3plus,项目名称:JavaFXApplicationAutoUpdater,代码行数:45,代码来源:ActionTool.java

示例15: triggerParkingNotification

import org.controlsfx.control.Notifications; //导入依赖的package包/类
@FXML
void triggerParkingNotification(final ActionEvent $) {
	final Notifications notificationBuilder = Notifications.create().title("Color has changed")
			.text("In Taub, from RED to GRAY").owner(notificationsAnchor).graphic(null)
			.hideAfter(Duration.seconds(5)).position(Pos.TOP_RIGHT).onAction(λ -> System.out.println("Clicked"));
	notificationBuilder.darkStyle();
	notificationBuilder.showConfirm();
}
 
开发者ID:TechnionYP5777,项目名称:SmartCity-ParkingManagement,代码行数:9,代码来源:NotificationsController.java


注:本文中的org.controlsfx.control.Notifications类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。