示例#1
0
 protected Request createRequest() {
   boolean copy = isCopyMove();
   Request request = new Request(copy ? GEF.REQ_COPYTO : GEF.REQ_MOVETO);
   request.setDomain(getDomain());
   request.setViewer(getTargetViewer());
   request.setPrimaryTarget(getSource());
   request.setParameter(GEF.PARAM_PARENT, targetParent);
   return request;
 }
 public void decorateMoveInRequest(
     IBranchPart targetParent,
     ParentSearchKey childKey,
     IBranchPart sourceParent,
     Request request) {
   RowHead rowHead =
       (RowHead) MindMapUtils.getCache(targetParent, Spreadsheet.KEY_INSERTION_ROW_HEAD);
   if (rowHead != null) {
     request.setParameter(
         MindMapUI.PARAM_PROPERTY_PREFIX + Core.Labels, new HashSet<String>(rowHead.getLabels()));
   } else {
     request.setParameter(MindMapUI.PARAM_PROPERTY_PREFIX + Core.Labels, new HashSet<String>());
   }
 }
 public void decorateMoveOutRequest(
     IBranchPart sourceParent,
     ParentSearchKey childKey,
     IBranchPart targetParent,
     Request request) {
   request.setParameter(MindMapUI.PARAM_PROPERTY_PREFIX + Core.Labels, null);
 }
  /*
   * (non-Javadoc)
   *
   * @see org.xmind.ui.tools.DummyCreateTool#createRequest()
   */
  protected Request createRequest() {
    if (position == null) return null;

    Request req;
    if (request != null) {
      req = request;
    } else {
      req = new Request(MindMapUI.REQ_CREATE_FLOAT);
    }
    req.setParameter(GEF.PARAM_POSITION, position);
    ISheetPart sheet = (ISheetPart) getTargetViewer().getAdapter(ISheetPart.class);
    if (sheet != null) {
      req.setPrimaryTarget(sheet);
    }
    return req;
  }
示例#5
0
 public void finish() {
   super.finish();
   if (request != null && request.hasTargets()) {
     getDomain().handleRequest(request);
     request = null;
   }
 }
 public void decorateCreateRequest(IBranchPart branch, IBranchPart sourceChild, Request request) {
   Column2 col = getColumn(branch);
   Cell2 cell = col.findCellByItem(sourceChild);
   if (cell != null) {
     RowHead rowHead = cell.getOwnedRow().getHead();
     request.setParameter(
         MindMapUI.PARAM_PROPERTY_PREFIX + Core.Labels, new HashSet<String>(rowHead.getLabels()));
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.xmind.gef.tool.CreateTool#internalHandleRequest(org.xmind.gef.Request
   * )
   */
  @Override
  protected void internalHandleRequest(Request request) {
    if (!getStatus().isStatus(GEF.ST_ACTIVE)) return;

    if (this.request == null && MindMapUI.REQ_CREATE_FLOAT.equals(request.getType())) {
      this.request = request;
      pack();
    } else {
      super.internalHandleRequest(request);
    }
  }
  private void pack() {
    if (branchDummy == null) return;

    if (request != null) {
      Object param = request.getParameter(MindMapUI.PARAM_PROPERTY_PREFIX + Core.StructureClass);
      if (param instanceof String) {
        branchDummy.getTopic().setStructureClass((String) param);
      }
    }
    branchDummy.pack();
  }