use of org.eclipse.draw2d.IFigure in project Palladio-Editors-Sirius by PalladioSimulator.
the class PropagateFigureListenerAtConnectionFigure method targetConnectionAdded.
/**
* {@inheritDoc}
*/
public void targetConnectionAdded(ConnectionEditPart connection, int index) {
IFigure figure = connection.getFigure();
figure.addFigureListener(figureListener);
}
use of org.eclipse.draw2d.IFigure in project Palladio-Editors-Sirius by PalladioSimulator.
the class PropagateFigureListenerAtConnectionFigure method removingTargetConnection.
/**
* {@inheritDoc}
*/
public void removingTargetConnection(ConnectionEditPart connection, int index) {
IFigure figure = connection.getFigure();
figure.removeFigureListener(figureListener);
}
use of org.eclipse.draw2d.IFigure in project knime-core by knime.
the class WorkflowMarqueeSelectionTool method isFigureVisible.
private boolean isFigureVisible(final IFigure fig) {
Rectangle figBounds = fig.getBounds().getCopy();
IFigure walker = fig.getParent();
while (!figBounds.isEmpty() && walker != null) {
walker.translateToParent(figBounds);
figBounds.intersect(walker.getBounds());
walker = walker.getParent();
}
return !figBounds.isEmpty();
}
use of org.eclipse.draw2d.IFigure in project knime-core by knime.
the class WorkflowMarqueeSelectionTool method calculateNewSelection.
private void calculateNewSelection(final Collection<GraphicalEditPart> newSelections, final Collection<GraphicalEditPart> deselections) {
Rectangle marqueeRect = getMarqueeSelectionRectangle();
for (Iterator<GraphicalEditPart> itr = getAllChildren().iterator(); itr.hasNext(); ) {
GraphicalEditPart child = itr.next();
IFigure figure = child.getFigure();
if (!child.isSelectable() || child.getTargetEditPart(MARQUEE_REQUEST) != child || !isFigureVisible(figure) || !figure.isShowing()) {
continue;
}
if (!(child instanceof NodeContainerEditPart || child instanceof ConnectionContainerEditPart || child instanceof AbstractWorkflowPortBarEditPart || child instanceof AnnotationEditPart)) {
continue;
}
Rectangle r = figure.getBounds().getCopy();
figure.translateToAbsolute(r);
boolean included = false;
if (child instanceof ConnectionEditPart && marqueeRect.intersects(r)) {
Rectangle relMarqueeRect = Rectangle.SINGLETON;
figure.translateToRelative(relMarqueeRect.setBounds(marqueeRect));
included = ((PolylineConnection) figure).getPoints().intersects(relMarqueeRect);
} else if (child instanceof AnnotationEditPart) {
// select WorkflowAnnotations only if they are fully included in the selection
if (figure instanceof WorkflowAnnotationFigure) {
included = marqueeRect.contains(r);
}
} else if (marqueeBehavior == BEHAVIOR_NODES_AND_CONNECTIONS_TOUCHED) {
included = marqueeRect.intersects(r);
} else {
included = marqueeRect.contains(r);
}
if (included) {
if (isToggle()) {
if (wasSelected(child)) {
deselections.add(child);
} else {
newSelections.add(child);
}
} else {
newSelections.add(child);
}
} else if (isToggle()) {
// readded if it was in the selection before
if (wasSelected(child)) {
newSelections.add(child);
} else {
deselections.add(child);
}
}
}
if (marqueeBehavior == BEHAVIOR_NODES_AND_CONNECTIONS_TOUCHED) {
calculateConnections(newSelections, deselections);
}
}
use of org.eclipse.draw2d.IFigure in project knime-core by knime.
the class WorkflowOutPortEditPart method refreshVisuals.
/**
* {@inheritDoc}
*/
@Override
protected void refreshVisuals() {
IFigure fig = getFigure();
fig.setBounds(new Rectangle(new Point(0, 50), new Dimension(30, 30)));
super.refreshVisuals();
}
Aggregations