当前位置: 首页>>代码示例>>Java>>正文


Java PositionConstants.NORTH_SOUTH属性代码示例

本文整理汇总了Java中org.eclipse.draw2d.PositionConstants.NORTH_SOUTH属性的典型用法代码示例。如果您正苦于以下问题:Java PositionConstants.NORTH_SOUTH属性的具体用法?Java PositionConstants.NORTH_SOUTH怎么用?Java PositionConstants.NORTH_SOUTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.draw2d.PositionConstants的用法示例。


在下文中一共展示了PositionConstants.NORTH_SOUTH属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CellResizeHandleLocator2

/**
 * Constructs a RelativeLocator with the given reference figure and relative location. The location is a constant from
 * {@link PositionConstants} used as a convenient and readable way to set both the relativeX and relativeY values.
 * 
 * @param reference
 *          the reference figure
 * @param location
 *          one of NORTH, NORTH_EAST, etc.
 * @since 2.0
 */
public CellResizeHandleLocator2(GraphicalEditPart editPart, int location) {
	setReferenceFigure(editPart.getFigure());
	this.editPart = editPart;
	switch (location & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		relativeY = 0;
		break;
	case PositionConstants.SOUTH:
		relativeY = 1.0;
		break;
	default:
		relativeY = 0.5;
	}
	switch (location & PositionConstants.EAST_WEST) {
	case PositionConstants.WEST:
		relativeX = 0;
		break;
	case PositionConstants.EAST:
		relativeX = 1.0;
		break;
	default:
		relativeX = 0.5;
	}
	this.direction = location;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:35,代码来源:CellResizeHandleLocator2.java

示例2: CellResizeHandleLocator

/**
 * Constructs a RelativeLocator with the given reference figure and relative location. The location is a constant from
 * {@link PositionConstants} used as a convenient and readable way to set both the relativeX and relativeY values.
 * 
 * @param reference
 *          the reference figure
 * @param location
 *          one of NORTH, NORTH_EAST, etc.
 * @since 2.0
 */
public CellResizeHandleLocator(GraphicalEditPart editPart, int location) {
	setReferenceFigure(editPart.getFigure());
	switch (location & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		relativeY = 0;
		break;
	case PositionConstants.SOUTH:
		relativeY = 1.0;
		break;
	default:
		relativeY = 0.5;
	}
	switch (location & PositionConstants.EAST_WEST) {
	case PositionConstants.WEST:
		relativeX = 0;
		break;
	case PositionConstants.EAST:
		relativeX = 1.0;
		break;
	default:
		relativeX = 0.5;
	}
	this.direction = location;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:34,代码来源:CellResizeHandleLocator.java

示例3: CellDragoicator

/**
 * Constructor
 * 
 * @param reference
 * @param location
 */
public CellDragoicator( IFigure reference, int location )
{
	setReferenceFigure( reference );
	switch ( location & PositionConstants.NORTH_SOUTH )
	{
		case PositionConstants.SOUTH :
			relativeY = 1.0;
			break;
		default :
			relativeY = 0;
	}

	switch ( location & PositionConstants.EAST_WEST )
	{
		case PositionConstants.EAST :
			relativeX = 1.0;
			break;
		default :
			relativeX = 0;
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:27,代码来源:CellDragoicator.java

示例4: relocate

@Override
public void relocate(IFigure target) {
	IFigure reference = getReferenceFigure();
	Rectangle referenceBox = ((HandleBounds) reference).getHandleBounds();
	Rectangle targetBounds = new PrecisionRectangle(referenceBox.getResized(-1, -1));
	reference.translateToAbsolute(targetBounds);
	target.translateToRelative(targetBounds);
	targetBounds.resize(1, 1);

	int w = 2;
	int h = 2;
	switch (direction & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		w = targetBounds.width;
		targetBounds.y += (int) (targetBounds.height * relativeY - ((h / 2))) + 1;
		break;
	case PositionConstants.SOUTH:
		w = targetBounds.width;
		targetBounds.y += (int) (targetBounds.height * relativeY - (h / 2)) - 1;
		targetBounds.x += -1;
		break;
	}
	switch (direction & PositionConstants.EAST_WEST) {
	case PositionConstants.WEST:
		h = targetBounds.height;
		targetBounds.y += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (w / 2)) - 1;
		break;
	case PositionConstants.EAST:
		h = targetBounds.height;
		targetBounds.y += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (w / 2) - 1);
		break;
	}

	targetBounds.setSize(w, h);
	target.setBounds(targetBounds);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:38,代码来源:CellResizeHandleLocator.java

示例5: BandResizeHandleLocator

/**
 * Constructs a RelativeLocator with the given reference figure and relative location. The location is a constant from
 * {@link PositionConstants} used as a convenient and readable way to set both the relativeX and relativeY values.
 * 
 * @param reference
 *          the reference figure
 * @param location
 *          one of NORTH, NORTH_EAST, etc.
 * @since 2.0
 */
public BandResizeHandleLocator(IFigure reference, int location) {
	setReferenceFigure(reference);
	switch (location & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		relativeY = 0;
		break;
	case PositionConstants.SOUTH:
		relativeY = 1.0;
		break;
	default:
		relativeY = 0.5;
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:BandResizeHandleLocator.java

示例6: relocate

@Override
public void relocate(IFigure target) {
	IFigure reference = getReferenceFigure();
	Rectangle referenceBox = ((HandleBounds) reference).getHandleBounds();
	Rectangle targetBounds = new PrecisionRectangle(referenceBox.getResized(-1, -1));
	reference.translateToAbsolute(targetBounds);
	target.translateToRelative(targetBounds);
	targetBounds.resize(1, 1);

	double xzoom = GEFUtil.getZoom(editPart);

	Dimension targetSize = target.getPreferredSize();
	Dimension d = targetSize;
	if (editPart instanceof IContainerPart) {
		d = ((IContainerPart) editPart).getContaierSize();
		// Commented for back-compatibility in 3.6. 
		// Replaced with the following 3 lines.
		// d = d.getCopy().setHeight(d.height + 18).scale(xzoom);
		Dimension dcopy = d.getCopy();
		dcopy.height = d.height + 18;
		d = dcopy.scale(xzoom);
	}

	int w = 4;
	int h = 4;
	switch (direction & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		w = d.width + 1;
		targetBounds.y += (int) (targetBounds.height * relativeY - ((targetSize.height)));// + 1;
		targetBounds.x = (int) Math.floor(10 * xzoom);
		break;
	case PositionConstants.SOUTH:
		w = d.width + 1;
		targetBounds.y += (int) (targetBounds.height * relativeY - ((targetSize.height))) - 1;// + 1) / 2)) + 1;
		targetBounds.x = (int) Math.floor(10 * xzoom);
		break;
	}
	switch (direction & PositionConstants.EAST_WEST) {
	case PositionConstants.WEST:
		h = d.height - (int) Math.floor(10 * xzoom);
		targetBounds.y = (int) Math.floor(7 * xzoom);// += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (targetSize.width));// + 1;// + 1;
		break;
	case PositionConstants.EAST:
		h = d.height - (int) Math.floor(10 * xzoom);
		targetBounds.y = (int) Math.floor(7 * xzoom);// += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (targetSize.width)) - 1;// / 2);// + 1;
		break;
	}
	targetBounds.setSize(w + 1, h + 1);
	target.setBounds(targetBounds);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:52,代码来源:CellResizeHandleLocator2.java

示例7: paintFigure

/**
 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
 */
protected void paintFigure( Graphics graphics )
{
	if ( isOpaque( ) )
	{
		if ( getBorder( ) instanceof BaseBorder )
		{
			graphics.fillRectangle( getBounds( ).getCopy( )
					.crop( ( (BaseBorder) getBorder( ) ).getBorderInsets( ) ) );
		}
		else
		{
			graphics.fillRectangle( getBounds( ) );
		}
	}

	Image image = getImage( );
	if ( image == null )
	{
		return;
	}

	int x, y;
	Rectangle area = getBounds( );

	// Calculates X
	if ( position != null && position.x != -1 )
	{
		x = area.x + position.x;
	}
	else
	{
		switch ( alignment & PositionConstants.EAST_WEST )
		{
			case PositionConstants.EAST :
				x = area.x + area.width - size.width;
				break;
			case PositionConstants.WEST :
				x = area.x;
				break;
			default :
				x = ( area.width - size.width ) / 2 + area.x;
				break;
		}
	}

	// Calculates Y
	if ( position != null && position.y != -1 )
	{
		y = area.y + position.y;
	}
	else
	{
		switch ( alignment & PositionConstants.NORTH_SOUTH )
		{
			case PositionConstants.NORTH :
				y = area.y;
				break;
			case PositionConstants.SOUTH :
				y = area.y + area.height - size.height;
				break;
			default :
				y = ( area.height - size.height ) / 2 + area.y;
				break;
		}
	}

	ArrayList xyList = createImageList( x, y );

	Iterator iter = xyList.iterator( );
	while ( iter.hasNext( ) )
	{
		Point point = (Point) iter.next( );
		graphics.drawImage( image, point );
	}
	xyList.clear( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:79,代码来源:TableFigure.java

示例8: paintFigure

/**
 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
 */
protected void paintFigure( Graphics graphics )
{
	if ( isOpaque( ) )
	{
		if ( getBorder( ) instanceof BaseBorder )
		{
			graphics.fillRectangle( getBounds( ).getCopy( )
					.crop( ( (BaseBorder) getBorder( ) ).getBorderInsets( ) ) );
		}
		else
		{
			graphics.fillRectangle( getBounds( ) );
		}
	}

	if ( getImage( ) == null || getImage( ).isDisposed( ) )
	{
		return;
	}

	if ( stretch )
	{
		paintStretched( graphics );

		return;
	}

	int x, y;
	Rectangle area = getClientArea( );
	switch ( alignment & PositionConstants.NORTH_SOUTH )
	{
		case PositionConstants.NORTH :
			y = area.y;
			break;
		case PositionConstants.SOUTH :
			y = area.y + area.height - size.height;
			break;
		default :
			y = ( area.height - size.height ) / 2 + area.y;
			break;
	}
	switch ( alignment & PositionConstants.EAST_WEST )
	{
		case PositionConstants.EAST :
			x = area.x + area.width - size.width;
			break;
		case PositionConstants.WEST :
			x = area.x;
			break;
		default :
			x = ( area.width - size.width ) / 2 + area.x;
			break;
	}
	graphics.drawImage( getImage( ), x, y );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:58,代码来源:ImageFigure.java


注:本文中的org.eclipse.draw2d.PositionConstants.NORTH_SOUTH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。