Package info.textgrid.lab.noteeditor.model

Examples of info.textgrid.lab.noteeditor.model.BasicElement


    double currentZoom = getEditorZoomScaling();
    org.eclipse.draw2d.geometry.Point viewLocation = getEditorViewport()
        .getViewLocation();
    Iterator<Rectangle> rectangleIterator = FigureMultipassController.figurePassingObject
        .getHitBoxEventsMap().keySet().iterator();
    BasicElement foundForm;
    while (rectangleIterator.hasNext()) {
      Rectangle next = rectangleIterator.next();
      if (next.contains(new org.eclipse.draw2d.geometry.Point(
          (int) ((viewLocation.x + clickX) / currentZoom),
          (int) ((viewLocation.y + clickY) / currentZoom)))) {
View Full Code Here


        || !(getSelectedObjects().get(0) instanceof MusicEditPart)
        || ((MusicEditPart) getSelectedObjects().get(0)).getModel() == null)
      return false;
    MusicEditPart selectedEditPart = (MusicEditPart) getSelectedObjects()
        .get(0);
    BasicElement selectedModel = (BasicElement) selectedEditPart.getModel();
    if(selectedModel instanceof UnknownMeiNodeForm || selectedModel instanceof ErrorMsgDiagram)
      return false;
    for (Class candidate : MusicPlugin.allowedChildrenMap
        .get(selectedModel.getClass())) {
      if(isCandidate(candidate))
        return true;
    }
    return false;
  }
View Full Code Here

    if (child instanceof AppForm) {
      return isRelationAllowed & child != null && parent != null;
    } else if (parent instanceof AppForm && child instanceof ReadingForm) {
      return isRelationAllowed & child != null && parent != null;
    } else if (parent instanceof ReadingForm) {
      BasicElement greatParent = parent.getParent().getParent();
      isRelationAllowed = child != null && greatParent != null;
      return canExecuteCreation(isRelationAllowed, child, greatParent);
    } else {
      isRelationAllowed = canExecuteCreation(isRelationAllowed, child,
          parent);
View Full Code Here

  bounds.put(part, newBounds);
}

protected void clonePart(BasicElement oldPart, MusicContainerForm newParent, Rectangle newBounds,
            List<BasicElement> newConnections, Map<BasicElement, Serializable> connectionPartMap, int index) {
  BasicElement newPart = null;
 
  SimpleFactory simpleFactory = new SimpleFactory(
      oldPart.getClass());
  newPart = (BasicElement) simpleFactory.getNewObject();   
  if (oldPart instanceof MusicContainerForm) {
    Iterator<?> i = ((MusicContainerForm)oldPart).getChildren().iterator();
    while (i.hasNext()) {
      // for children they will not need new bounds
      clonePart((BasicElement)i.next(), (MusicContainerForm)newPart, null,
          newConnections, connectionPartMap, -1);
    }
  }
   
 
  if (index < 0) {
    newParent.addChild(newPart);
  } else {
    newParent.addChild(newPart, index);
  }
 
  newPart.setSize(oldPart.getSize());

 
  if (newBounds != null) {
    newPart.setLocation(newBounds.getTopLeft());
  } else {
    newPart.setLocation(oldPart.getLocation());
  }
 
  // keep track of the new parts so we can delete them in undo
  // keep track of the oldpart -> newpart map so that we can properly attach
  // all connections.
View Full Code Here

  newConnections = new LinkedList<BasicElement>();
  newTopLevelParts = new LinkedList<BasicElement>();

  Iterator<BasicElement> i = parts.iterator();
 
  BasicElement part = null;
  while (i.hasNext()) {
    part = i.next();
    if (bounds != null && bounds.containsKey(part)) {
      clonePart(part, parent, (Rectangle)bounds.get(part),
          newConnections, connectionPartMap, -1)
View Full Code Here

    if (staffDef.isSetLabel()) {
      extentForLabel = staffDef.getLabel().length()
          * this.figurePassingObject.getLabelSylExtentBase();
    }
    int extentForBrackets = 0;
    BasicElement parent = staffDefForm.getParent();
    while (parent.getFormType() == BasicElement.FormType.StaffGroup) {
      parent = parent.getParent();
      extentForBrackets += GraphicalConstants.SHAPE_STAFFDEF_BRACKET_OFFSET;
    }
    int extentForClefs = 0; // extent for clef keys if present
    if (staffDef.isSetClefShape()) {
      extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET;
View Full Code Here

   */
  public void reorganizeContainerLocations() {
    Point location;
    for (Iterator<BasicElement> i = this.musicDiagram.getChildren()
        .iterator(); i.hasNext();) {
      BasicElement child = i.next();
      if(!figurePassingObject.getLocationMap()
          .containsKey(child.getId())) {
        LogService.error("controller.reorganizeContainerLocations: no entry for " + child.getId());
        continue;
      }
      if (i.hasNext()) { // not the last: use starting position at upper
                // left
        child.setLocation(figurePassingObject.getLocationMap()
            .get(child.getId()));
      } else { // is the last: use startpos shift size at bottom right
        location = figurePassingObject.getLocationMap()
            .get(child.getId());
        Dimension dimension = figurePassingObject.getDimensionMap().get(
            child.getId());
        child.setLocation(new Point(location.x + dimension.width, location.y + dimension.height));
      }
    }
  }
View Full Code Here

  @Override
  protected Command createAddCommand(EditPart child, EditPart after) {
    if (!(child instanceof BasicElement))
      throw new MusicNotImplementedException();
    BasicElement part = (BasicElement) child.getModel();
    AddCommand add = new AddCommand();
    add.setParent((MusicContainerForm) getHost().getModel());
    add.setChild(part);
    return add;
View Full Code Here

  setXyLayout(layout);
}

protected Command createAddCommand(Request request, EditPart childEditPart,
    Object constraint) {
  BasicElement part = (BasicElement)childEditPart.getModel();
  Rectangle rect = (Rectangle)constraint;

  AddCommand add = new AddCommand();
  add.setParent((MusicContainerForm)getHost().getModel());
  add.setChild(part);
View Full Code Here

@Override
protected Command createChangeConstraintCommand(ChangeBoundsRequest request,
                                                EditPart child, Object constraint) {
  SetConstraintCommand cmd = new SetConstraintCommand();
  BasicElement part = (BasicElement)child.getModel();
  cmd.setPart(part);
  cmd.setLocation((Rectangle)constraint);
  Command result = cmd;

  return result;
View Full Code Here

TOP

Related Classes of info.textgrid.lab.noteeditor.model.BasicElement

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.