예제 #1
0
 @Override
 public void messagePosted(final Message event) {
   switch (event.getEvent()) {
     case FILE_CLOSING:
     case CURRENCY_MODIFY:
       simpleInstanceMap.clear();
       fullInstanceMap.clear();
       break;
     default:
       break;
   }
 }
예제 #2
0
 @Override
 public void messagePosted(final Message event) {
   Platform.runLater(
       () -> {
         switch (event.getEvent()) {
           case FILE_LOAD_SUCCESS:
             disabled.setValue(false);
             break;
           case FILE_CLOSING:
             closeAllWindows();
             disabled.setValue(true);
             break;
           default:
             break;
         }
       });
 }
예제 #3
0
  @Override
  public void messagePosted(final Message event) {
    final Account a = event.getObject(MessageProperty.ACCOUNT);

    if (account.equals(a)) {
      final SecurityNode node = event.getObject(MessageProperty.COMMODITY);

      EventQueue.invokeLater(
          () -> {
            switch (event.getEvent()) {
              case ACCOUNT_REMOVE:
                MessageBus.getInstance()
                    .unregisterListener(
                        AccountSecurityComboBox.this,
                        MessageChannel.ACCOUNT,
                        MessageChannel.COMMODITY);
                model.removeAllElements();
                account = null;
                break;
              case ACCOUNT_SECURITY_ADD:
                model.addElement(node);
                break;
              case SECURITY_REMOVE:
              case ACCOUNT_SECURITY_REMOVE:
                final CommodityNode commodityNode = getSelectedNode();
                model.removeElement(node);

                if (commodityNode != null && node != null) {
                  if (commodityNode.equals(node)) {
                    setSelectedItem(null);
                  }
                }
                break;
              case SECURITY_MODIFY:
                updateNode(node);
                break;
              default:
            }
          });
    }
  }
  @Override
  public void messagePosted(final Message event) {

    switch (event.getEvent()) {
      case ACCOUNT_ADD:
      case ACCOUNT_MODIFY:
      case ACCOUNT_REMOVE:
        reload();
        break;
      case TRANSACTION_ADD:
      case TRANSACTION_REMOVE:
        treeTableView
            .refresh(); // TODO implement a better model that listens to account balance changes
        break;
      case FILE_CLOSING:
        Platform.runLater(() -> treeTableView.setRoot(null));
        MessageBus.getInstance()
            .unregisterListener(
                this, MessageChannel.SYSTEM, MessageChannel.ACCOUNT, MessageChannel.TRANSACTION);
        break;
      default:
        break;
    }
  }