/** * Refresh this node SplineConnection's children (its decorations). Calling the locator's relocate() moves these decorations. * * @param conn * the node connection * @param force * force a refresh that might cause infinite loops * @return true if we could refresh (edit part and figure exist) */ public boolean refreshNodeConnection(NodeConnection conn, boolean force) { NodeConnectionEditPart nc = (NodeConnectionEditPart) getViewer().getEditPartRegistry().get(conn); if (nc != null) { // seems to cause infinite loops with connection router. if (force) nc.refreshVisuals(); for (Iterator iter = nc.getFigure().getChildren().iterator(); iter.hasNext();) { IFigure fig = (IFigure) iter.next(); if (fig instanceof TimeoutPathFigure || fig instanceof Label) { Locator loc = (Locator) ((SplineConnection) nc.getFigure()).getLayoutManager().getConstraint(fig); // don't know why isn't refreshing stub/timer labels // probably has to do with implementation of locator // Seems to be useful when moving the node connection // indirectly. loc.relocate(fig); } } return true; } return false; }
/** * Shows a focus rectangle around the host's figure. The focus rectangle is * expanded by 5 pixels from the figure's bounds. * * @see org.eclipse.gef.editpolicies.SelectionEditPolicy#showFocus() */ protected void showFocus() { focusRect = new AbstractHandle((GraphicalEditPart) getHost(), new Locator() { public void relocate(IFigure target) { IFigure figure = getHostFigure(); Rectangle r; if (figure instanceof HandleBounds) r = ((HandleBounds) figure).getHandleBounds() .getCopy(); else r = getHostFigure().getBounds().getResized(-1, -1); getHostFigure().translateToAbsolute(r); target.translateToRelative(r); target.setBounds(r.expand(5, 5).resize(1, 1)); } }) { { setBorder(new FocusBorder()); } protected DragTracker createDragTracker() { return null; } }; addFeedback(focusRect); }
/** * This method returns a {@link ConnectionEndpointLocator} for this {@link Relation} from type * relationship. * * @return locator org.eclipse.draw2d.ConnectionEndpointLocator * */ private Locator getConnectionLocator(final PolylineConnection connection, final boolean isEnd) { final ConnectionEndpointLocator locator = new ConnectionEndpointLocator(connection, isEnd); locator.setVDistance(-1); locator.setUDistance(1); return locator; }
public AbstractGuideHandle( GraphicalEditPart owner, Locator loc ) { super( owner, loc ); addMouseMotionListener( this ); getLocator( ).relocate( this ); }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public ColumnDragHandle( TableEditPart owner, Locator loc, int start, int end ) { super( owner, loc ); this.start = start; this.end = end; initialize( ); }
public BandMoveHandle(GraphicalEditPart owner, Locator loc) { super(owner, loc); }
public ControlFigure(GraphicalEditPart owner, Locator loc) { super( owner, loc ); }
public void reveal( EditPart part ) { // In some case, the editor control is not created, but get the sync selection event. // Fix this problem temporary. if(getFigureCanvas( )==null || getFigureCanvas( ).isDisposed( )) { return; } Viewport port = getFigureCanvas( ).getViewport( ); IFigure target = ( (GraphicalEditPart) part ).getFigure( ); Rectangle exposeRegion = target.getBounds( ).getCopy( ); // Get the primary editpolicy EditPolicy policy = part.getEditPolicy( EditPolicy.PRIMARY_DRAG_ROLE ); // If the policy let us access the handles, proceed, otherwise // default to original behaviour if ( !( policy instanceof ISelectionHandlesEditPolicy ) ) { super.reveal( part ); return; } // First translate exposeRegion to the root level target = target.getParent( ); while ( target != null && target != port ) { target.translateToParent( exposeRegion ); target = target.getParent( ); } // Merge selection handles if any to the exposeRegion List handles = ( (ISelectionHandlesEditPolicy) policy ).getHandles( ); for ( Iterator iter = handles.iterator( ); iter.hasNext( ); ) { AbstractHandle handle = (AbstractHandle) iter.next( ); Locator locator = handle.getLocator( ); locator.relocate( handle ); exposeRegion.union( handle.getBounds( ).getCopy( ) ); } exposeRegion.getExpanded( 5, 5 ); Dimension viewportSize = port.getClientArea( ).getSize( ); Point topLeft = exposeRegion.getTopLeft( ); Point bottomRight = exposeRegion.getBottomRight( ) .translate( viewportSize.getNegated( ) ); Point finalLocation = new Point( ); if ( viewportSize.width < exposeRegion.width ) finalLocation.x = Math.min( bottomRight.x, Math.max( topLeft.x, port.getViewLocation( ).x ) ); else finalLocation.x = Math.min( topLeft.x, Math.max( bottomRight.x, port.getViewLocation( ).x ) ); if ( viewportSize.height < exposeRegion.height ) finalLocation.y = Math.min( bottomRight.y, Math.max( topLeft.y, port.getViewLocation( ).y ) ); else finalLocation.y = Math.min( topLeft.y, Math.max( bottomRight.y, port.getViewLocation( ).y ) ); getFigureCanvas( ).scrollSmoothTo( finalLocation.x, finalLocation.y ); }
/** * @param owner */ public ListControlMenuFigure( GraphicalEditPart owner, Locator loc ) { super( owner, loc ); setBounds( new Rectangle( 55, 0, 18, 19 ) ); }
/** * Creates a new BendpointMoveHandle and sets its owner to * <code>owner</code>, sets its index to <code>index</code>, and sets its * locator to <code>locator</code>. * * @param owner * the ConnectionEditPart owner * @param index * the index * @param locator * the Locator */ public BendpointMoveHandle(ConnectionEditPart owner, int index, Locator locator) { setOwner(owner); setIndex(index); setLocator(locator); }
/** * Creates a new BendpointCreationHandle and sets its owner to * <code>owner</code>, sets its index to <code>index</code>, and sets its * locator to <code>locator</code>. * * @param owner * the ConnectionEditPart owner * @param index * the index * @param locator * the Locator */ public BendpointCreationHandle(ConnectionEditPart owner, int index, Locator locator) { setOwner(owner); setIndex(index); setLocator(locator); }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public RowHandle( TableEditPart owner, Locator loc, int number ) { super( owner, loc ); this.rowNumber = number; initialize( ); }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public RowDragHandle( TableEditPart owner, Locator loc, int start, int end ) { super( owner, loc ); this.start = start; this.end = end; initialize( ); }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public ColumnHandle( TableEditPart owner, Locator loc, int number ) { super( owner, loc ); this.columnNumber = number; initialize( ); }
/** * Creates a new BendpointCreationHandle and sets its owner to * <code>owner</code>, sets its index to <code>index</code>, and * sets its locator to <code>locator</code>. * @param owner the ConnectionEditPart owner * @param index the index * @param locator the Locator */ public SequenceBendpointCreationHandle(ConnectionEditPart owner, int index, Locator locator) { setOwner(owner); setIndex(index); setLocator(locator); }
/** * Creates a new ResizeHandle for the given GraphicalEditPart. * * @see SquareHandle#SquareHandle(GraphicalEditPart, Locator, Cursor) */ public SothEastRectangleHandles(GraphicalEditPart owner, Locator loc, Cursor c) { super(owner, loc, c); }
public CellMoveHandle(GraphicalEditPart owner, Locator loc) { super(owner, loc); }
/** * Creates a new ResizeHandle for the given GraphicalEditPart. * * @see SquareHandle#SquareHandle(GraphicalEditPart, Locator, Cursor) */ public ResizeHandle(GraphicalEditPart owner, Locator loc, Cursor c) { super(owner, loc, c); }
/** * Creates a SquareHandle for the given <code>GraphicalEditPart</code> with * the given <code>Locator</code>. * * @param owner * the owner * @param loc * the locator */ public SquareHandle(GraphicalEditPart owner, Locator loc) { super(owner, loc); }
/** * Creates a SquareHandle for the given <code>GraphicalEditPart</code> with * the given <code>Cursor</code> using the given <code>Locator</code>. * * @param owner * The editpart which provided this handle * @param loc * The locator to position the handle * @param c * The cursor to display when the mouse is over the handle */ public SquareHandle(GraphicalEditPart owner, Locator loc, Cursor c) { super(owner, loc, c); }
/** * Creates a NonResizableHandle for the given <code>GraphicalEditPart</code> * using the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public NonResizableHandle(GraphicalEditPart owner, Locator loc) { super(owner, loc); }
/** * Creates a handle for the given <code>GraphicalEditPart</code> using the * given <code>Locator</code>. * * @param owner * The editpart which provided this handle * @param loc * The locator to position the handle */ public AbstractHandle(GraphicalEditPart owner, Locator loc) { setOwner(owner); setLocator(loc); }
/** * Creates a handle for the given <code>GraphicalEditPart</code> using the * given <code>Locator</code> and <code>Cursor</code>. * * @param owner * The editpart which provided this handle * @param loc * The locator to position the handle * @param c * The cursor to display when the mouse is over the handle */ public AbstractHandle(GraphicalEditPart owner, Locator loc, Cursor c) { this(owner, loc); setCursor(c); }
/** * Returns the <code>Locator</code> used to position this handle. * * @return the locator */ public Locator getLocator() { return locator; }
/** * Sets the locator which position this handle. * * @param locator * the new locator */ protected void setLocator(Locator locator) { this.locator = locator; }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public MoveHandle(GraphicalEditPart owner, Locator loc) { super(owner, loc); initialize(); }
/** * Creates a new ResizeHandle for the given GraphicalEditPart. * * @see SquareHandle#SquareHandle(GraphicalEditPart, Locator, Cursor) */ public ReportResizeHandle( GraphicalEditPart owner, Locator loc, Cursor c ) { super( owner, loc, c ); }
/** * Creates a Column and Row Handle for the given <code>TableEditPart</code> * using a default {@link Locator}. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public TableHFHandle( TableEditPart owner, Locator loc ) { super( owner, loc ); initialize( ); }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public ReportMoveHandle( GraphicalEditPart owner, Locator loc ) { super( owner, loc ); }
/** * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using * the given <code>Locator</code>. * * @param owner * The GraphicalEditPart to be moved by this handle. * @param loc * The Locator used to place the handle. */ public CornerHandle( TableEditPart owner, Locator loc ) { super( owner, loc ); initialize( ); }