Java Code Examples for org.eclipse.gef.GraphicalEditPart#setLayoutConstraint()

The following examples show how to use org.eclipse.gef.GraphicalEditPart#setLayoutConstraint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiagramWalkerEditPart.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public void refreshVisuals() {
    final DiagramWalker element = (DiagramWalker) getModel();
    setVisible();
    final Rectangle rectangle = getRectangle();
    final GraphicalEditPart parent = (GraphicalEditPart) getParent();
    final IFigure figure = getFigure();
    final int[] color = element.getColor();
    if (color != null) {
        final Color bgColor = DesignResources.getColor(color);
        figure.setBackgroundColor(bgColor);
    }
    parent.setLayoutConstraint(this, figure, rectangle);
}
 
Example 2
Source File: NodeElementEditPart.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
final public void refreshVisuals() {
    refreshChildren();
    doRefreshVisuals();
    setVisible();

    final NodeElement element = (NodeElement) getModel();
    final IFigure figure = getFigure();

    final int[] color = element.getColor();

    if (color != null) {
        final ChangeTrackingList changeTrackingList = getDiagram().getChangeTrackingList();

        if (changeTrackingList.isCalculated() && (element instanceof Note || element instanceof ERTable)) {
            if (changeTrackingList.isAdded(element)) {
                figure.setBackgroundColor(Resources.ADDED_COLOR);

            } else if (changeTrackingList.getUpdatedNodeElement(element) != null) {
                figure.setBackgroundColor(Resources.UPDATED_COLOR);

            } else {
                figure.setBackgroundColor(ColorConstants.white);
            }

        } else {
            final Color bgColor = Resources.getColor(color);
            figure.setBackgroundColor(bgColor);
        }

    }

    final Rectangle rectangle = getRectangle();

    final GraphicalEditPart parent = (GraphicalEditPart) getParent();

    parent.setLayoutConstraint(this, figure, rectangle);

    getFigure().getUpdateManager().performValidation();

    element.setActualLocation(toLocation(getFigure().getBounds()));

    refreshMovedAnchor();
}
 
Example 3
Source File: NodeElementEditPart.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void refreshVisuals() {
	NodeElement element = (NodeElement) this.getModel();

	this.setVisible();

	Rectangle rectangle = this.getRectangle();

	GraphicalEditPart parent = (GraphicalEditPart) this.getParent();

	IFigure figure = this.getFigure();

	int[] color = element.getColor();

	if (color != null) {
		ChangeTrackingList changeTrackingList = this.getDiagram()
				.getChangeTrackingList();

		if (changeTrackingList.isCalculated()
				&& (element instanceof Note || element instanceof ERTable)) {
			if (changeTrackingList.isAdded(element)) {
				figure.setBackgroundColor(Resources.ADDED_COLOR);

			} else if (changeTrackingList.getUpdatedNodeElement(element) != null) {
				figure.setBackgroundColor(Resources.UPDATED_COLOR);

			} else {
				figure.setBackgroundColor(ColorConstants.white);
			}

		} else {
			Color bgColor = Resources.getColor(color);
			figure.setBackgroundColor(bgColor);
		}

	}

	parent.setLayoutConstraint(this, figure, rectangle);

}
 
Example 4
Source File: RemovedNodeElementEditPart.java    From ermasterr with Apache License 2.0 3 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void refreshVisuals() {
    setVisible();

    final Rectangle rectangle = getRectangle();

    final GraphicalEditPart parent = (GraphicalEditPart) getParent();

    final IFigure figure = getFigure();

    figure.setBackgroundColor(Resources.REMOVED_COLOR);

    parent.setLayoutConstraint(this, figure, rectangle);
}
 
Example 5
Source File: RemovedNodeElementEditPart.java    From ermaster-b with Apache License 2.0 3 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void refreshVisuals() {
	this.setVisible();

	Rectangle rectangle = this.getRectangle();

	GraphicalEditPart parent = (GraphicalEditPart) this.getParent();

	IFigure figure = this.getFigure();

	figure.setBackgroundColor(Resources.REMOVED_COLOR);

	parent.setLayoutConstraint(this, figure, rectangle);
}