本文整理汇总了Java中org.eclipse.draw2d.PositionConstants.NORTH属性的典型用法代码示例。如果您正苦于以下问题:Java PositionConstants.NORTH属性的具体用法?Java PositionConstants.NORTH怎么用?Java PositionConstants.NORTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.draw2d.PositionConstants
的用法示例。
在下文中一共展示了PositionConstants.NORTH属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateImage
@SuppressWarnings("synthetic-access")
public void updateImage() {
if (editPart.figure == null)
return;
IBorderItemLocator borderItemLocator = getBorderItemLocator();
if (borderItemLocator != null) {
BorderedNodeFigure borderedNodeFigure = getBorderedNodeFigure();
int side = DBorderItemLocator.findClosestSideOfParent(editPart.getFigure().getBounds(), borderedNodeFigure.getBounds());
switch (side) {
case PositionConstants.SOUTH:
editPart.primaryShape.setImage(editPart.primaryShape.getBottomImage());
break;
case PositionConstants.NORTH:
editPart.primaryShape.setImage(editPart.primaryShape.getTopImage());
break;
case PositionConstants.WEST:
editPart.primaryShape.setImage(editPart.primaryShape.getLeftImage());
break;
case PositionConstants.EAST:
editPart.primaryShape.setImage(editPart.primaryShape.getRightImage());
break;
}
}
}
示例2: relocate
/**
* Sets the handle's bounds to that of its owner figure's bounds, expanded by the handle's Insets.
*
* @param target
* the target
*/
public void relocate(IFigure target) {
Rectangle bounds = getReference().getBounds().getCopy();
switch (position) {
case PositionConstants.NORTH:
bounds.y = bounds.y + bandHandleOffset - 1;
bounds.height = bandHandleOffset;
break;
case PositionConstants.SOUTH:
bounds.y = bounds.y + bounds.height - bandHandleOffset - 1;
bounds.height = bandHandleOffset;
break;
}
// bounds.x = bounds.x + bounds.width - bandHandleOffset - 1;
// bounds.width = bandHandleOffset;
getReference().translateToAbsolute(bounds);
target.translateToRelative(bounds);
target.setBounds(bounds);
}
示例3: 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;
}
示例4: 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;
}
示例5: getPosition
/**
* <P>
* Returns an integer which represents the position of the given point with
* respect to this rectangle. Possible return values are bitwise ORs of the
* constants WEST, EAST, NORTH, and SOUTH as found in
* {@link org.eclipse.draw2d.PositionConstants}.
*
* <P>
* Returns PositionConstant.NONE if the given point is inside this
* Rectangle.
*
* @param p
* The Point whose position has to be determined
* @return An <code>int</code> which is a PositionConstant
* @see org.eclipse.draw2d.PositionConstants
* @since 2.0
*/
public int getPosition(Point p) {
int result = PositionConstants.NONE;
if (contains(p))
return result;
if (p.x() < x)
result = PositionConstants.WEST;
else if (p.x() >= (x + width))
result = PositionConstants.EAST;
if (p.y() < y)
result = result | PositionConstants.NORTH;
else if (p.y() >= (y + height))
result = result | PositionConstants.SOUTH;
return result;
}
示例6: grow
/**
* Grows this vertex by its offset to its maximum size.
*/
void grow() {
int modifier;
if (nearestObstacle == 0)
modifier = totalCount * getSpacing();
else
modifier = (nearestObstacle / 2) - 1;
if ((positionOnObstacle & PositionConstants.NORTH) > 0)
y -= modifier;
else
y += modifier;
if ((positionOnObstacle & PositionConstants.EAST) > 0)
x += modifier;
else
x -= modifier;
}
示例7: calculateCorrectPoint
/**
* This method calculates and returns the correct refrence point of a {@link Rectangle} in regards
* to a given Point.
* */
protected Point calculateCorrectPoint(Rectangle rec, Point locationOfOther) {
// TODO: doesn't work properly for the shape connection anchors of a relation
switch (rec.getPosition(locationOfOther)) {
case PositionConstants.NORTH:
return rec.getTop();
case PositionConstants.NORTH_EAST:
return rec.getTop();
case PositionConstants.NORTH_WEST:
return rec.getTop();
case PositionConstants.EAST:
return rec.getRight();
case PositionConstants.WEST:
return rec.getLeft();
case PositionConstants.SOUTH:
return rec.getBottom();
case PositionConstants.SOUTH_EAST:
return rec.getBottom();
case PositionConstants.SOUTH_WEST:
return rec.getBottom();
default:
return rec.getCenter();
}
}
示例8: getPosition
/**
* Get the position from string
* @param position
* The given string
* @return
* The position
*/
public static int getPosition( String position )
{
if ( DesignChoiceConstants.BACKGROUND_POSITION_LEFT.equals( position ) )
{
return PositionConstants.WEST;
}
if ( DesignChoiceConstants.BACKGROUND_POSITION_RIGHT.equals( position ) )
{
return PositionConstants.EAST;
}
if ( DesignChoiceConstants.BACKGROUND_POSITION_TOP.equals( position ) )
{
return PositionConstants.NORTH;
}
if ( DesignChoiceConstants.BACKGROUND_POSITION_BOTTOM.equals( position ) )
{
return PositionConstants.SOUTH;
}
return PositionConstants.CENTER;
}
示例9: setRulerContainer
private void setRulerContainer( GraphicalViewer container, int orientation )
{
if ( orientation == PositionConstants.NORTH )
{
if ( top == container )
return;
disposeRulerViewer( top );
top = container;
}
else if ( orientation == PositionConstants.WEST )
{
if ( left == container )
return;
disposeRulerViewer( left );
left = container;
}
}
示例10: 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);
}
示例11: 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;
}
}
示例12: getRulerContainer
private GraphicalViewer getRulerContainer(int orientation) {
GraphicalViewer result = null;
switch (orientation) {
case PositionConstants.NORTH:
result = top;
break;
case PositionConstants.WEST:
result = left;
}
return result;
}
示例13: setRulerContainer
private void setRulerContainer(GraphicalViewer container, int orientation) {
if (orientation == PositionConstants.NORTH) {
if (top == container)
return;
disposeRulerViewer(top);
top = container;
} else if (orientation == PositionConstants.WEST) {
if (left == container)
return;
disposeRulerViewer(left);
left = container;
}
}
示例14: getPosition
/**
* Calculates the relative position of the specified Point to this Point.
*
* @param p
* The reference Point
* @return NORTH, SOUTH, EAST, or WEST, as defined in
* {@link PositionConstants}
*/
public int getPosition(Point p) {
int dx = p.x() - x;
int dy = p.y() - y;
if (Math.abs(dx) > Math.abs(dy)) {
if (dx < 0)
return PositionConstants.WEST;
return PositionConstants.EAST;
}
if (dy < 0)
return PositionConstants.NORTH;
return PositionConstants.SOUTH;
}
示例15: createChangeConstraintCommand
/**
* @param request
* @param child
* @param constraintFor
* @return
*/
protected Command createChangeConstraintCommand(
ChangeBoundsRequest request, GraphicalEditPart child,
Object constraintFor )
{
ReportItemHandle handle = (ReportItemHandle) child.getModel( );
SetConstraintCommand command = new SetConstraintCommand( );
command.setModel( handle );
int direction = request.getResizeDirection( );
Dimension size = new Dimension( ( (Rectangle) constraintFor ).getSize( ) );
if ( direction == PositionConstants.EAST
|| direction == PositionConstants.WEST )
{
size.height = -1;
}
else if ( direction == PositionConstants.SOUTH
|| direction == PositionConstants.NORTH )
{
size.width = -1;
}
command.setSize( size );
return command;
}