本文整理汇总了Java中org.eclipse.draw2d.PositionConstants类的典型用法代码示例。如果您正苦于以下问题:Java PositionConstants类的具体用法?Java PositionConstants怎么用?Java PositionConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PositionConstants类属于org.eclipse.draw2d包,在下文中一共展示了PositionConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContents
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
protected void createContents() {
// Name Label
nameFigure = new SyntaxColoringLabel();
nameFigure.setAlignment(PositionConstants.CENTER);
this.add(nameFigure, GridDataFactory.fillDefaults().grab(true, false)
.getData());
// Text compartment
textCompartmentPane = new Figure();
textCompartmentPane.setLayoutManager(new StackLayout());
this.add(textCompartmentPane,
GridDataFactory.fillDefaults().grab(true, true).getData());
figureCompartmentPane = new Figure();
figureCompartmentPane.setLayoutManager(new StackLayout());
this.add(figureCompartmentPane,
GridDataFactory.fillDefaults().grab(true, true).getData());
}
示例2: createRoundArrow
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
private void createRoundArrow ( final Figure figure )
{
final PolylineConnection c = new PolylineConnection ();
c.setSourceAnchor ( new ChopboxAnchor ( this.sourceRect ) );
c.setTargetAnchor ( new ChopboxAnchor ( this.targetRect ) );
final PolygonDecoration dec = new PolygonDecoration ();
dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
c.setTargetDecoration ( dec );
final MidpointLocator typeLocator = new MidpointLocator ( c, 0 );
typeLocator.setRelativePosition ( PositionConstants.NORTH );
this.typeLabel = new Label ( "" ); //$NON-NLS-1$
c.add ( this.typeLabel, typeLocator );
figure.add ( c );
this.roundConnection = c;
}
示例3: ComponentLabelFigure
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* Creates a new LabelFigure with a MarginBorder that is the given size and
* a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT.
*
* @param borderSize
* the size of the MarginBorder
*/
public ComponentLabelFigure(int borderSize) {
setBorder(new MarginBorder(borderSize));
flowPage = new FlowPage();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_SOFT));
flowPage.add(textFlow);
flowPage.setHorizontalAligment(PositionConstants.CENTER);
setLayoutManager(new StackLayout());
add(flowPage);
font = new Font( Display.getDefault(), "Arial", 9,
SWT.NORMAL );
setFont(font);
setForegroundColor(ColorConstants.black);
}
示例4: updateImage
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
@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;
}
}
}
示例5: addHandles
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void addHandles(final GraphicalEditPart part, final List handles) {
handles.add(new ERDiagramMoveHandle(part));
handles.add(createHandle(part, PositionConstants.EAST));
handles.add(createHandle(part, PositionConstants.SOUTH_EAST));
handles.add(createHandle(part, PositionConstants.SOUTH));
handles.add(createHandle(part, PositionConstants.SOUTH_WEST));
handles.add(createHandle(part, PositionConstants.WEST));
handles.add(createHandle(part, PositionConstants.NORTH_WEST));
handles.add(createHandle(part, PositionConstants.NORTH));
handles.add(createHandle(part, PositionConstants.NORTH_EAST));
}
示例6: createTextFlow
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* createTextFlow
*
* @return TextFlow
*/
public TextFlow createTextFlow() {
// FlowPage flowPage = new FlowPage();
// TextFlow flow = new TextFlow();
flow.setLayoutManager(new ParagraphTextLayout(flow, ParagraphTextLayout.WORD_WRAP_SOFT));
flow.setForegroundColor(new Color(null, 0, 0, 0));
if (getName() != null)
flow.setText(getName());
else
flow.setText(""); //$NON-NLS-1$
flowPage.add(flow);
flowPage.setHorizontalAligment(PositionConstants.LEFT);
setLayoutManager(new StackLayout());
add(flowPage);
return flow;
}
示例7: drawHorizontalTitleBar
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* 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);
}
示例8: drawTitleBar
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* 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);
}
示例9: createTextFlow
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* createTextFlow
*
* @return TextFlow
*/
public TextFlow createTextFlow() {
flowPage = new FlowPage();
flow = new TextFlow();
flow.setLayoutManager(new ParagraphTextLayout(flow, ParagraphTextLayout.WORD_WRAP_SOFT));
flow.setForegroundColor(new Color(null, 0, 0, 0));
if (getName() != null)
flow.setText(getName());
else
flow.setText(""); //$NON-NLS-1$
flowPage.add(flow);
flowPage.setHorizontalAligment(PositionConstants.LEFT);
flowPage.setBorder(new MarginBorder(new Insets(15, 7, 7, 7)));
setLayoutManager(new StackLayout());
add(flowPage);
return flow;
}
示例10: buildActions
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions()
*/
protected void buildActions() {
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
addRetargetAction(new DeleteRetargetAction());
addRetargetAction(new ZoomInRetargetAction());
addRetargetAction(new ZoomOutRetargetAction());
addRetargetAction(new AlignmentRetargetAction(PositionConstants.LEFT));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.CENTER));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.RIGHT));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.TOP));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.MIDDLE));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.BOTTOM));
addRetargetAction(new MatchWidthRetargetAction());
addRetargetAction(new MatchHeightRetargetAction());
}
示例11: ColumnFigure
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* Constructs a CheckBox with the passed text in its label.
*
* @param text
* The label text
* @since 2.0
*/
public ColumnFigure(String text, Image image) {
setLayoutManager(new FlowLayout(true));
checkbox = new CheckBox();
checkbox.addChangeListener(new ChangeListener() {
@Override
public void handleStateChanged(ChangeEvent event) {
if (event.getPropertyName().equals(ButtonModel.SELECTED_PROPERTY))
handleSelectionChanged();
}
});
add(checkbox);
Label lbl = new Label(ConvertUtil.cleanDbNameFull(text), image);
lbl.setTextPlacement(PositionConstants.WEST);
add(lbl);
}
示例12: relocate
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* 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);
}
示例13: CellResizeHandleLocator2
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* 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;
}
示例14: CellResizeHandleLocator
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* 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;
}
示例15: snapPoint
import org.eclipse.draw2d.PositionConstants; //导入依赖的package包/类
/**
* This method can be overridden by clients to customize the snapping behavior.
*
* @param request
* the <code>ChangeBoundsRequest</code> from which the move delta can be extracted and updated
* @since 3.4
*/
protected void snapPoint(ChangeBoundsRequest request) {
Point moveDelta = request.getMoveDelta();
if (editpart != null && getOperationSet().size() > 0)
snapToHelper = (SnapToHelper) editpart.getParent().getAdapter(SnapToHelper.class);
if (snapToHelper != null && !getCurrentInput().isModKeyDown(MODIFIER_NO_SNAPPING)) {
PrecisionRectangle baseRect = sourceRectangle.getPreciseCopy();
PrecisionRectangle jointRect = compoundSrcRect.getPreciseCopy();
baseRect.translate(moveDelta);
jointRect.translate(moveDelta);
PrecisionPoint preciseDelta = new PrecisionPoint(moveDelta);
snapToHelper.snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL,
new PrecisionRectangle[] { baseRect, jointRect }, preciseDelta);
request.setMoveDelta(preciseDelta);
}
}