org.eclipse.draw2d.geometry.PrecisionDimension Java Examples
The following examples show how to use
org.eclipse.draw2d.geometry.PrecisionDimension.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VisualInterfaceViewer.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private Dimension getPreferredSize ( final Rectangle bounds ) { if ( this.symbol != null && this.symbol.getDesignSize () != null ) { return new PrecisionDimension ( this.symbol.getDesignSize ().getWidth (), this.symbol.getDesignSize ().getHeight () ); } else if ( this.figure != null ) { return this.figure.getPreferredSize ( bounds.width, bounds.height ); } else { return new PrecisionDimension ( bounds.width, bounds.height ); } }
Example #2
Source File: FigureController.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public void setPreferredWidth ( final double value ) { final PrecisionDimension dim = new PrecisionDimension (); dim.setPreciseWidth ( value ); dim.setPreciseHeight ( getPropertyFigure ().getPreferredSize ().preciseHeight () ); getPropertyFigure ().setPreferredSize ( dim ); }
Example #3
Source File: FigureController.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public void setPreferredHeight ( final double value ) { final PrecisionDimension dim = new PrecisionDimension (); dim.setPreciseWidth ( getPropertyFigure ().getPreferredSize ().preciseWidth () ); dim.setPreciseHeight ( value ); getPropertyFigure ().setPreferredSize ( dim ); }
Example #4
Source File: FigureController.java From neoscada with Eclipse Public License 1.0 | 5 votes |
protected org.eclipse.draw2d.geometry.Dimension create ( final Dimension dimension ) { if ( dimension == null ) { return null; } return new PrecisionDimension ( dimension.getWidth (), dimension.getHeight () ); }
Example #5
Source File: EnlargeContainerEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings({ "unchecked" }) private PrecisionRectangle calculateFeedbackBounds(ChangeBoundsRequest request, Rectangle feedbackBounds, IFigure containerFigure) { PrecisionRectangle result = new PrecisionRectangle(feedbackBounds.getCopy()); List<IGraphicalEditPart> editParts = request.getEditParts(); for (IGraphicalEditPart editPart : editParts) { PrecisionRectangle transformedRect = new PrecisionRectangle(editPart.getFigure().getBounds().getCopy()); editPart.getFigure().translateToAbsolute(transformedRect); result.union((Rectangle) transformedRect); } PrecisionDimension preferredSize = new PrecisionDimension(containerFigure.getPreferredSize().getCopy()); containerFigure.translateToAbsolute(preferredSize); if (result.preciseWidth() < preferredSize.preciseWidth() + SPACEING) { result.setPreciseWidth(preferredSize.preciseWidth() + SPACEING); } if (result.preciseHeight() < preferredSize.preciseHeight() + SPACEING) { result.setPreciseHeight(preferredSize.preciseHeight() + SPACEING); } if (result.x < feedbackBounds.x) { result.x = feedbackBounds.x; } if (result.y < feedbackBounds.y) { result.y = feedbackBounds.y; } return result; }
Example #6
Source File: RelativeBendpointUtil.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public void forceLocation(Connection conn, RelativeBendpoint relbp, double locX, double locY) { float w = 0; Dimension d2 = new Dimension(); PrecisionDimension d1 = new PrecisionDimension(); // compute d1 based on source anchor PrecisionPoint a1 = new PrecisionPoint(conn.getSourceAnchor().getReferencePoint()); Point a1Copy = a1.getCopy(); conn.translateToRelative(a1Copy); // x = a1.preciseX() + d1.preciseWidth() // <=> x - a1.preciseX() = d1.preciseWidth() d1.setPreciseWidth(locX - a1Copy.preciseX()); d1.setPreciseHeight(locY - a1Copy.preciseY()); relbp.setRelativeDimensions(d1, d2); relbp.setWeight(w); // ensure location is correct Point location = relbp.getLocation(); if (Math.abs(location.preciseX() - locX) > 0.1) { throw new IllegalStateException( "cannot force location-x: expected <" + locX + "> but got <" + location.preciseX() + ">"); } if (Math.abs(location.preciseY() - locY) > 0.1) { throw new IllegalStateException( "cannot force location-y: expected <" + locY + "> but got <" + location.preciseY() + ">"); } }
Example #7
Source File: AbstractPageFlowLayout.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Result getReportBounds( Rectangle reportSize ) { Result revValue = new Result( ); revValue.reportSize.y = MINTOPSPACE; revValue.reportSize.width = reportSize.width; revValue.reportSize.height = reportSize.height; EditPartViewer viewer = owner.getViewer( ); Scrollable control = viewer == null ? null : (Scrollable)viewer.getControl( ); Rectangle containerSize = control == null ? new Rectangle( ) : new Rectangle( control.getClientArea( ) ); PrecisionDimension dim = new PrecisionDimension( containerSize.width, containerSize.height ); double scale = getZoomManager( ).getZoom( ); dim.performScale( 1 / scale ); if ( dim.width > reportSize.width + MINLEFTSPACE + MINRIGHTSPACE ) { revValue.reportSize.x = ( dim.width - reportSize.width ) / 2; revValue.rightSpace = ( dim.width - reportSize.width ) / 2; } else { revValue.reportSize.x = MINLEFTSPACE; revValue.rightSpace = MINRIGHTSPACE; } if ( dim.height > reportSize.height + MINTOPSPACE + MINBOTTOMSPACE ) { revValue.bottomSpace = dim.height - reportSize.height - revValue.reportSize.y; } else { revValue.bottomSpace = MINBOTTOMSPACE; } return revValue; }
Example #8
Source File: XYChildController.java From neoscada with Eclipse Public License 1.0 | 4 votes |
public void setDimension ( final double width, final double height ) { this.rect.setSize ( new PrecisionDimension ( width, height ) ); this.figure.getParent ().setConstraint ( this.figure, this.rect ); }
Example #9
Source File: FigureController.java From neoscada with Eclipse Public License 1.0 | 4 votes |
public void setPreferredSize ( final double width, final double height ) { setPreferredSize ( new PrecisionDimension ( width, height ) ); }