Package hermes.browser.model.tree

Examples of hermes.browser.model.tree.DestinationConfigTreeNode


  public HermesTreeNode getSelectedHermesNode() {
    if (getSelectionPath() != null) {
      if (getSelectionPath().getLastPathComponent() instanceof HermesTreeNode) {
        return (HermesTreeNode) getSelectionPath().getLastPathComponent();
      } else if (getSelectionPath().getLastPathComponent() instanceof DestinationConfigTreeNode) {
        DestinationConfigTreeNode destinationNode = (DestinationConfigTreeNode) getSelectionPath().getLastPathComponent();

        return (HermesTreeNode) destinationNode.getHermesTreeNode();
      }
    }

    return null;
  }
View Full Code Here


  private boolean doJavaFileTransfer(List files) {
    List<DestinationConfigTreeNode> nodes = getSelectedDestinationNodes();

    if (nodes.size() > 0) {
      final StringBuffer question = new StringBuffer();
      final DestinationConfigTreeNode node = nodes.get(0);

      question.append("Are you sure you want to upload ");

      if (files.size() == 1) {
        question.append(" this file to " + node.getDestinationName());
      } else {
        question.append(" these " + files.size() + " files to " + node.getDestinationName());
      }

      question.append(" ?");

      if (JOptionPane.showConfirmDialog(HermesBrowser.getBrowser(), question.toString(), "Please confirm.", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

        HermesBrowser
            .getBrowser()
            .getActionFactory()
            .createSimpleSendMessageAction(getSelectedHermesNode().getHermes(), node.getDestinationName(), node.getDomain(), files,
                SendMessageTask.MAYBE_XML, false);
      } else {
        Hermes.ui.getDefaultMessageSink().add("File upload cancelled.");
      }
    }
View Full Code Here

    List<DestinationConfigTreeNode> nodes = getSelectedDestinationNodes();

    lastDndAction = TransferHandler.COPY;

    if (nodes.size() > 0 && messages.size() > 0) {
      final DestinationConfigTreeNode destinationNode = nodes.get(0);
      final HermesTreeNode hermesNode = getSelectedHermesNode();

      if (hermesNode != null && destinationNode != null) {
        HermesBrowser
            .getBrowser()
            .getActionFactory()
            .createMessageCopyAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), messages, true,
                true);
      }
    }

    return true;
View Full Code Here

    List<DestinationConfigTreeNode> nodes = getSelectedDestinationNodes();

    lastDndAction = TransferHandler.COPY;

    if (nodes.size() > 0 && messages.size() > 0) {
      final DestinationConfigTreeNode destinationNode = nodes.get(0);
      final HermesTreeNode hermesNode = getSelectedHermesNode();

      if (hermesNode != null && destinationNode != null) {
        HermesBrowser
            .getBrowser()
            .getActionFactory()
            .createMessageCopyAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), messages, true,
                true);
      }
    }

    return true;
View Full Code Here

  private boolean doMessagesTransfer(MessageGroup messages, int action) {
    List<DestinationConfigTreeNode> nodes = getSelectedDestinationNodes();

    if (nodes.size() > 0) {
      final DestinationConfigTreeNode destinationNode = nodes.get(0);

      final HermesTreeNode hermesNode = getSelectedHermesNode();

      if (hermesNode != null && destinationNode != null) {
        Collection<Message> selected = messages.getSelectedMessages();
        Message[] messagesArray = messages.getSelectedMessages().toArray(new Message[selected.size()]);

        if (selected.size() == 1 && action == TransferHandler.COPY && MessageEditorDialog.canEdit(messagesArray[0])) {
          try {
            Message message = selected.iterator().next();
            MessageEditorDialog dialog = new MessageEditorDialog(message, destinationNode.getDestinationName(), destinationNode.getDomain(),
                new AbstractEditedMessageHandler(hermesNode.getHermes()) {
                  @Override
                  public void onMessage(Message message) {
                    HermesBrowser
                        .getBrowser()
                        .getActionFactory()
                        .createMessageCopyAction(hermesNode.getHermes(), destinationNode.getDestinationName(),
                            destinationNode.getDomain(), new ArrayList(Arrays.asList(message)), false, true);
                  }
                });
            dialog.setLocationRelativeTo(HermesBrowser.getBrowser());
            dialog.setVisible(true);
          } catch (JMSException ex) {
            HermesBrowser.getBrowser().showErrorDialog(ex);
          }

        } else {

          if (action == TransferHandler.COPY) {
            HermesBrowser
                .getBrowser()
                .getActionFactory()
                .createMessageCopyAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), selected,
                    true, true);
          } else {
            HermesBrowser.getBrowser().getActionFactory()
                .createMessageMoveAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), selected);
          }
        }
      }
    } else {
      if (getSelectionPath() != null) {
View Full Code Here

    if (paths != null) {
      for (int i = 0; i < paths.length; i++) {
        TreePath path = paths[i];

        if (path.getLastPathComponent() instanceof DestinationConfigTreeNode) {
          DestinationConfigTreeNode destinationNode = (DestinationConfigTreeNode) path.getLastPathComponent();
          rval.add(destinationNode);
        } else if (path.getLastPathComponent() instanceof HermesTreeNode) {
          HermesTreeNode hermesNode = (HermesTreeNode) path.getLastPathComponent();
          rval.add(hermesNode);
        }
View Full Code Here

  private void maybeRefocusDocument(TreeNode treeNode) {
    DocumentComponent found = null ;
   
    if (treeNode instanceof DestinationConfigTreeNode) {
      final DestinationConfigTreeNode node = (DestinationConfigTreeNode) treeNode;
      found = HermesBrowser.getBrowser().getOpenQueueBrowser(node.getConfig());
    } else if (treeNode instanceof MessageStoreTreeNode) {
      final MessageStoreTreeNode node = (MessageStoreTreeNode) treeNode;
      found = HermesBrowser.getBrowser().getOpenStoreBrowser(node.getMessageStore()) ;
    }
   
    if (found != null) {
      HermesBrowser.getBrowser().getDocumentPane().setActiveDocument(found.getName());
    }
View Full Code Here

            final HermesTreeNode node = (HermesTreeNode) treePath.getPathComponent(i);
            lastSelectedHermesTreeNode = node;

            setToolTipText(node.getHermes().getMetaData().getToolTipText());
          } else if (treePath.getPathComponent(i) instanceof DestinationConfigTreeNode) {
            final DestinationConfigTreeNode node = (DestinationConfigTreeNode) treePath.getPathComponent(i);
            setToolTipText(node.getDestinationName());

            maybeRefocusDocument(node);

          } else if (treePath.getPathComponent(i) instanceof RepositoryTreeNode) {
            final RepositoryTreeNode node = (RepositoryTreeNode) treePath.getPathComponent(i);
            setToolTipText(node.getRepository().getId());
          } else if (treePath.getPathComponent(i) instanceof MessageStoreTreeNode) {
            final MessageStoreTreeNode node = (MessageStoreTreeNode) treePath.getPathComponent(i);
            setToolTipText(node.getMessageStore().getTooltipText());
            maybeRefocusDocument(node);

          } else if (treePath.getPathComponent(i) instanceof MessageStoreURLTreeNode) {
            final MessageStoreURLTreeNode node = (MessageStoreURLTreeNode) treePath.getPathComponent(i);

            setToolTipText(node.getURL());
          }
        }
      }
    } catch (JMSException ex) {
      Hermes.ui.getDefaultMessageSink().add(ex.getMessage());
View Full Code Here

                  item.addActionListener(new ActionListener()
                  {
                     public void actionPerformed(ActionEvent e)
                     {
                        final Hermes hermes = HermesBrowser.getBrowser().getBrowserTree().getSelectedHermesNode().getHermes();
                        final DestinationConfigTreeNode node = HermesBrowser.getBrowser().getBrowserTree().getFirstSelectedDestinationNode();

                        if (node != null)
                        {
                           HermesBrowser.getBrowser().getThreadPool().invokeLater(new RecordDestinationTask(hermes, node, store));
                        }
View Full Code Here

      enableOnBrowserTreeSelection(new Class[] { DestinationConfigTreeNode.class }, this, true);
    }
  }

  public void doSendAFile(int isXML, boolean preserveDestination) {
    final DestinationConfigTreeNode destinationNode = (DestinationConfigTreeNode) HermesBrowser.getBrowser().getBrowserTree().getLastSelectedPathComponent();
    final HermesTreeNode hermesNode = (HermesTreeNode) destinationNode.getHermesTreeNode();
    final String text = ((isXML == SendMessageTask.IS_XML) ? "Send XML to " : "Send file to ") + destinationNode.getDestinationName();

    JFileChooser chooser = null;

    if (DirectoryCache.lastUploadDirectory == null) {
      chooser = new JFileChooser(System.getProperty("user.dir"));
    } else {
      chooser = new JFileChooser(DirectoryCache.lastUploadDirectory);
    }
    chooser.setMultiSelectionEnabled(true) ;

    if (chooser.showDialog(HermesBrowser.getBrowser(), text) == JFileChooser.APPROVE_OPTION) {
      DirectoryCache.lastUploadDirectory = chooser.getSelectedFile().getParentFile();
      HermesBrowser.getBrowser().getActionFactory()
          .createSimpleSendMessageAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), chooser.getSelectedFiles(), isXML, preserveDestination);
    } else {
      Hermes.ui.getDefaultMessageSink().add("File upload cancelled");
    }
  }
View Full Code Here

TOP

Related Classes of hermes.browser.model.tree.DestinationConfigTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.