@Override public void gMouseMoved(MouseEvent e) { final GraphicComponent textBoxMouseHover = GraphicView.searchComponentWithPosition(getAllTextBox(), e.getPoint()); GraphicView.computeComponentEventEnter(textBoxMouseHover, saveTextBoxMouseHover, e); saveTextBoxMouseHover = textBoxMouseHover; }
@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(); } }
/** 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)); }
/** * 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); }