use of org.eclipse.draw2d.Locator in project archi by archimatetool.
the class AbstractTextControlContainerFigure method setUI.
@Override
protected void setUI() {
setLayoutManager(new DelegatingLayout());
Locator textLocator = new Locator() {
public void relocate(IFigure target) {
Rectangle bounds = calculateTextControlBounds();
if (bounds == null) {
bounds = getBounds().getCopy();
}
translateFromParent(bounds);
target.setBounds(bounds);
}
};
fTextControl = createTextControl(textLocator);
Locator mainLocator = new Locator() {
public void relocate(IFigure target) {
Rectangle bounds = getBounds().getCopy();
translateFromParent(bounds);
target.setBounds(bounds);
}
};
add(getMainFigure(), mainLocator);
// Have to add this if we want Animation to work on figures!
AnimationUtil.addFigureForAnimation(getMainFigure());
}
use of org.eclipse.draw2d.Locator in project archi by archimatetool.
the class CanvasBlockFigure method setUI.
@Override
protected void setUI() {
setLayoutManager(new DelegatingLayout());
Locator mainLocator = new Locator() {
public void relocate(IFigure target) {
Rectangle bounds = getBounds().getCopy();
translateFromParent(bounds);
target.setBounds(bounds);
}
};
FlowPage flowPage = new FlowPage();
BlockFlow block = new BlockFlow();
fTextFlow = new TextFlow();
fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
block.add(fTextFlow);
flowPage.add(block);
Figure textWrapperFigure = new Figure();
textWrapperFigure.setLayoutManager(new GridLayout());
textWrapperFigure.add(flowPage, new GridData(SWT.CENTER, SWT.CENTER, true, true));
add(textWrapperFigure, mainLocator);
fTextPositionDelegate = new TextPositionDelegate(textWrapperFigure, flowPage, getDiagramModelObject());
// This last
add(getMainFigure(), mainLocator);
// Have to add this if we want Animation to work on figures!
AnimationUtil.addFigureForAnimation(getMainFigure());
fIconicDelegate = new IconicDelegate(getDiagramModelObject());
fIconicDelegate.updateImage();
}
use of org.eclipse.draw2d.Locator in project whole by wholeplatform.
the class WholeNonResizableEditPolicy method showTargetFeedback.
@Override
public void showTargetFeedback(Request request) {
if (request.getType().equals(RequestConstants.REQ_MOVE) || request.getType().equals(RequestConstants.REQ_CLONE) || request.getType().equals(RequestConstants.REQ_ADD))
if (targetFeedback == null) {
targetFeedback = new AbstractHandle((GraphicalEditPart) getHost(), new Locator() {
public void relocate(IFigure target) {
IFigure figure = getHostFigure();
Rectangle r;
if (figure instanceof HandleBounds)
r = ((HandleBounds) figure).getHandleBounds().getCopy();
else
r = getHostFigure().getBounds().getResized(-1, -1);
getHostFigure().translateToAbsolute(r);
target.translateToRelative(r);
target.setBounds(r.expand(5, 5).resize(1, 1));
}
}) {
{
setBorder(new LineBorder(ColorConstants.lightGray, 1));
}
protected DragTracker createDragTracker() {
return null;
}
};
addFeedback(targetFeedback);
}
}
use of org.eclipse.draw2d.Locator in project whole by wholeplatform.
the class WholeResizableEditPolicy method showTargetFeedback.
@Override
public void showTargetFeedback(Request request) {
if (request.getType().equals(RequestConstants.REQ_MOVE) || request.getType().equals(RequestConstants.REQ_CLONE) || request.getType().equals(RequestConstants.REQ_ADD))
if (targetFeedback == null) {
targetFeedback = new AbstractHandle((GraphicalEditPart) getHost(), new Locator() {
public void relocate(IFigure target) {
IFigure figure = getHostFigure();
Rectangle r;
if (figure instanceof HandleBounds)
r = ((HandleBounds) figure).getHandleBounds().getCopy();
else
r = getHostFigure().getBounds().getResized(-1, -1);
getHostFigure().translateToAbsolute(r);
target.translateToRelative(r);
target.setBounds(r.expand(5, 5).resize(1, 1));
}
}) {
{
setBorder(new LineBorder(ColorConstants.lightGray, 1));
}
protected DragTracker createDragTracker() {
return null;
}
};
addFeedback(targetFeedback);
}
}
use of org.eclipse.draw2d.Locator in project archi by archimatetool.
the class AbstractDiagramConnectionFigure method setLabelLocator.
private void setLabelLocator(int position) {
Locator locator = null;
switch(position) {
case IDiagramModelConnection.CONNECTION_TEXT_POSITION_SOURCE:
locator = new ArchiConnectionEndpointLocator(this, false);
break;
case IDiagramModelConnection.CONNECTION_TEXT_POSITION_MIDDLE:
locator = new ConnectionLocator(this, ConnectionLocator.MIDDLE);
break;
case IDiagramModelConnection.CONNECTION_TEXT_POSITION_TARGET:
locator = new ArchiConnectionEndpointLocator(this, true);
break;
}
setConstraint(getConnectionLabel(), locator);
}
Aggregations