本文整理汇总了Java中org.eclipse.draw2d.PositionConstants.LEFT属性的典型用法代码示例。如果您正苦于以下问题:Java PositionConstants.LEFT属性的具体用法?Java PositionConstants.LEFT怎么用?Java PositionConstants.LEFT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.draw2d.PositionConstants
的用法示例。
在下文中一共展示了PositionConstants.LEFT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawHorizontalTitleBar
/**
* rect는 타이틀 바를 그릴 사각형이다. 여기서는 이 사각형에 타이틀 바를 그린다.
* 타이틀 바를 가로로 생성한 파티션의 왼쪽에 세로로 그린다.
*
* @param figure
* @param g
* @param rect
* void
*/
private void drawHorizontalTitleBar(IFigure figure, Graphics g, Rectangle rect) {
g.setBackgroundColor(getBackgroundColor());
g.fillRectangle(rect);
Insets padding = getPadding();
int x = rect.x + padding.left;
int y = rect.y + padding.top + (rect.height - getTextExtents(figure).height) / 2;
int textWidth = getTextExtents(figure).width;
int freeSpace = rect.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
Font f = getFont(figure);
FontData fData = f.getFontData()[0];
fData.setName(this.getFontName());
fData.setStyle(this.getTextStyle());
fData.setHeight(this.getFontSize());
g.setFont(f);
g.setForegroundColor(this.getTextColor());
g.drawString(getLabel(), x, y);
}
示例2: drawTitleBar
/**
* rect는 타이틀 바를 그릴 사각형이다. 여기서는 이 사각형에 타이틀 바를 그린다.
*
* @param figure
* @param g
* @param rect
* void
*/
private void drawTitleBar(IFigure figure, Graphics g, Rectangle rect) {
g.setBackgroundColor(getBackgroundColor());
g.fillRectangle(rect);
Insets padding = getPadding();
int x = rect.x + padding.left;
int y = rect.y + padding.top + (rect.height - getTextExtents(figure).height) / 2;
int textWidth = getTextExtents(figure).width;
int freeSpace = rect.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
Font f = getFont(figure);
FontData fData = f.getFontData()[0];
fData.setName(this.getFontName());
fData.setStyle(this.getTextStyle());
fData.setHeight(this.getFontSize());
g.setFont(f);
g.setForegroundColor(this.getTextColor());
g.drawString(getLabel(), x, y);
}
示例3: doNormalAlignment
private void doNormalAlignment(Rectangle result, Rectangle reference) {
switch (alignment) {
case PositionConstants.LEFT:
result.x = reference.x;
break;
case PositionConstants.RIGHT:
result.x = reference.x + reference.width - result.width;
break;
case PositionConstants.TOP:
result.y = reference.y;
break;
case PositionConstants.BOTTOM:
result.y = reference.y + reference.height - result.height;
break;
case PositionConstants.CENTER:
result.x = reference.x + (reference.width / 2) - (result.width / 2);
break;
case PositionConstants.MIDDLE:
result.y = reference.y + (reference.height / 2)
- (result.height / 2);
break;
}
}
示例4: doNormalAlignment
private void doNormalAlignment(Rectangle result, Rectangle reference) {
switch (alignment) {
case PositionConstants.LEFT:
result.x = reference.x;
break;
case PositionConstants.RIGHT:
result.x = reference.x + reference.width - result.width;
break;
case PositionConstants.TOP:
result.y = reference.y;
break;
case PositionConstants.BOTTOM:
result.y = reference.y + reference.height - result.height;
break;
case PositionConstants.CENTER:
result.x = reference.x + (reference.width / 2) - (result.width / 2);
break;
case PositionConstants.MIDDLE:
result.y = reference.y + (reference.height / 2) - (result.height / 2);
break;
}
}
示例5: paint
public void paint(IFigure figure, Graphics g, Insets insets)
{
tempRect.setBounds(getPaintRectangle(figure, insets));
Rectangle rec = tempRect;
rec.height = 3;
g.clipRect(rec);
g.setBackgroundColor(orange);
g.fillRectangle(rec);
int x = rec.x + padding.left;
int y = rec.y + padding.top;
int textWidth = getTextExtents(figure).width;
int freeSpace = rec.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
g.setFont(getFont(figure));
g.setForegroundColor(getTextColor());
}
示例6: paint
public void paint(IFigure figure, Graphics g, Insets insets)
{
tempRect.setBounds(getPaintRectangle(figure, insets));
Rectangle rec = tempRect;
// rec.height = Math.min(rec.height, getTextExtents(figure).height + padding.getHeight());
rec.height = 3;
g.clipRect(rec);
g.setBackgroundColor(orange);
g.fillRectangle(rec);
int x = rec.x + padding.left;
int y = rec.y + padding.top;
int textWidth = getTextExtents(figure).width;
int freeSpace = rec.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
g.setFont(getFont(figure));
g.setForegroundColor(getTextColor());
// g.drawString(getLabel(), x, y);
}
示例7: paint
public void paint(IFigure figure, Graphics g, Insets insets)
{
tempRect.setBounds(getPaintRectangle(figure, insets));
Rectangle rec = tempRect;
rec.height = Math.min(rec.height, getTextExtents(figure).height + padding.getHeight());
g.clipRect(rec);
g.setBackgroundColor(orange);
g.fillRectangle(rec);
int x = rec.x + padding.left;
int y = rec.y + padding.top;
int textWidth = getTextExtents(figure).width;
int freeSpace = rec.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
g.setFont(getFont(figure));
g.setForegroundColor(ColorConstants.black);
g.drawString(getLabel(), x, y);
}
示例8: execute
@Override
public void execute() {
setPositionCommands = new ArrayList<SetValueCommand>();
JRDesignElement designElement = primary.getValue();
for(MGraphicElement element : selection){
if (element != primary){
JRDesignElement selected = element.getValue();
switch (alignement) {
case PositionConstants.LEFT:
createCommand(JRDesignElement.PROPERTY_X, element, designElement.getX());
break;
case PositionConstants.RIGHT:
int rightPost = designElement.getX() + designElement.getWidth() - selected.getWidth();
createCommand(JRDesignElement.PROPERTY_X, element, rightPost);
break;
case PositionConstants.TOP:
createCommand(JRDesignElement.PROPERTY_Y, element, designElement.getY());
break;
case PositionConstants.BOTTOM:
int bottomPos = designElement.getY() + designElement.getHeight() - selected.getHeight();
createCommand(JRDesignElement.PROPERTY_Y, element, bottomPos);
break;
case PositionConstants.CENTER:
int centerVert = designElement.getX() + Math.abs(designElement.getWidth() - selected.getWidth())/2;
createCommand(JRDesignElement.PROPERTY_X, element, centerVert);
break;
case PositionConstants.MIDDLE:
int middle = designElement.getY() + Math.abs(designElement.getHeight() - selected.getHeight())/2;
createCommand(JRDesignElement.PROPERTY_Y, element, middle);
break;
default:
break;
}
}
}
//Execute the subcommands
for(Command cmd : setPositionCommands){
cmd.execute();
}
}
示例9: execute
@Override
public void execute() {
oldX = jrElement.getX();
oldY = jrElement.getY();
int newX = oldX;
int newY = oldY;
switch (alignement) {
case PositionConstants.LEFT:
newX = 0;
break;
case PositionConstants.RIGHT:
newX = parent.width - jrElement.getWidth();
break;
case PositionConstants.TOP:
newY = 0;
break;
case PositionConstants.BOTTOM:
newY = parent.height - jrElement.getHeight();
break;
case PositionConstants.CENTER:
newX = parent.width / 2 - jrElement.getWidth() / 2;
break;
case PositionConstants.MIDDLE:
newY = parent.height / 2 - jrElement.getHeight() / 2;
break;
}
jrElement.setX(newX);
jrElement.setY(newY);
}
示例10: doPrecisionAlignment
private void doPrecisionAlignment(PrecisionRectangle result,
PrecisionRectangle reference) {
switch (alignment) {
case PositionConstants.LEFT:
result.setPreciseX(reference.preciseX());
break;
case PositionConstants.RIGHT:
result.setPreciseX(reference.preciseX() + reference.preciseWidth()
- result.preciseWidth());
break;
case PositionConstants.TOP:
result.setPreciseY(reference.preciseY());
break;
case PositionConstants.BOTTOM:
result.setPreciseY(reference.preciseY() + reference.preciseHeight()
- result.preciseHeight());
break;
case PositionConstants.CENTER:
result.setPreciseX(reference.preciseX()
+ (reference.preciseWidth() / 2)
- (result.preciseWidth() / 2));
break;
case PositionConstants.MIDDLE:
result.setPreciseY(reference.preciseY()
+ (reference.preciseHeight() / 2)
- (result.preciseHeight() / 2));
break;
}
}
示例11: getHorizontalAligment
/**
* Returns the effective horizontal alignment. This method will never return
* {@link PositionConstants#NONE}. If the value is none, it will return the
* inherited alignment. If no alignment was inherited, it will return the
* default alignment ({@link PositionConstants#LEFT}).
*
* @return the effective alignment
*/
public int getHorizontalAligment() {
if (alignment != PositionConstants.NONE)
return alignment;
IFigure parent = getParent();
while (parent != null && !(parent instanceof BlockFlow))
parent = parent.getParent();
if (parent != null)
return ((BlockFlow) parent).getHorizontalAligment();
return PositionConstants.LEFT;
}
示例12: doPrecisionAlignment
private void doPrecisionAlignment(
PrecisionRectangle result,
PrecisionRectangle reference) {
switch (alignment) {
case PositionConstants.LEFT:
result.setX(reference.preciseX);
break;
case PositionConstants.RIGHT:
result.setX(
reference.preciseX + reference.preciseWidth - result.preciseWidth);
break;
case PositionConstants.TOP:
result.setY(reference.preciseY);
break;
case PositionConstants.BOTTOM:
result.setY(
reference.preciseY + reference.preciseHeight - result.preciseHeight);
break;
case PositionConstants.CENTER:
result.setX(
reference.preciseX
+ (reference.preciseWidth / 2)
- (result.preciseWidth / 2));
break;
case PositionConstants.MIDDLE:
result.setY(
reference.preciseY
+ (reference.preciseHeight / 2)
- (result.preciseHeight / 2));
break;
}
}
示例13: paint
public void paint(IFigure figure, Graphics g, Insets insets) {
tempRect.setBounds(getPaintRectangle(figure, insets));
Rectangle rec = tempRect;
rec.height = Math.min(rec.height, getTextExtents(figure).height
+ padding.getHeight());
g.clipRect(rec);
g.setForegroundColor(ColorConstants.titleInactiveGradient);
g.setBackgroundColor(ColorConstants.white);
g.fillGradient(rec, true);
int x = rec.x + padding.left;
int y = rec.y + padding.top;
Image image=Activator.getImageDescriptor("icons/model_new.gif").createImage();
g.drawImage(image, new Point(x,y));
x=x+image.getBounds().width+5;
image.dispose();
int textWidth = getTextExtents(figure).width;
int freeSpace = rec.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
g.setFont(getFont(figure));
g.setForegroundColor(ColorConstants.darkBlue);
g.drawString(getLabel(), x, y);
g.setForegroundColor(ColorConstants.darkBlue);
g.drawLine(rec.x, rec.y+rec.height-1, rec.width+rec.x+2, rec.y+rec.height-1);
}
示例14: paint
public void paint(IFigure figure, Graphics g, Insets insets) {
tempRect.setBounds(getPaintRectangle(figure, insets));
Rectangle rec = tempRect;
rec.height = Math.min(rec.height, getTextExtents(figure).height
+ padding.getHeight());
g.clipRect(rec);
g.setForegroundColor(ColorConstants.titleInactiveGradient);
g.setBackgroundColor(ColorConstants.white);
g.fillGradient(rec, true);
int x = rec.x + padding.left;
int y = rec.y + padding.top;
Image image=Activator.getImageDescriptor(ImageResource.VO).createImage();
g.drawImage(image, new Point(x,y));
x=x+Activator.getImageDescriptor(ImageResource.TABLE).createImage().getBounds().width+5;
int textWidth = getTextExtents(figure).width;
int freeSpace = rec.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
g.setFont(getFont(figure));
g.setForegroundColor(ColorConstants.darkBlue);
g.drawString(getLabel(), x, y);
g.setForegroundColor(ColorConstants.darkBlue);
g.drawLine(rec.x, rec.y+rec.height-1, rec.width+rec.x+2, rec.y+rec.height-1);
}
示例15: paint
public void paint(IFigure figure, Graphics g, Insets insets) {
tempRect.setBounds(getPaintRectangle(figure, insets));
Rectangle rec = tempRect;
rec.height = Math.min(rec.height, getTextExtents(figure).height
+ padding.getHeight());
g.clipRect(rec);
g.setForegroundColor(ColorConstants.titleBackground);
g.setBackgroundColor(ColorConstants.white);
g.fillGradient(rec, true);
int x = rec.x + padding.left;
int y = rec.y + padding.top;
Image image=Activator.getImageDescriptor(ImageResource.BO).createImage();
g.drawImage(image, new Point(x,y));
x=x+image.getBounds().width+5;
int textWidth = getTextExtents(figure).width;
int freeSpace = rec.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
g.setFont(getFont(figure));
g.setForegroundColor(ColorConstants.darkBlue);
g.drawString(getLabel(), x, y);
g.setForegroundColor(ColorConstants.darkBlue);
g.drawLine(rec.x, rec.y+rec.height-1, rec.width+rec.x+2, rec.y+rec.height-1);
}