Package org.tinyuml.draw

Examples of org.tinyuml.draw.DiagramElement


  /**
   * Resets the current connection's points.
   */
  public void resetConnectionPoints() {
    DiagramElement elem = selectionHandler.getSelectedElements().get(0);
    if (elem instanceof Connection) {
      execute(new ResetConnectionPointsCommand(this, (Connection) elem));
    }
  }
View Full Code Here


  /**
   * Removes the current selection.
   */
  public void deleteSelection() {
    DiagramElement element = getSelectedElement();
    if (element != null) {
      execute(new DeleteElementCommand(this, element));
    }
  }
View Full Code Here

  /**
   * Returns the current selection.
   * @return the selected element
   */
  public DiagramElement getSelectedElement() {
    DiagramElement elem = selectionHandler.getSelectedElement();
    return elem == NullElement.getInstance() ? null : elem;
  }
View Full Code Here

  /**
   * Removes the current selection.
   */
  public void deleteSelection() {
    DiagramElement element = getSelectedElement();
    if (element != null) {
      execute(new DeleteElementCommand(this, element));
    }
  }
View Full Code Here

  /**
   * Returns the current selection.
   * @return the selected element
   */
  public DiagramElement getSelectedElement() {
    DiagramElement elem = selectionHandler.getSelectedElement();
    return elem == NullElement.getInstance() ? null : elem;
  }
View Full Code Here

  /**
   * Removes the current selection.
   */
  public void deleteSelection() {
    DiagramElement element = getSelectedElement();
    if (element != null) {
      execute(new DeleteElementCommand(this, element));
    }
  }
View Full Code Here

  /**
   * Returns the current selection.
   * @return the selected element
   */
  public DiagramElement getSelectedElement() {
    DiagramElement elem = selectionHandler.getSelectedElement();
    return elem == NullElement.getInstance() ? null : elem;
  }
View Full Code Here

   */
  private void handleSelectionOnMouseClicked(EditorMouseEvent e) {
    double mx = e.getX(), my = e.getY();
    // this is a pretty ugly cast, it is needed in order to use the getLabel()
    // method which is not a base DiagramElement method
    DiagramElement previousSelected = currentSelection.getElement();
    DiagramElement element = editor.getDiagram().getChildAt(mx, my);
    if (element instanceof UmlDiagramElement && previousSelected == element) {
      Label label = element.getLabelAt(mx, my);
      if (label != null) {
        editor.editLabel(label);
      } else if (e.getClickCount() >= 2) {
        editor.editProperties(element);
      }
    } else if (editor.getDiagram().getLabelAt(mx, my) != null) {
      // Edit the diagram name
      editor.editLabel(editor.getDiagram().getLabelAt(mx, my));
    } else {
      if (element == NullElement.getInstance()) {
        element = editor.getDiagram();
      }
      currentSelection = element.getSelection(editor);
    }
    editor.redraw();
    notifyListeners();
  }
View Full Code Here

   */
  private Selection getSelection(double mx, double my) {
    if (!nothingSelected() && currentSelection.contains(mx, my)) {
      return currentSelection;
    }
    DiagramElement element = editor.getDiagram().getChildAt(mx, my);
    if (element != NullElement.getInstance()) {
      // select the element
      return element.getSelection(editor);
    }
    return editor.getDiagram().getSelection(editor);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void mousePressed(EditorMouseEvent event) {
    double mx = event.getX(), my = event.getY();
    DiagramElement elem = editor.getDiagram().getChildAt(mx, my);
    if (elem instanceof Node) {
      anchor.setLocation(mx, my);
      isDragging = true;
      source = elem;
    }
View Full Code Here

TOP

Related Classes of org.tinyuml.draw.DiagramElement

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.