Пример #1
0
 @FXML
 private void restoreConfiguration() {
   if (DialogUtils.showDefaultConfigurationFileMissingChoice(
       "Restore defaults", mainPane.getScene().getWindow())) {
     loadConfigurationFileAndShowErrorWhenApplicable(
         ConfigurationManager.getDefaultConfigurationFile());
   }
 }
Пример #2
0
  public void loadDefaultConfigurationFile() {
    final File defaultConfigurationFile = ConfigurationManager.getDefaultConfigurationFile();

    logger.info(
        "Default configuration file present ("
            + defaultConfigurationFile.getAbsolutePath()
            + ") = "
            + defaultConfigurationFile.exists());

    if (defaultConfigurationFile.exists()) {
      loadConfigurationFileAndShowErrorWhenApplicable(defaultConfigurationFile);
    }
  }
Пример #3
0
  private void loadConfigurationFile(final File selectedFile) {
    logger.info("Loading configuration file from " + selectedFile.getAbsolutePath());

    if (configurationManager.loadConfiguration(selectedFile)) {
      clear();
      controlPanelPaneController.refreshConnectionsStatus();

      // Process the connection settings
      for (final ConfiguredConnectionDetails connection : configurationManager.getConnections()) {
        if (connection.isAutoOpen() != null && connection.isAutoOpen()) {
          try {
            connectionManager.openConnection(connection, this);
          } catch (ConfigurationException e) {
            // TODO: show warning dialog for invalid
            logger.error("Cannot open conection {}", connection.getName(), e);
          }
        }
      }
    }

    controlPanelPaneController.refreshConfigurationFileStatus();
  }
Пример #4
0
  private void messageFound(final FormattedMqttMessage message) {
    foundMessages.add(
        0,
        new MessageContentProperties<FormattedMqttMessage>(
            message, /*store.getFormatter(), */
            UiProperties.getSummaryMaxPayloadLength(configurationManager.getUiPropertyFile())));

    if (!uniqueContentOnlyFilter.filter(message, foundMessageStore.getMessageList(), true)) {
      // If an old message has been deleted from the store, remove it from the list as well
      if (foundMessageStore.storeMessage(message) != null) {
        foundMessages.remove(foundMessages.size() - 1);
      }
    }
  }
Пример #5
0
  @FXML
  public void exit() {
    // This is triggered by the user
    connectionManager.disconnectAll();

    statisticsManager.saveStats();

    configurationManager.saveUiProperties(
        getLastWidth(),
        getLastHeight(),
        stage.isMaximized(),
        selectedPerspective,
        resizeMessagePaneMenu.isSelected());

    System.exit(0);
  }
Пример #6
0
  public void init() {
    foundMessageStore =
        new FilteredMessageStore<FormattedMqttMessage>(
            store.getMessageList(),
            store.getMessageList().getPreferredSize(),
            store.getMessageList().getMaxSize(),
            "search-" + store.getName(),
            store.getFormatter(),
            formattingManager,
            UiProperties.getSummaryMaxPayloadLength(configurationManager.getUiPropertyFile()));

    uniqueContentOnlyFilter =
        new UniqueContentOnlyFilter<FormattedMqttMessage>(store, store.getUiEventQueue());
    uniqueContentOnlyFilter.setUniqueContentOnly(
        messageNavigationPaneController.getUniqueOnlyMenu().isSelected());
    foundMessageStore.addMessageFilter(uniqueContentOnlyFilter);
    messageNavigationPaneController
        .getUniqueOnlyMenu()
        .setOnAction(
            new EventHandler<ActionEvent>() {
              @Override
              public void handle(ActionEvent event) {
                uniqueContentOnlyFilter.setUniqueContentOnly(
                    messageNavigationPaneController.getUniqueOnlyMenu().isSelected());
                // store.getFilteredMessageStore().runFilter(uniqueContentOnlyFilter);
                search();
                eventManager.navigateToFirst(foundMessageStore);
              }
            });

    messageListTablePaneController.setItems(foundMessages);
    messageListTablePaneController.setStore(foundMessageStore);
    messageListTablePaneController.setConnection(connection);
    messageListTablePaneController.setEventManager(eventManager);
    messageListTablePaneController.init();
    eventManager.registerChangeMessageIndexObserver(
        messageListTablePaneController, foundMessageStore);

    messagePaneController.setStore(foundMessageStore);
    messagePaneController.setConfingurationManager(configurationManager);
    messagePaneController.setFormattingManager(formattingManager);
    messagePaneController.setStyled(true);
    messagePaneController.init();
    // The search pane's message browser wants to know about changing indices and format
    eventManager.registerChangeMessageIndexObserver(messagePaneController, foundMessageStore);
    eventManager.registerFormatChangeObserver(messagePaneController, foundMessageStore);

    messageNavigationPaneController.setStore(foundMessageStore);
    messageNavigationPaneController.setEventManager(eventManager);
    messageNavigationPaneController.init();
    // The search pane's message browser wants to know about show first, index change and update
    // index events
    eventManager.registerChangeMessageIndexObserver(
        messageNavigationPaneController, foundMessageStore);
    eventManager.registerChangeMessageIndexFirstObserver(
        messageNavigationPaneController, foundMessageStore);
    eventManager.registerIncrementMessageIndexObserver(
        messageNavigationPaneController, foundMessageStore);

    scriptManager = new MqttScriptManager(null, null, connection);
    refreshList();

    eventManager.registerMessageAddedObserver(this, store.getMessageList());
    eventManager.registerFormatChangeObserver(this, store);
  }