コード例 #1
0
ファイル: ClassEntityView.java プロジェクト: As2piK/slyuml
  @Override
  public void gMouseMoved(MouseEvent e) {
    final GraphicComponent textBoxMouseHover =
        GraphicView.searchComponentWithPosition(getAllTextBox(), e.getPoint());
    GraphicView.computeComponentEventEnter(textBoxMouseHover, saveTextBoxMouseHover, e);

    saveTextBoxMouseHover = textBoxMouseHover;
  }
コード例 #2
0
ファイル: ClassEntityView.java プロジェクト: As2piK/slyuml
  @Override
  public void gMouseClicked(MouseEvent e) {
    super.gMouseClicked(e);

    final TextBox textBox = GraphicView.searchComponentWithPosition(getAllTextBox(), e.getPoint());

    if (textBox != null) {
      final AbstractIDiagramComponent idc = textBox.getAssociedComponent();

      if (idc != null) {
        idc.select();
        idc.notifyObservers(UpdateMessage.SELECT);
      }

      if (e.getClickCount() == 2) textBox.editing();
    }
  }
コード例 #3
0
ファイル: ClassEntityView.java プロジェクト: As2piK/slyuml
  /** Adjust the width according to its content. */
  public void adjustWidth() {
    int width = Short.MIN_VALUE;

    for (final TextBox tb : getAllTextBox()) {
      final int tbWidth = tb.getTextDim().width;

      if (tbWidth > width) width = tbWidth; // get the longer content
    }

    // change the width according to the grid
    final Rectangle bounds = getBounds();

    Change.push(new BufferBounds(this));
    setBounds(
        new Rectangle(bounds.x, bounds.y, width + GraphicView.getGridSize() + 15, bounds.height));
    Change.push(new BufferBounds(this));
  }
コード例 #4
0
ファイル: ClassEntityView.java プロジェクト: As2piK/slyuml
 /**
  * Search and return the Textbox (methods and attributes) at the given location.
  *
  * @param location the location where find a TextBox
  * @return the found TextBox
  */
 private TextBox searchTextBoxAtLocation(Point location) {
   final LinkedList<TextBox> tb = getAllTextBox();
   tb.remove(entityName);
   return GraphicView.searchComponentWithPosition(tb, location);
 }