org.eclipse.draw2d.Border Java Examples

The following examples show how to use org.eclipse.draw2d.Border. 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: ReportResizeTracker.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private Dimension getFigureSize()
{
	IFigure figure = getOwner( ).getFigure( );
	Dimension dim = figure.getSize( );
	if (figure instanceof IOutsideBorder)
	{
		Border border = ((IOutsideBorder)figure).getOutsideBorder( );
		Insets insets = border.getInsets( figure );
		if (PositionConstants.EAST == getResizeDirection())
		{
			dim.width = dim.width - insets.right - insets.left;
		}
		else if (PositionConstants.SOUTH == getResizeDirection())
		{
			dim.height = dim.height - insets.bottom - insets.top;
		}
	}
	return dim;
}
 
Example #2
Source File: ReportFlowLayoutEditPolicy.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Generates a draw2d constraint object derived from the specified child
 * EditPart using the provided Request. The returned constraint will be
 * translated to the application's model later using
 * {@link #translateToModelConstraint(Object)}.
 * 
 * @param request
 *            the ChangeBoundsRequest
 * @param child
 *            the child EditPart for which the constraint should be
 *            generated
 * @return the draw2d constraint
 */
protected Object getConstraintFor( ChangeBoundsRequest request,
		GraphicalEditPart child )
{
	IFigure figure = child.getFigure( );
	Rectangle rect = new PrecisionRectangle(figure.getBounds());
	figure.translateToAbsolute(rect);
	rect = request.getTransformedRectangle( rect );
	
	figure.translateToRelative(rect);
	rect.translate( getLayoutOrigin( ).getNegated( ) );
	if (figure instanceof IOutsideBorder)
	{
		Border border = ((IOutsideBorder)figure).getOutsideBorder( );
		if (border !=  null)
		{
			Insets insets = border.getInsets( figure );
			rect.shrink( insets.right, insets.bottom );
		}
	}

	return getConstraintFor( rect );
}
 
Example #3
Source File: ModelPropertiesFigure.java    From erflute with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #4
Source File: ModelPropertiesFigure.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void addRow(String name, String value, String tableStyle) {
	Border border = new MarginBorder(5);

	ToolbarLayout layout = new ToolbarLayout();
	layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
	layout.setStretchMinorAxis(true);

	Label nameLabel = new Label();

	Label valueLabel = new Label();

	nameLabel.setBorder(border);
	nameLabel.setText(name);
	nameLabel.setLabelAlignment(PositionConstants.LEFT);
	nameLabel.setForegroundColor(this.foregroundColor);

	this.add(nameLabel);

	if (!ResourceString.getResourceString(
			"action.title.change.design.simple").equals(tableStyle)
			&& !ResourceString.getResourceString(
					"action.title.change.design.frame").equals(tableStyle)) {
		valueLabel.setBackgroundColor(ColorConstants.white);
		valueLabel.setOpaque(true);
		valueLabel.setForegroundColor(ColorConstants.black);

	} else {
		valueLabel.setOpaque(false);
		valueLabel.setForegroundColor(this.foregroundColor);
	}

	valueLabel.setBorder(border);
	valueLabel.setText(value);
	valueLabel.setLabelAlignment(PositionConstants.LEFT);

	this.add(valueLabel);
}
 
Example #5
Source File: RectangleFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void outlineShape( Graphics graphics )
{
	Rectangle bounds = getBounds( ).getCopy( );
	Border border = getBorder( );
	if ( border != null )
	{
		bounds = bounds.crop( border.getInsets( null ) );
	}
	graphics.drawRectangle( bounds.x,
			bounds.y,
			bounds.width - 1,
			bounds.height - 1 );

}
 
Example #6
Source File: RectangleFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void fillShape( Graphics graphics )
{
	Rectangle bounds = getBounds( ).getCopy( );
	Border border = getBorder( );
	if ( border != null )
	{
		bounds = bounds.crop( border.getInsets( null ) );
	}
	if ( isOpaque( ) )
		graphics.fillRectangle( bounds );
}
 
Example #7
Source File: ModelPropertiesFigure.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void addRow(final String name, final String value, final String tableStyle) {
    final Border border = new MarginBorder(5);

    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(OrderedLayout.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);

    this.add(nameLabel);

    if (!ResourceString.getResourceString("action.title.change.design.simple").equals(tableStyle) && !ResourceString.getResourceString("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);

    this.add(valueLabel);
}
 
Example #8
Source File: DefaultTimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Border getDetailAreaBorder() {
	final RoundedRectangleBorder border = new RoundedRectangleBorder(10);
	border.setWidth(2);
	border.setColor(getGridColor());

	return border;
}
 
Example #9
Source File: RoundedNode.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Border createBorder() {
	return new MarginBorder(PADDING);
}
 
Example #10
Source File: TextAnnotationEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
private Border createBorder0() {
	BorderForTextAnnotation result = new BorderForTextAnnotation();

	return result;
}
 
Example #11
Source File: TextAnnotation2EditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
private Border createBorder0() {
	BorderForTextAnnotation result = new BorderForTextAnnotation();

	return result;
}
 
Example #12
Source File: ImageFigure.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Border getOutsideBorder( )
{
	return getBorder( );
}
 
Example #13
Source File: LabelNode.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Border createBorder() {
	return new MarginBorder(PADDING);
}
 
Example #14
Source File: RectangleNode.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Border createBorder() {
	MarginBorder marginBorder = new MarginBorder(PADDING - 1);
	LineBorder lineBorder = new LineBorder(1);
	return new CompoundBorder(lineBorder, marginBorder);
}
 
Example #15
Source File: DefaultTimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Border getTrackBorder(String title) {
	return new TrackBorder(title);
}
 
Example #16
Source File: DefaultTimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Border getOverviewSelectionBorder() {
	return new LeftRightBorder(ColorConstants.red);
}
 
Example #17
Source File: DefaultTimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Border getOverviewAreaBorder() {
	return getDetailAreaBorder();
}
 
Example #18
Source File: IOutsideBorder.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
/**Gets the outside border
 * @return
 */
Border getOutsideBorder();
 
Example #19
Source File: ITimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Get the border for a track.
 *
 * @param title
 *            track title
 *
 * @return track border
 */
Border getTrackBorder(String title);
 
Example #20
Source File: ITimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Get the border for the overview selection figure.
 *
 * @return overview selection figure border
 */
Border getOverviewSelectionBorder();
 
Example #21
Source File: ITimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Get the border for the overview area.
 *
 * @return overview area border
 */
Border getOverviewAreaBorder();
 
Example #22
Source File: ITimelineStyleProvider.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Get the border for the detail area.
 *
 * @return detail area border
 */
Border getDetailAreaBorder();
 
Example #23
Source File: AbstractNode.java    From xtext-eclipse with Eclipse Public License 2.0 votes vote down vote up
protected abstract Border createBorder();