Java 类org.eclipse.draw2d.PositionConstants 实例源码

项目:neoscada    文件:RoundDetailsPart.java   
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;
}
项目:Hydrograph    文件:ComponentLabelFigure.java   
/**
 * 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);

}
项目:time4sys    文件:RotativeImageEditPart.java   
@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;
    }
  }
}
项目:ermasterr    文件:NodeElementSelectionEditPolicy.java   
@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));
}
项目:NEXCORE-UML-Modeler    文件:TextFigure.java   
/**
 * 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;
}
项目:NEXCORE-UML-Modeler    文件:TitleBarBorder.java   
/**
 * 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);
}
项目:NEXCORE-UML-Modeler    文件:TitleBarBorder.java   
/**
 * 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);
}
项目:NEXCORE-UML-Modeler    文件:NoteFigure.java   
/**
 * 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;
}
项目:NEXCORE-UML-Modeler    文件:AbstractDiagramActionContributor.java   
/**
 * @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());
}
项目:statecharts    文件:StateFigure.java   
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());
}
项目:PDFReporter-Studio    文件:ColumnFigure.java   
/**
 * 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);
}
项目:PDFReporter-Studio    文件:CellHandleLocator.java   
/**
 * 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);
}
项目:PDFReporter-Studio    文件:CellResizeHandleLocator2.java   
/**
 * 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;
}
项目:PDFReporter-Studio    文件:CellResizeHandleLocator.java   
/**
 * 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;
}
项目:PDFReporter-Studio    文件:BandResizeTracker.java   
/**
 * 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);
    }
}
项目:PDFReporter-Studio    文件:ElementResizableEditPolicy.java   
/**
 * This method override the ResizableEditPolicy createSelectionHandle(). It's identical to 3.7 and later methods, but
 * different from previous versions. In this way the behavior of this handle under eclipse 3.6 and eclipse 3.7+ is
 * uniformed
 */
@Override
protected List createSelectionHandles() {
    if (getResizeDirections() == PositionConstants.NONE) {
        // non resizable, so delegate to super implementation
        return super.createSelectionHandles();
    }

    // resizable in at least one direction
    List list = new ArrayList();
    createMoveHandle(list);
    createResizeHandle(list, PositionConstants.NORTH);
    createResizeHandle(list, PositionConstants.EAST);
    createResizeHandle(list, PositionConstants.SOUTH);
    createResizeHandle(list, PositionConstants.WEST);
    createResizeHandle(list, PositionConstants.SOUTH_EAST);
    createResizeHandle(list, PositionConstants.SOUTH_WEST);
    createResizeHandle(list, PositionConstants.NORTH_WEST);
    createResizeHandle(list, PositionConstants.NORTH_EAST);
    return list;
}
项目:limpet    文件:SharedAxisEditPart.java   
@Override
protected IFigure createFigure()
{
  RectangleFigure rectangle = new RectangleFigure();
  rectangle.setOutline(false);
  GridLayout gridLayout = new GridLayout();
  gridLayout.marginHeight = 0;
  gridLayout.marginWidth = 0;
  rectangle.setLayoutManager(gridLayout);

  arrowFigure = new ArrowFigure(true);
  rectangle.add(arrowFigure);

  // and the text label
  axisNameLabel = new DirectionalIconLabel(StackedchartsImages.getImage(
      StackedchartsImages.DESC_AXIS));
  axisNameLabel.getLabel().setTextAlignment(PositionConstants.TOP);
  rectangle.add(axisNameLabel);

  return rectangle;
}
项目:limpet    文件:ChartsetFigure.java   
public ChartsetFigure(ActionListener addChartHandler)
{
  add(new Label(StackedchartsImages.getImage(
      StackedchartsImages.DESC_CHARTSET)));
  chartsetHeader = new DirectionalLabel(Activator.FONT_12);
  chartsetHeader.setText("Chart Set");
  chartsetHeader.setTextAlignment(PositionConstants.TOP);
  add(chartsetHeader);

  Button button = new Button(StackedchartsImages.getImage(
      StackedchartsImages.DESC_ADD));
  button.setToolTip(new Label("Add new chart"));
  button.addActionListener(addChartHandler);
  add(button);

}
项目:erflute    文件:ModelPropertiesFigure.java   
private void addRow(String name, String value, String tableStyle) {
    final Border border = new MarginBorder(5);
    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);
    final Label nameLabel = new Label();
    final Label valueLabel = new Label();
    nameLabel.setBorder(border);
    nameLabel.setText(name);
    nameLabel.setLabelAlignment(PositionConstants.LEFT);
    nameLabel.setForegroundColor(foregroundColor);
    add(nameLabel);
    if (!DisplayMessages.getMessage("action.title.change.design.simple").equals(tableStyle)
            && !DisplayMessages.getMessage("action.title.change.design.frame").equals(tableStyle)) {
        valueLabel.setBackgroundColor(ColorConstants.white);
        valueLabel.setOpaque(true);
        valueLabel.setForegroundColor(ColorConstants.black);
    } else {
        valueLabel.setOpaque(false);
        valueLabel.setForegroundColor(foregroundColor);
    }
    valueLabel.setBorder(border);
    valueLabel.setText(value);
    valueLabel.setLabelAlignment(PositionConstants.LEFT);
    add(valueLabel);
}
项目:erflute    文件:FunnyStyleSupport.java   
@Override
public void addColumnGroup(GroupColumnFigure columnFigure, int viewMode,
        String name, boolean isAdded, boolean isUpdated, boolean isRemoved) {
    columnFigure.setBorder(new MarginBorder(new Insets(1, 0, 1, 0)));

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 4, 0, 7)));
    image.setImage(Activator.getImage(ImageKey.GROUP));
    columnFigure.add(image);

    final StringBuilder text = new StringBuilder();
    text.append(name);
    text.append(" (GROUP)");

    setColumnFigureColor(columnFigure, false, false, isAdded, isUpdated, isRemoved);

    final Label label = createColumnLabel();

    label.setForegroundColor(ColorConstants.black);
    label.setLabelAlignment(PositionConstants.RIGHT);
    label.setBorder(new MarginBorder(new Insets(1, 3, 0, 4)));

    label.setText(text.toString());

    columnFigure.add(label);
}
项目:OpenSPIFe    文件:TreeTimelineHeaderRowEditPart.java   
protected void updateExpansionVisual(boolean expansion) {
    TreeTimelineContentProvider contentProvider = getTimelineTreeContentProvider();
    if (contentProvider == null) {
        Logger.getLogger(TreeTimelineHeaderRowEditPart.class).error("No content provider is null for: " + this);
    } else {
        boolean visible = contentProvider.hasChildren(getModel());
        expansionButton.setVisible(visible);
    }

    final int rowHeight = TimelineUtils.getRowElementHeight(TreeTimelineHeaderRowEditPart.this);
    if (expansion) {
        expansionButton.setDirection(PositionConstants.SOUTH);
        expansionButton.setPreferredSize(rowHeight / 2, rowHeight / 2);
    } else {
        expansionButton.setDirection(PositionConstants.EAST);
        expansionButton.setPreferredSize(rowHeight / 3, rowHeight / 2);
    }
    expansionButton.setVisible(expansionButton.isVisible() && isGrouped());
}
项目:wt-studio    文件:HorizontalBlockFrameBorder.java   
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);
}
项目:gef-gwt    文件:ResizableHandleKit.java   
/**
 * Fills the given List with handles at each corner and side of a figure.
 * 
 * @param part
 *            the handles' GraphicalEditPart
 * @param handles
 *            the List to add the four corner handles to
 * @param tracker
 *            the handles' DragTracker
 * @param cursor
 *            the handles' Cursor
 * @since 3.7
 */
public static void addCornerAndSideHandles(GraphicalEditPart part,
        List handles, DragTracker tracker, Cursor cursor) {
    handles.add(createHandle(part, PositionConstants.EAST, tracker, cursor));
    handles.add(createHandle(part, PositionConstants.SOUTH_EAST, tracker,
            cursor));
    handles.add(createHandle(part, PositionConstants.SOUTH, tracker, cursor));
    handles.add(createHandle(part, PositionConstants.SOUTH_WEST, tracker,
            cursor));
    handles.add(createHandle(part, PositionConstants.WEST, tracker, cursor));
    handles.add(createHandle(part, PositionConstants.NORTH_WEST, tracker,
            cursor));
    handles.add(createHandle(part, PositionConstants.NORTH, tracker, cursor));
    handles.add(createHandle(part, PositionConstants.NORTH_EAST, tracker,
            cursor));
}
项目:gef-gwt    文件:ResizableEditPolicy.java   
/**
 * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#createSelectionHandles()
 */
protected List createSelectionHandles() {
    if (resizeDirections == PositionConstants.NONE) {
        // non resizable, so delegate to super implementation
        return super.createSelectionHandles();
    }

    // resizable in at least one direction
    List list = new ArrayList();
    createMoveHandle(list);
    createResizeHandle(list, PositionConstants.NORTH);
    createResizeHandle(list, PositionConstants.EAST);
    createResizeHandle(list, PositionConstants.SOUTH);
    createResizeHandle(list, PositionConstants.WEST);
    createResizeHandle(list, PositionConstants.SOUTH_EAST);
    createResizeHandle(list, PositionConstants.SOUTH_WEST);
    createResizeHandle(list, PositionConstants.NORTH_WEST);
    createResizeHandle(list, PositionConstants.NORTH_EAST);
    return list;
}
项目:gef-gwt    文件:FlyoutPaletteComposite.java   
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;
}
项目:gef-gwt    文件:DragEditPartsTracker.java   
/**
 * 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 (snapToHelper != null && request.isSnapToEnabled()) {
        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);
    }
}
项目:gef-gwt    文件:AlignmentRequest.java   
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;
    }
}
项目:gef-gwt    文件:Rectangle.java   
/**
 * <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;
}
项目:gef-gwt    文件:Vertex.java   
/**
 * 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;
}
项目:birt    文件:ReportResizeTracker.java   
private String getShowLabel(int pix)
{
    String unit = getDefaultUnits( );

    double doubleValue = MetricUtility.pixelToPixelInch( pix );
    double showValue = DimensionUtil.convertTo( doubleValue,DesignChoiceConstants.UNITS_IN, unit ).getMeasure( );
    String prefix = "";
    if (PositionConstants.EAST == getResizeDirection())
    {
        prefix = Messages.getString("ColumnDragTracker.Show.Label");;
    }
    else if (PositionConstants.SOUTH == getResizeDirection())
    {
        prefix = Messages.getString("RowDragTracker.Show.Label");
    }
    return prefix + " "  + TableDragGuideTracker.FORMAT.format( showValue )+ " " + TableDragGuideTracker.getUnitDisplayName( unit)  + " (" + pix +" " + TableDragGuideTracker.PIXELS_LABEL + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
项目:gef-gwt    文件:Obstacle.java   
/**
 * Initializes this obstacle to the values of the given rectangle
 * 
 * @param rect
 *            bounds of this obstacle
 */
void init(Rectangle rect) {
    this.x = rect.x;
    this.y = rect.y;
    this.width = rect.width;
    this.height = rect.height;

    exclude = false;

    topLeft = new Vertex(x, y, this);
    topLeft.positionOnObstacle = PositionConstants.NORTH_WEST;
    topRight = new Vertex(x + width - 1, y, this);
    topRight.positionOnObstacle = PositionConstants.NORTH_EAST;
    bottomLeft = new Vertex(x, y + height - 1, this);
    bottomLeft.positionOnObstacle = PositionConstants.SOUTH_WEST;
    bottomRight = new Vertex(x + width - 1, y + height - 1, this);
    bottomRight.positionOnObstacle = PositionConstants.SOUTH_EAST;
    center = new Vertex(getCenter(), this);
}
项目:eclipsensis    文件:DistributionRequest.java   
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;
    }
}
项目:FRaMED    文件:ORMConnectionFigureFactory.java   
/**
 * This method creates and returns the figure for {@link Relation}s from type cyclic, total, acyclic, reflexive and
 * irreflexive, which differs from relationshipConstraint to relationshipConstraint only in the
 * text of the {@link Label}. A cyclic, total, acyclic, reflexive or irreflexive figure is dashed line with a
 * {@link Label}.
 * 
 * @return conn org.eclipse.draw2d.PolylineConnection
 * */
private static Figure createRelationshipConstraintFigure(Relation relation, EditPart editpart) {
  ORMRelationshipConstraintEditPart editP = (ORMRelationshipConstraintEditPart) editpart;

  editP.getLabel().setText(relation.getName());
  editP.setTextInitial(relation.getName());

  PolylineConnection conn = new PolylineConnection();
  conn.setAntialias(SWT.ON);
  conn.setLineDash(new float[] {5.0f, 5.0f});
  conn.setLineStyle(SWT.LINE_CUSTOM);
  conn.setConnectionRouter(new BendpointConnectionRouter());

  // add label to the connection
  ConnectionLocator loc = new ConnectionLocator(conn, ConnectionLocator.MIDDLE);
  loc.setRelativePosition(PositionConstants.SOUTH);
  loc.setGap(5);
  // this is needed, because when the label would be just added the label text could be seen in
  // the rootModel
  if (editP.getRoot().getContents() instanceof ORMCompartmentEditPart) {
    conn.add(editP.getLabel(), loc);
  }
  return conn;
}
项目:FRaMED    文件:ORMRelationCreateCommand.java   
/**
 * 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();
  }
}
项目:jive    文件:LifelineFigure.java   
public LifelineFigure(final IContourAttributes attributes)
{
  isGutter = (attributes == null);
  if (isGutter)
  {
    head = new Label("");
    head.setOpaque(false);
    head.setBorder(new MarginBorder(5));
  }
  else
  {
    head = new Label(attributes.getText(), attributes.getIcon());
    final Label tooltip = new Label(attributes.getToolTipText(), attributes.getToolTipIcon());
    head.setToolTip(tooltip);
    head.setToolTip(tooltip);
    head.setOpaque(true);
    head.setBorder(LifelineFigure.HEAD_BORDER);
    head.setIconAlignment(PositionConstants.BOTTOM);
    head.setLabelAlignment(PositionConstants.LEFT);
    head.setBackgroundColor(attributes.getLabelBackgroundColor());
  }
  setOpaque(false);
  setLayoutManager(new XYLayout());
  add(head, new Rectangle(0, 0, -1, -1));
}
项目:birt    文件:DesignElementHandleAdapter.java   
/**
 *  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;
}
项目:birt    文件:PlaceHolderEditPart.java   
public void refreshFigure( )
{
    StyleHandle style = ( (DesignElementHandle) getDefaultHandle( ) )
            .getPrivateStyle( );

    //TODO:fixed the bug 191874
    //( (LabelFigure) getFigure( ) ).setFont( getFont( ) ); 
    ( (LabelFigure) getFigure( ) ).setImage( getImage( ) );
    ( (LabelFigure) getFigure( ) ).setAlignment( PositionConstants.WEST );
    ( (LabelFigure) getFigure( ) ).setDirection( getTextDirection( getDefaultHandle( )) ); // bidi_hcg
    ( (LabelFigure) getFigure( ) ).setText( getTemplateModel( )
            .getDisplayDescription( ) );
    ( (LabelFigure) getFigure( ) )
            .setTextAlign( DesignChoiceConstants.TEXT_ALIGN_CENTER );
    ( (LabelFigure) getFigure( ) )
            .setForegroundColor( ReportColorConstants.ShadowLineColor );
    ( (LabelFigure) getFigure( ) ).setDisplay( style.getDisplay( ) );

    getFigure( ).setBorder( new LineBorder( 1 ) );
}
项目:birt    文件:DestroyEditPart.java   
public void refreshFigure( )
{
    StyleHandle style = ( (DesignElementHandle) getModel( ) ).getPrivateStyle( );
    ( (LabelFigure) getFigure( ) ).setFont( FontManager.getFont("Dialog", 10, SWT.ITALIC) ); //$NON-NLS-1$

    //( (LabelFigure) getFigure( ) ).setImage( getImage( ) );
    ( (LabelFigure) getFigure( ) ).setAlignment( PositionConstants.WEST );

    // bidi_hcg start
    // Set direction before setting text
    ( (LabelFigure) getFigure( ) ).setDirection( getTextDirection( ) );
    // bidi_hcg end
    ( (LabelFigure) getFigure( ) ).setText( MESSAGE );
    ( (LabelFigure) getFigure( ) ).setTextAlign( DesignChoiceConstants.TEXT_ALIGN_LEFT );
    ( (LabelFigure) getFigure( ) ).setForegroundColor( ReportColorConstants.RedWarning );
    ( (LabelFigure) getFigure( ) ).setDisplay( style.getDisplay( ) );

    getFigure( ).setBorder( new LineBorder( 1 ) );
}
项目:birt    文件:ReportResizeTracker.java   
@Override
protected boolean handleDragInProgress( )
{
    boolean bool =  super.handleDragInProgress( );
    if (processor != null)
    {
        int width = 0;
        if (PositionConstants.EAST == getResizeDirection())
        {
            width = getFigureSize().width + getMouseTrueValueX( );
        }
        else if (PositionConstants.SOUTH == getResizeDirection())
        {
            width = getFigureSize().height + getMouseTrueValueY( );
        }
        if (width < 1)
        {
            width = 1;
        }
        processor.updateInfomation( getInfomation( width ), getStartLocation( ) );
    }
    return bool;
}
项目:birt    文件:ReportResizeTracker.java   
protected void showSourceFeedback( )
{
    super.showSourceFeedback( );
    if (processor != null)
    {
        int pix = 0;
        if (PositionConstants.EAST == getResizeDirection())
        {
            pix = getFigureSize().width;
        }
        else if (PositionConstants.SOUTH == getResizeDirection())
        {
            pix = getFigureSize().height;
        }
        processor.getInfomationLabel(getInfomation( pix ), getStartLocation( ) ).setText( getInfomation( pix ) );
    }   
}