Beispiel #1
0
  public boolean moveToGroup(String group) {
    String currentParent = Group.substractParentName(getName());
    if (group.equals(currentParent)) return false;

    // String oldName = getName();
    String newName;
    if (group.equals(nullString)) newName = Group.substractObjectName(getName());
    else newName = group + Constants.GROUP_SEPARATOR + Group.substractObjectName(getName());

    // object with new name already exists, add suffix // !!!
    Object obj;
    boolean renameNeeded = false;
    while ((obj = Group.getRoot().findObject(newName, true)) != null) {
      if (obj == this) // it's me :) already moved, fix data
      {
        name = newName;
        return true;
      } else {
        renameNeeded = true;
        newName = StringUtils.incrementName(newName, Constants.MOVE_SUFFIX);
      }
    }

    if (renameNeeded) return rename(newName);

    getParent().removeObject(Group.substractObjectName(getName()));
    setParent(null);
    Group.getRoot().addSubObject(newName, this, true);

    name = newName;
    unconditionalValidation();

    return true;
  }
Beispiel #2
0
  public Flexible copyToGroup(String group) {

    String newName;
    if (group.equals(nullString)) newName = Group.substractObjectName(getName());
    else newName = group + Constants.GROUP_SEPARATOR + Group.substractObjectName(getName());

    // object with new name already exists, add suffix ///!!!
    while (Group.getRoot().findObject(newName, true) != null)
      newName = StringUtils.incrementName(newName, Constants.COPY_SUFFIX);

    Box grBox =
        new Box(
            newName,
            null,
            startVertex.getX(),
            startVertex.getY(),
            endVertex.getX(),
            endVertex.getY());
    grBox.setColor(getColor());
    Group.getRoot().addSubObject(newName, grBox, true);

    // ViewState view = ViewState.getInstance();
    // grBox.move(20 - view.getRx(), 20 - view.getRy());

    unconditionalValidation();
    return grBox;
  }
  /**
   * Insert the method's description here. Creation date: (28.1.2001 13:12:23)
   *
   * @param field com.cosylab.vdct.vdb.VDBFieldData
   */
  public void fieldValueChanged(VDBFieldData field) {
    Record visualRecord = (Record) Group.getRoot().findObject(getName(), true);
    if (visualRecord == null) {
      // com.cosylab.vdct.Console.getInstance().println("o) Internal error: no visual representation
      // of record "+getName()+" found.");
      return;
    }

    com.cosylab.vdct.inspector.InspectorManager.getInstance().updateProperty(visualRecord, field);
    visualRecord.fieldChanged(field);
  }
  /**
   * Insert the method's description here. Creation date: (9.12.2000 18:13:17)
   *
   * @param newComment java.lang.String
   */
  public void setComment(java.lang.String newComment) {
    comment = newComment;

    Inspectable visualObj = (Inspectable) Group.getRoot().findObject(getName(), true);
    if (visualObj == null) {
      // com.cosylab.vdct.Console.getInstance().println("o) Internal error: no visual representation
      // of record "+getName()+" found.");
      return;
    }

    com.cosylab.vdct.inspector.InspectorManager.getInstance().updateCommentProperty(visualObj);
  }