• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Transposer类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.eclipse.draw2d.geometry.Transposer的典型用法代码示例。如果您正苦于以下问题:Java Transposer类的具体用法?Java Transposer怎么用?Java Transposer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

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

示例1: canDrawNumber

点赞 3

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
private boolean canDrawNumber(String num, Point startPoint ,Graphics g)
{
	Transposer transposer = new Transposer();
	transposer.setEnabled( !isHorizontal() );
	Rectangle rect =  transposer.t( g.getClip( Rectangle.SINGLETON ));
	Dimension strSize = FigureUtilities.getStringExtents(num, getFont());
	startPoint = transposer.t(startPoint);
	
	if (strSize.width + startPoint.x > rect.x  +  rect.width)
	{
		return false;
	}
	rect = transposer.t( getEndRect( g
			.getClip( Rectangle.SINGLETON ) ));
	
	if (rect.width == 0)
	{
		return true;
	}
	if (strSize.width + startPoint.x > rect.x)
	{
		return false;
	}
	return true;
}
 

开发者ID:eclipse,
项目名称:birt,
代码行数:26,
代码来源:EditorRulerFigure.java

示例2: getFeedbackIndexFor

点赞 3

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
protected int getFeedbackIndexFor( Request request )
{
	Transposer transposer = new Transposer( );
	transposer.setEnabled( !isHorizontal( ) );

	List list = getHost( ).getChildren( );
	int size = list.size( ) - 1;
	int index = getFeedbackPosition( request );
	if ( size < 0 || index < 0 || index > size )
	{
		return index;
	}

	Rectangle rect = getAbsoluteBounds( (GraphicalEditPart) list.get( size ) );
	Point p = transposer.t( getLocationFromRequest( request ) );
	if ( p.y > rect.bottom( ) )
	{
		index = -1;
	}

	return index;
}
 

开发者ID:eclipse,
项目名称:birt,
代码行数:23,
代码来源:ReportFlowLayoutEditPolicy.java

示例3: setTargetFeedbackPoints

点赞 2

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
protected void setTargetFeedbackPoints( Point p1, Point p2 )
{
	Transposer transposer = new Transposer( );
	transposer.setEnabled( !isHorizontal( ) );

	Rectangle parentBox = transposer.t( getAbsoluteClientBounds( (GraphicalEditPart) getHost( ) ) );
	Polyline fb = getLineFeedback( );
	if ( p2.y >= parentBox.bottom( ) && parentBox.bottom( ) - p1.y < 10 )
	{
		p2.y = p1.y;

		List list = ( (GraphicalEditPart) getHost( ) ).getChildren( );
		int size = list.size( );
		if ( size == 0 )
		{
			p2.x = p1.x + Math.min( 30, parentBox.width );
		}
		else
		{
			GraphicalEditPart last = (GraphicalEditPart) list.get( size - 1 );
			Rectangle rect = getAbsoluteBounds( last );
			p2.x = p1.x + Math.min( rect.width - 8, parentBox.width );
		}
	}
	else if ( p2.y >= parentBox.bottom( ) )
	{
		p2.y = parentBox.bottom( );
	}
	fb.translateToRelative( p1 );

	fb.translateToRelative( p2 );

	fb.setPoint( p1, 0 );
	fb.setPoint( p2, 1 );
}
 

开发者ID:eclipse,
项目名称:birt,
代码行数:36,
代码来源:ReportFlowLayoutEditPolicy.java

示例4: getFeedbackIndexFor

点赞 2

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
/**
 * @param request
 *            the Request
 * @return the index for the insertion reference
 */
protected int getFeedbackIndexFor(Request request) {
	List children = getHost().getChildren();
	if (children.isEmpty())
		return -1;

	Transposer transposer = new Transposer();
	transposer.setEnabled(!isLayoutHorizontal());

	Point p = transposer.t(getLocationFromRequest(request));

	// Current row bottom, initialize to above the top.
	int rowBottom = Integer.MIN_VALUE;
	int candidate = -1;
	for (int i = 0; i < children.size(); i++) {
		EditPart child = (EditPart) children.get(i);
		Rectangle rect = transposer
				.t(getAbsoluteBounds(((GraphicalEditPart) child)));
		if (rect.y > rowBottom) {
			/*
			 * We are in a new row, so if we don't have a candidate but yet
			 * are within the previous row, then the current entry becomes
			 * the candidate. This is because we know we must be to the
			 * right of center of the last Figure in the previous row, so
			 * this Figure (which is at the start of a new row) is the
			 * candidate.
			 */
			if (p.y <= rowBottom) {
				if (candidate == -1)
					candidate = i;
				break;
			} else
				candidate = -1; // Mouse's Y is outside the row, so reset
								// the candidate
		}
		rowBottom = Math.max(rowBottom, rect.bottom());
		if (candidate == -1) {
			/*
			 * See if we have a possible candidate. It is a candidate if the
			 * cursor is left of the center of this candidate.
			 */
			if (p.x <= rect.x + (rect.width / 2))
				candidate = i;
		}
		if (candidate != -1) {
			// We have a candidate, see if the rowBottom has grown to
			// include the mouse Y.
			if (p.y <= rowBottom) {
				/*
				 * Now we have determined that the cursor.Y is above the
				 * bottom of the current row of figures. Stop now, to
				 * prevent the next row from being searched
				 */
				break;
			}
		}
	}
	return candidate;
}
 

开发者ID:ghillairet,
项目名称:gef-gwt,
代码行数:64,
代码来源:FlowLayoutEditPolicy.java

示例5: showLayoutTargetFeedback

点赞 2

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
protected void showLayoutTargetFeedback( Request request )
{

	boolean isCrossTabElement = false;

	if ( request instanceof ChangeBoundsRequest )
	{
		List editParts = ( (ChangeBoundsRequest) request ).getEditParts( );
		if ( editParts.size( ) > 0 )
		{
			isCrossTabElement = editParts.get( 0 ) instanceof CrosstabCellEditPart;
		}
	}

	if ( !isCrossTabElement )
	{
		Object template = TemplateTransfer.getInstance( ).getTemplate( );
		if ( template instanceof Object[]
				&& ( (Object[]) template ).length > 0 )
		{
			Object dragObject = ( (Object[]) template )[0];
			if ( dragObject instanceof DimensionHandle
					|| dragObject instanceof MeasureHandle
					|| dragObject instanceof LevelHandle )
			{
				isCrossTabElement = true;
			}
		}
	}

	if ( isCrossTabElement )
	{
		Transposer transposer = new Transposer( );
		transposer.setEnabled( !isHorizontal( ) );
		Rectangle r = transposer.t( getAbsoluteClientBounds( (GraphicalEditPart) getHost( ) ) );
		Point p = transposer.t( getLocationFromRequest( request ) );
		boolean before = p.x <= r.x + ( r.width / 2 );

		Point p1 = new Point( before ? r.x : r.x + r.width, r.y - 2 );
		p1 = transposer.t( p1 );

		Point p2 = new Point( before ? r.x : r.x + r.width, r.y
				+ r.height
				+ 7 );
		p2 = transposer.t( p2 );

		setTargetFeedbackPoints( p1, p2 );

	}
	else
	{
		super.showLayoutTargetFeedback( request );
	}
}
 

开发者ID:eclipse,
项目名称:birt,
代码行数:55,
代码来源:CrosstabCellFlowLayoutEditPolicy.java

示例6: getFeedbackPosition

点赞 2

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
/**
 * @param request
 *            the Request
 * @return the index for the insertion reference
 */
protected int getFeedbackPosition( Request request )
{
	List children = getHost( ).getChildren( );
	if ( children.isEmpty( ) )
		return -1;

	Transposer transposer = new Transposer( );
	transposer.setEnabled( !isHorizontal( ) );

	Point p = transposer.t( getLocationFromRequest( request ) );

	// Current row bottom, initialize to above the top.
	int rowBottom = Integer.MIN_VALUE;
	int candidate = -1;
	for ( int i = 0; i < children.size( ); i++ )
	{
		EditPart child = (EditPart) children.get( i );
		Rectangle rect = transposer.t( getAbsoluteBounds( ( (GraphicalEditPart) child ) ) );
		if ( rect.y > rowBottom )
		{
			/*
			 * We are in a new row, so if we don't have a candidate but yet
			 * are within the previous row, then the current entry becomes
			 * the candidate. This is because we know we must be to the
			 * right of center of the last Figure in the previous row, so
			 * this Figure (which is at the start of a new row) is the
			 * candidate.
			 */
			if ( p.y <= rowBottom )
			{
				if ( candidate == -1 )
					candidate = i;
				break;
			}
			else
				candidate = -1; // Mouse's Y is outside the row, so reset
			// the candidate
		}
		rowBottom = Math.max( rowBottom, rect.bottom( ) );
		if ( candidate == -1 )
		{
			/*
			 * See if we have a possible candidate. It is a candidate if the
			 * cursor is left of the center of this candidate.
			 */
			if ( p.x <= rect.x + ( rect.width / 2 ) || p.y < rect.y )
				candidate = i;
		}
		if ( candidate != -1 )
		{
			// We have a candidate, see if the rowBottom has grown to
			// include the mouse Y.
			if ( p.y <= rowBottom )
			{
				/*
				 * Now we have determined that the cursor.Y is above the
				 * bottom of the current row of figures. Stop now, to
				 * prevent the next row from being searched
				 */
				break;
			}
		}
	}
	return candidate;
}
 

开发者ID:eclipse,
项目名称:birt,
代码行数:71,
代码来源:ReportFlowLayoutEditPolicy.java

示例7: getFeedbackIndexFor

点赞 2

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
/**
 * @return <code>true</code> if the host's LayoutManager is in a horizontal orientation
 * @deprecated Use {@link #isLayoutHorizontal()} instead.
 */

protected int getFeedbackIndexFor(Request request)
{
	List children = getHost().getChildren();
	if (children.isEmpty())
		return -1;

	Transposer transposer = new Transposer();
	transposer.setEnabled(true);

	Point p = transposer.t(getLocationFromRequest(request));

	// Current row bottom, initialize to above the top.
	int rowBottom = Integer.MIN_VALUE;
	int candidate = -1;
	for (int i = 0; i < children.size(); i++) {
		EditPart child = (EditPart) children.get(i);
		if (child instanceof QueryBlockModelPart || child instanceof TableModelPart
				|| child instanceof ChartBlockModelPart || child instanceof FrameModelPart) {
			Rectangle rect = transposer.t(getAbsoluteBounds(((GraphicalEditPart) child)));
			if (rect.y > rowBottom) {
				/*
				 * We are in a new row, so if we don't have a candidate but yet
				 * are within the previous row, then the current entry becomes
				 * the candidate. This is because we know we must be to the
				 * right of center of the last Figure in the previous row, so
				 * this Figure (which is at the start of a new row) is the
				 * candidate.
				 */
				if (p.y <= rowBottom) {
					if (candidate == -1)
						candidate = i;
					break;
				} else
					candidate = -1; // Mouse's Y is outside the row, so reset
									// the candidate
			}
			rowBottom = Math.max(rowBottom, rect.bottom());
			if (candidate == -1) {
				/*
				 * See if we have a possible candidate. It is a candidate if the
				 * cursor is left of the center of this candidate.
				 */
				if (p.x <= rect.x + (rect.width / 2))
					candidate = i;
			}
			if (candidate != -1) {
				// We have a candidate, see if the rowBottom has grown to
				// include the mouse Y.
				if (p.y <= rowBottom) {
					/*
					 * Now we have determined that the cursor.Y is above the
					 * bottom of the current row of figures. Stop now, to
					 * prevent the next row from being searched
					 */
					break;
				}
			}
		}
	}
	return candidate;
}
 

开发者ID:winture,
项目名称:wt-studio,
代码行数:67,
代码来源:PageLayoutEditPolicy.java

示例8: ScrollBarLayout

点赞 1

import org.eclipse.draw2d.geometry.Transposer; //导入依赖的package包/类
/**
 * Constructs a ScrollBarLayout. If the given Transposer is enabled, the
 * Scrollbar will be horizontally oriented. Otherwise, the ScrollBar will be
 * vertically oriented.
 * 
 * @param t
 *            the Transposer
 * @since 2.0
 */
public ScrollBarLayout(Transposer t) {
	transposer = t;
}
 

开发者ID:ghillairet,
项目名称:gef-gwt,
代码行数:13,
代码来源:ScrollBarLayout.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)