本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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( );
}
示例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 );
}