Search in sources :

Example 1 with Binjr

use of eu.fthevenet.binjr.Binjr in project selenium_java by sergueik.

the class MainViewController method onAvailableUpdate.

private void onAvailableUpdate(GithubRelease githubRelease) {
    Notifications n = Notifications.create().title("New release available!").text("You are currently running binjr version " + AppEnvironment.getInstance().getVersion() + "\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();
}
Also used : StageStyle(javafx.stage.StageStyle) DataAdapterException(eu.fthevenet.binjr.data.exceptions.DataAdapterException) HPos(javafx.geometry.HPos) Pos(javafx.geometry.Pos) Initializable(javafx.fxml.Initializable) DoubleBinding(javafx.beans.binding.DoubleBinding) javafx.scene.layout(javafx.scene.layout) Dialogs(eu.fthevenet.binjr.dialogs.Dialogs) javafx.scene.control(javafx.scene.control) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) ZonedDateTime(java.time.ZonedDateTime) NoAdapterFoundException(eu.fthevenet.binjr.data.exceptions.NoAdapterFoundException) DataAdapterDialog(eu.fthevenet.binjr.dialogs.DataAdapterDialog) Side(javafx.geometry.Side) Application(javafx.application.Application) Parent(javafx.scene.Parent) MaskerPane(org.controlsfx.control.MaskerPane) ListChangeListener(javafx.collections.ListChangeListener) DiagnosticCommand(eu.fthevenet.util.diagnositic.DiagnosticCommand) CannotInitializeDataAdapterException(eu.fthevenet.binjr.data.exceptions.CannotInitializeDataAdapterException) eu.fthevenet.util.javafx.controls(eu.fthevenet.util.javafx.controls) UpdateManager(eu.fthevenet.binjr.preferences.UpdateManager) eu.fthevenet.binjr.data.workspace(eu.fthevenet.binjr.data.workspace) USE_COMPUTED_SIZE(javafx.scene.layout.Region.USE_COMPUTED_SIZE) Event(javafx.event.Event) AsyncTaskManager(eu.fthevenet.binjr.data.async.AsyncTaskManager) AppEnvironment(eu.fthevenet.binjr.preferences.AppEnvironment) JAXBException(javax.xml.bind.JAXBException) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) DataAdapter(eu.fthevenet.binjr.data.adapters.DataAdapter) Duration(javafx.util.Duration) Logger(org.apache.logging.log4j.Logger) TimeSeriesBinding(eu.fthevenet.binjr.data.adapters.TimeSeriesBinding) Binjr(eu.fthevenet.binjr.Binjr) Notifications(org.controlsfx.control.Notifications) StageAppearanceManager(eu.fthevenet.binjr.dialogs.StageAppearanceManager) Binding(javafx.beans.binding.Binding) java.util(java.util) GithubRelease(eu.fthevenet.util.github.GithubRelease) Action(org.controlsfx.control.action.Action) DiagnosticException(eu.fthevenet.util.diagnositic.DiagnosticException) javafx.animation(javafx.animation) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DataAdapterFactory(eu.fthevenet.binjr.data.adapters.DataAdapterFactory) DataAdapterInfo(eu.fthevenet.binjr.data.adapters.DataAdapterInfo) Bindings(javafx.beans.binding.Bindings) Supplier(java.util.function.Supplier) VPos(javafx.geometry.VPos) FXMLLoader(javafx.fxml.FXMLLoader) GlobalPreferences(eu.fthevenet.binjr.preferences.GlobalPreferences) StreamSupport(java.util.stream.StreamSupport) Callback(javafx.util.Callback) Color(javafx.scene.paint.Color) javafx.beans.property(javafx.beans.property) javafx.scene.input(javafx.scene.input) Files(java.nio.file.Files) Node(javafx.scene.Node) IOException(java.io.IOException) File(java.io.File) FileChooser(javafx.stage.FileChooser) ActionEvent(javafx.event.ActionEvent) ChronoUnit(java.time.temporal.ChronoUnit) Stage(javafx.stage.Stage) Paths(java.nio.file.Paths) ObservableValue(javafx.beans.value.ObservableValue) LogManager(org.apache.logging.log4j.LogManager) Action(org.controlsfx.control.action.Action) Notifications(org.controlsfx.control.Notifications)

Example 2 with Binjr

use of eu.fthevenet.binjr.Binjr in project selenium_java by sergueik.

the class MainViewController method runAfterInitialize.

protected void runAfterInitialize() {
    GlobalPreferences prefs = GlobalPreferences.getInstance();
    Stage stage = Dialogs.getStage(root);
    stage.titleProperty().bind(Bindings.createStringBinding(() -> String.format("%s%s - binjr", (workspace.isDirty() ? "*" : ""), workspace.pathProperty().getValue().toString()), workspace.pathProperty(), workspace.dirtyProperty()));
    stage.setOnCloseRequest(event -> {
        if (!confirmAndClearWorkspace()) {
            event.consume();
        } else {
            Platform.exit();
        }
    });
    stage.addEventFilter(KeyEvent.KEY_PRESSED, e -> handleControlKey(e, true));
    stage.addEventFilter(KeyEvent.KEY_RELEASED, e -> handleControlKey(e, false));
    stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
        // main stage lost focus -> invalidates shift or ctrl pressed
        prefs.setShiftPressed(false);
        prefs.setCtrlPressed(false);
    });
    if (associatedFile.isPresent()) {
        logger.debug(() -> "Opening associated file " + associatedFile.get());
        loadWorkspace(new File(associatedFile.get()));
    } else if (prefs.isLoadLastWorkspaceOnStartup()) {
        prefs.getMostRecentSavedWorkspace().ifPresent(path -> {
            File latestWorkspace = path.toFile();
            if (latestWorkspace.exists()) {
                loadWorkspace(latestWorkspace);
            } else {
                logger.warn("Cannot reopen workspace " + latestWorkspace.getPath() + ": file does not exists");
            }
        });
    }
    if (prefs.isCheckForUpdateOnStartUp()) {
        UpdateManager.getInstance().asyncCheckForUpdate(this::onAvailableUpdate, null, null);
    }
}
Also used : StageStyle(javafx.stage.StageStyle) DataAdapterException(eu.fthevenet.binjr.data.exceptions.DataAdapterException) HPos(javafx.geometry.HPos) Pos(javafx.geometry.Pos) Initializable(javafx.fxml.Initializable) DoubleBinding(javafx.beans.binding.DoubleBinding) javafx.scene.layout(javafx.scene.layout) Dialogs(eu.fthevenet.binjr.dialogs.Dialogs) javafx.scene.control(javafx.scene.control) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) ZonedDateTime(java.time.ZonedDateTime) NoAdapterFoundException(eu.fthevenet.binjr.data.exceptions.NoAdapterFoundException) DataAdapterDialog(eu.fthevenet.binjr.dialogs.DataAdapterDialog) Side(javafx.geometry.Side) Application(javafx.application.Application) Parent(javafx.scene.Parent) MaskerPane(org.controlsfx.control.MaskerPane) ListChangeListener(javafx.collections.ListChangeListener) DiagnosticCommand(eu.fthevenet.util.diagnositic.DiagnosticCommand) CannotInitializeDataAdapterException(eu.fthevenet.binjr.data.exceptions.CannotInitializeDataAdapterException) eu.fthevenet.util.javafx.controls(eu.fthevenet.util.javafx.controls) UpdateManager(eu.fthevenet.binjr.preferences.UpdateManager) eu.fthevenet.binjr.data.workspace(eu.fthevenet.binjr.data.workspace) USE_COMPUTED_SIZE(javafx.scene.layout.Region.USE_COMPUTED_SIZE) Event(javafx.event.Event) AsyncTaskManager(eu.fthevenet.binjr.data.async.AsyncTaskManager) AppEnvironment(eu.fthevenet.binjr.preferences.AppEnvironment) JAXBException(javax.xml.bind.JAXBException) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) DataAdapter(eu.fthevenet.binjr.data.adapters.DataAdapter) Duration(javafx.util.Duration) Logger(org.apache.logging.log4j.Logger) TimeSeriesBinding(eu.fthevenet.binjr.data.adapters.TimeSeriesBinding) Binjr(eu.fthevenet.binjr.Binjr) Notifications(org.controlsfx.control.Notifications) StageAppearanceManager(eu.fthevenet.binjr.dialogs.StageAppearanceManager) Binding(javafx.beans.binding.Binding) java.util(java.util) GithubRelease(eu.fthevenet.util.github.GithubRelease) Action(org.controlsfx.control.action.Action) DiagnosticException(eu.fthevenet.util.diagnositic.DiagnosticException) javafx.animation(javafx.animation) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DataAdapterFactory(eu.fthevenet.binjr.data.adapters.DataAdapterFactory) DataAdapterInfo(eu.fthevenet.binjr.data.adapters.DataAdapterInfo) Bindings(javafx.beans.binding.Bindings) Supplier(java.util.function.Supplier) VPos(javafx.geometry.VPos) FXMLLoader(javafx.fxml.FXMLLoader) GlobalPreferences(eu.fthevenet.binjr.preferences.GlobalPreferences) StreamSupport(java.util.stream.StreamSupport) Callback(javafx.util.Callback) Color(javafx.scene.paint.Color) javafx.beans.property(javafx.beans.property) javafx.scene.input(javafx.scene.input) Files(java.nio.file.Files) Node(javafx.scene.Node) IOException(java.io.IOException) File(java.io.File) FileChooser(javafx.stage.FileChooser) ActionEvent(javafx.event.ActionEvent) ChronoUnit(java.time.temporal.ChronoUnit) Stage(javafx.stage.Stage) Paths(java.nio.file.Paths) ObservableValue(javafx.beans.value.ObservableValue) LogManager(org.apache.logging.log4j.LogManager) GlobalPreferences(eu.fthevenet.binjr.preferences.GlobalPreferences) Stage(javafx.stage.Stage) File(java.io.File)

Aggregations

Binjr (eu.fthevenet.binjr.Binjr)2 DataAdapter (eu.fthevenet.binjr.data.adapters.DataAdapter)2 DataAdapterFactory (eu.fthevenet.binjr.data.adapters.DataAdapterFactory)2 DataAdapterInfo (eu.fthevenet.binjr.data.adapters.DataAdapterInfo)2 TimeSeriesBinding (eu.fthevenet.binjr.data.adapters.TimeSeriesBinding)2 AsyncTaskManager (eu.fthevenet.binjr.data.async.AsyncTaskManager)2 CannotInitializeDataAdapterException (eu.fthevenet.binjr.data.exceptions.CannotInitializeDataAdapterException)2 DataAdapterException (eu.fthevenet.binjr.data.exceptions.DataAdapterException)2 NoAdapterFoundException (eu.fthevenet.binjr.data.exceptions.NoAdapterFoundException)2 eu.fthevenet.binjr.data.workspace (eu.fthevenet.binjr.data.workspace)2 DataAdapterDialog (eu.fthevenet.binjr.dialogs.DataAdapterDialog)2 Dialogs (eu.fthevenet.binjr.dialogs.Dialogs)2 StageAppearanceManager (eu.fthevenet.binjr.dialogs.StageAppearanceManager)2 AppEnvironment (eu.fthevenet.binjr.preferences.AppEnvironment)2 GlobalPreferences (eu.fthevenet.binjr.preferences.GlobalPreferences)2 UpdateManager (eu.fthevenet.binjr.preferences.UpdateManager)2 DiagnosticCommand (eu.fthevenet.util.diagnositic.DiagnosticCommand)2 DiagnosticException (eu.fthevenet.util.diagnositic.DiagnosticException)2 GithubRelease (eu.fthevenet.util.github.GithubRelease)2 eu.fthevenet.util.javafx.controls (eu.fthevenet.util.javafx.controls)2