Package net.alteiar.documents

Examples of net.alteiar.documents.BeanBasicDocument


        players.remove(Beans.getInstanceOf(bean, Player.class));
      }
    }

    if (Beans.isInstanceOf(bean, BeanBasicDocument.class)) {
      BeanBasicDocument doc = (BeanBasicDocument) Beans.getInstanceOf(
          bean, BeanBasicDocument.class);
      synchronized (documentsBean) {
        documentsBean.remove(doc);
      }
      notifyBeanRemoved(doc);
View Full Code Here


    if (path == null) {
      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

      }
    });
  }

  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()
            .toString());

        if (node != null) {
          existingDocs.remove(beanBasicDocument.getId().toString());
        } else {
          node = new DocumentNode(beanBasicDocument,
              beanBasicDocument.isDirectory());
          parent.add(node);
        }

        if (beanBasicDocument.isDirectory()) {
          fillCompleteModel(node);
        }
      } else {
        CampaignClient.getInstance().addWaitBeanListener(
            new WaitBeanListener() {
View Full Code Here

  public boolean importData(TransferSupport info) {
    UniqueID data = verifyDrop(info);

    if (data != null) {
      JTree target = (JTree) info.getComponent();
      BeanBasicDocument docToMove = CampaignClient.getInstance().getBean(
          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.BeanBasicDocument

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.