Package net.alteiar.documents

Examples of net.alteiar.documents.BeanDirectory


      }
      connectPlayer();

      if (rootDirectory == null) {
        UniqueID id = null;
        BeanDirectory root = new BeanDirectory(id, "ROOT");
        root.setOwner(currentPlayer.getId());

        manager.createDocument(root);

        // we wait it here because the root directory must exist!
        rootDirectory = getBean(root.getId(), 3000L);

        BeanDirectory pj = new BeanDirectory(rootDirectory,
            "personnages");
        addBean(pj);
      }
    }
  }
View Full Code Here


  public void addBean(BasicBean bean) {
    realAddBean(bean);
  }

  public void addBean(BeanBasicDocument doc) {
    BeanDirectory dir = getBean(doc.getParent());
    dir.addDocument(doc);
    doc.setOwner(getCurrentPlayer().getId());
    realAddBean(doc);
  }
View Full Code Here

      combatTraker = (CombatTraker) Beans.getInstanceOf(bean,
          CombatTraker.class);
    }

    if (Beans.isInstanceOf(bean, BeanDirectory.class)) {
      final BeanDirectory doc = (BeanDirectory) Beans.getInstanceOf(bean,
          BeanDirectory.class);
      if (doc.getParent() == null) {
        this.rootDirectory = doc;
      }
      notifyBeanDocumentAdded(doc);
      notifyBeanAdded(doc);
    } else if (Beans.isInstanceOf(bean, BeanDocument.class)) {
      final BeanDocument doc = (BeanDocument) Beans.getInstanceOf(bean,
          BeanDocument.class);

      // TODO may change later but now we do not want to receive the
      // document while we do not contain the internal bean
      this.addWaitBeanListener(new WaitBeanListener() {
        @Override
        public UniqueID getBeanId() {
          return doc.getBeanId();
        }

        @Override
        public void beanReceived(BasicBean bean) {
          synchronized (documentsBean) {
View Full Code Here

      rootClick(e);
    } else {
      DocumentNode node = (DocumentNode) path.getLastPathComponent();

      BeanBasicDocument doc = node.getUserObject();
      BeanDirectory parent = CampaignClient.getInstance().getBean(
          doc.getParent());
      dirClick(e, parent, doc);
    }
  }
View Full Code Here

      dirClick(e, parent, doc);
    }
  }

  private void rootClick(MouseEvent e) {
    BeanDirectory root = CampaignClient.getInstance().getRootDirectory();

    JPopupMenu popup = new JPopupMenu();

    popup.add(new JMenuItem(new NewDirectoryAction(root)));
    popup.add(new JMenuItem(new NewDocumentAction(root)));
View Full Code Here

      BeanBasicDocument doc) {

    JPopupMenu popup = new JPopupMenu();

    if (doc.isDirectory()) {
      BeanDirectory dir = (BeanDirectory) doc;

      popup.add(new JMenuItem(new PropertyDocumentAction(dir)));
      popup.add(new JMenuItem(new RemoveDirectoryAction(dir)));
      popup.addSeparator();
      popup.add(new JMenuItem(new NewDirectoryAction(dir)));
View Full Code Here

  private final JTree tree;

  public PanelDocumentExplorer() {
    this.setLayout(new BorderLayout());

    BeanDirectory root = CampaignClient.getInstance().getRootDirectory();
    DocumentNode all = new DocumentNode(root, root.isDirectory());

    MyTreeModel treeModel = new MyTreeModel(all);
    tree = new JTree();
    tree.setModel(treeModel);
    tree.setRootVisible(false);
View Full Code Here

    dlg.setVisible(true);

    if (dlg.getReturnStatus() == DialogOkCancel.RET_OK) {
      String dirName = dlg.getMainPanel().getDocumentName();
      CampaignClient.getInstance().addBean(
          new BeanDirectory(parent, dirName));

    }
  }
View Full Code Here

    });
  }

  private synchronized void fillCompleteModel(final DocumentNode parent) {
    BeanBasicDocument dir = parent.getUserObject();
    BeanDirectory beanDir = (BeanDirectory) dir;

    beanDir.addPropertyChangeListener(new PropertyChangeListener() {
      @Override
      public void propertyChange(PropertyChangeEvent evt) {
        refreshTree();
      }
    });

    Map<String, DocumentNode> existingDocs = new HashMap<>();

    for (int i = 0; i < parent.getChildCount(); i++) {
      DocumentNode childNode = (DocumentNode) parent.getChildAt(i);
      String documentId = childNode.getUserObject().getId().toString();
      existingDocs.put(documentId, childNode);
    }

    for (final UniqueID id : beanDir.getDocuments()) {
      BeanBasicDocument beanBasicDocument = CampaignClient.getInstance()
          .getBean(id);

      if (beanBasicDocument != null) {
        DocumentNode node = existingDocs.get(beanBasicDocument.getId()
View Full Code Here

          data);

      Point p = info.getDropLocation().getDropPoint();
      TreePath path = target.getPathForLocation(p.x, p.y);

      BeanDirectory targetDir = null;
      if (path == null) {
        targetDir = CampaignClient.getInstance().getRootDirectory();
      } else {
        DocumentNode node = (DocumentNode) path.getLastPathComponent();

        if (node.getUserObject().isDirectory()) {
          targetDir = (BeanDirectory) node.getUserObject();
        } else {
          UniqueID dirBean = node.getUserObject().getParent();
          targetDir = CampaignClient.getInstance().getBean(dirBean);
        }
      }

      BeanDirectory previousDir = CampaignClient.getInstance().getBean(
          docToMove.getParent());

      if (!previousDir.equals(targetDir)) {
        previousDir.removeDocument(docToMove);
        targetDir.addDocument(docToMove);
        docToMove.setParent(targetDir.getId());
      }
    }
    return data != null;
View Full Code Here

TOP

Related Classes of net.alteiar.documents.BeanDirectory

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.