Java Code Examples for org.eclipse.draw2d.IFigure#setBackgroundColor()

The following examples show how to use org.eclipse.draw2d.IFigure#setBackgroundColor() . 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: FunnyStyleSupport.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createColumnArea(final IFigure columns) {
    initColumnArea(columns);

    columns.setBorder(new MarginBorder(0, 0, 0, 0));
    columns.setBackgroundColor(ColorConstants.white);
    columns.setOpaque(true);

    final Figure centerFigure = new Figure();
    centerFigure.setLayoutManager(new BorderLayout());
    centerFigure.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));

    centerFigure.add(columns, BorderLayout.CENTER);
    getTableFigure().add(centerFigure, BorderLayout.CENTER);
}
 
Example 2
Source File: BoundarySignalEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 3
Source File: IntermediateErrorCatchEvent5EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 4
Source File: IntermediateErrorCatchEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 5
Source File: IntermediateErrorCatchEvent6EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 6
Source File: NonInterruptingBoundaryTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 7
Source File: CellFigure.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Updates the CellFigure based on the provided Cell state.
 * 
 * @param state
 *            The State of the model Cell (unselected, selected, disabled,
 *            or invalid).
 */
public void setState(State state) {
	IFigure figure = getFigure();

	// Modify the Figure's color or visibility based on the Cell's state.
	if (state == State.SELECTED) {
		figure.setBackgroundColor(selectedColor);
	} else if (state == State.DISABLED) {
		figure.setBackgroundColor(disabledColor);
	} else if (state == State.INVALID) {
		figure.setVisible(false);
	} else {
		figure.setBackgroundColor(unselectedColor);
	}

	return;
}
 
Example 8
Source File: ChartReportItemUIUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Refresh background color.
 * 
 * @param handle
 *            Item handle
 * @param figure
 *            Figure
 */
public static void refreshBackgroundColor( ExtendedItemHandle handle,
		IFigure figure )
{
	Object obj = handle.getProperty( StyleHandle.BACKGROUND_COLOR_PROP );

	figure.setOpaque( false );

	if ( obj != null )
	{
		int color = 0xFFFFFF;
		if ( obj instanceof String )
		{
			color = ColorUtil.parseColor( (String) obj );
		}
		else
		{
			color = ( (Integer) obj ).intValue( );
		}
		figure.setBackgroundColor( ColorManager.getColor( color ) );
		figure.setOpaque( true );
	}
}
 
Example 9
Source File: AbstractStyleSupport.java    From erflute with Apache License 2.0 6 votes vote down vote up
protected void setColumnFigureColor(IFigure figure, boolean isSelectedReferenced, boolean isSelectedForeignKey, boolean isAdded,
        boolean isUpdated, boolean isRemoved) {
    if (isAdded) {
        figure.setBackgroundColor(DesignResources.ADDED_COLOR);
    } else if (isUpdated) {
        figure.setBackgroundColor(DesignResources.UPDATED_COLOR);
    } else if (isRemoved) {
        figure.setBackgroundColor(DesignResources.REMOVED_COLOR);
    }

    if (isSelectedReferenced && isSelectedForeignKey) {
        figure.setBackgroundColor(DesignResources.SELECTED_REFERENCED_AND_FOREIGNKEY_COLUMN);

    } else if (isSelectedReferenced) {
        figure.setBackgroundColor(DesignResources.SELECTED_REFERENCED_COLUMN);

    } else if (isSelectedForeignKey) {
        figure.setBackgroundColor(DesignResources.SELECTED_FOREIGNKEY_COLUMN);

    }

    figure.setOpaque(true);
}
 
Example 10
Source File: BoundaryMessageEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 11
Source File: BoundaryTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 12
Source File: IntermediateErrorCatchEvent3EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 13
Source File: AbstractStyleSupport.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
protected void setColumnFigureColor(final IFigure figure, final boolean isSelectedReferenced, final boolean isSelectedForeignKey, final boolean isAdded, final boolean isUpdated, final boolean isRemoved) {
    if (isAdded) {
        figure.setBackgroundColor(Resources.ADDED_COLOR);
    } else if (isUpdated) {
        figure.setBackgroundColor(Resources.UPDATED_COLOR);
    } else if (isRemoved) {
        figure.setBackgroundColor(Resources.REMOVED_COLOR);
    }

    if (isSelectedReferenced && isSelectedForeignKey) {
        figure.setBackgroundColor(Resources.SELECTED_REFERENCED_AND_FOREIGNKEY_COLUMN);

    } else if (isSelectedReferenced) {
        figure.setBackgroundColor(Resources.SELECTED_REFERENCED_COLUMN);

    } else if (isSelectedForeignKey) {
        figure.setBackgroundColor(Resources.SELECTED_FOREIGNKEY_COLUMN);

    }

    figure.setOpaque(true);
}
 
Example 14
Source File: BoundaryMessageEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 15
Source File: NonInterruptingBoundaryTimerEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 16
Source File: AbstractStyleSupport.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
protected void initColumnArea(IFigure columns) {
	ToolbarLayout layout = new ToolbarLayout();
	layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
	layout.setStretchMinorAxis(true);
	layout.setSpacing(0);

	columns.setBorder(new MarginBorder(0, 2, 2, 2));
	columns.setLayoutManager(layout);

	columns.setBackgroundColor(null);
	columns.setOpaque(false);
}
 
Example 17
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 18
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 19
Source File: FigureController.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void applyColor ( final IFigure figure, final Color color )
{
    figure.setBackgroundColor ( color );
}
 
Example 20
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);
}