本文整理汇总了Java中org.eclipse.draw2d.PositionConstants.WEST属性的典型用法代码示例。如果您正苦于以下问题:Java PositionConstants.WEST属性的具体用法?Java PositionConstants.WEST怎么用?Java PositionConstants.WEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.draw2d.PositionConstants
的用法示例。
在下文中一共展示了PositionConstants.WEST属性的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: 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;
}
示例3: 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;
}
示例4: getArrowDirection
private int getArrowDirection() {
int direction = PositionConstants.EAST;
if (isInState(STATE_EXPANDED | STATE_PINNED_OPEN))
direction = dock == PositionConstants.WEST ? PositionConstants.WEST
: PositionConstants.EAST;
else
direction = dock == PositionConstants.WEST ? PositionConstants.EAST
: PositionConstants.WEST;
if (isMirrored()) {
if (direction == PositionConstants.WEST)
direction = PositionConstants.EAST;
else
direction = PositionConstants.WEST;
}
return direction;
}
示例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: 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();
}
}
示例7: 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;
}
}
示例8: 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);
}
示例9: getRulerContainer
private GraphicalViewer getRulerContainer(int orientation) {
GraphicalViewer result = null;
switch (orientation) {
case PositionConstants.NORTH:
result = top;
break;
case PositionConstants.WEST:
result = left;
}
return result;
}
示例10: 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;
}
}
示例11: showLayoutTargetFeedback
@Override
protected void showLayoutTargetFeedback(Request req) {
if (!(req instanceof ChangeBoundsRequest)) {
return;
}
ChangeBoundsRequest r = (ChangeBoundsRequest) req;
switch (r.getResizeDirection()) {
case PositionConstants.EAST:
case PositionConstants.WEST:
break;
default:
move(r);
break;
}
}
示例12: run
public void run() {
final Tracker tracker = new Tracker(FlyoutPaletteComposite.this,
SWT.RIGHT | SWT.LEFT);
Rectangle[] rects = new Rectangle[1];
rects[0] = sash.getBounds();
tracker.setCursor(SharedCursors.SIZEE);
tracker.setRectangles(rects);
if (tracker.open()) {
int deltaX = sash.getBounds().x - tracker.getRectangles()[0].x;
if (dock == PositionConstants.WEST)
deltaX = -deltaX;
setPaletteWidth(paletteContainer.getBounds().width + deltaX);
}
tracker.dispose();
}
示例13: 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;
}
示例14: getRuler
public InstallOptionsRuler getRuler(int orientation)
{
InstallOptionsRuler result = null;
switch (orientation)
{
case PositionConstants.NORTH:
result = mHorizontalRuler;
break;
case PositionConstants.WEST:
result = mVerticalRuler;
break;
}
return result;
}
示例15: getRulerContainer
private GraphicalViewer getRulerContainer( int orientation )
{
GraphicalViewer result = null;
switch ( orientation )
{
case PositionConstants.NORTH :
result = top;
break;
case PositionConstants.WEST :
result = left;
}
return result;
}