org.eclipse.draw2d.RoundedRectangle Java Examples

The following examples show how to use org.eclipse.draw2d.RoundedRectangle. 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: RoundDetailsPart.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private IFigure createTargetValue ()
{
    this.targetRect = new RoundedRectangle ();
    this.targetRect.setLayoutManager ( new BorderLayout () );
    this.targetRect.setBackgroundColor ( ColorConstants.lightGray );
    this.targetRect.setForegroundColor ( ColorConstants.black );
    this.targetRect.setBorder ( new MarginBorder ( 10 ) );

    this.targetRect.add ( this.targetLabel = new Label (), BorderLayout.CENTER );

    return this.targetRect;
}
 
Example #2
Source File: RoundDetailsPart.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private IFigure createSourceValue ()
{
    this.sourceRect = new RoundedRectangle ();
    this.sourceRect.setLayoutManager ( new BorderLayout () );
    this.sourceRect.setBackgroundColor ( ColorConstants.lightGray );
    this.sourceRect.setForegroundColor ( ColorConstants.black );
    this.sourceRect.setBorder ( new MarginBorder ( 10 ) );

    this.sourceRect.add ( this.sourceLabel = new Label (), BorderLayout.CENTER );

    return this.sourceRect;
}
 
Example #3
Source File: ManualOverride.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Figure createRV ()
{
    final Figure rvFigure = new Figure ();
    rvFigure.setLayoutManager ( new BorderLayout () );
    final Label label = new Label ( Messages.ManualOverride_ResetValue_Label );
    label.setBorder ( new MarginBorder ( 10 ) );
    rvFigure.add ( label, BorderLayout.RIGHT );

    this.rvRect = new RoundedRectangle ();
    this.rvRect.setLayoutManager ( new BorderLayout () );
    this.rvValue = new Label ();
    this.rvRect.setBackgroundColor ( ColorConstants.lightGray );
    this.rvValue.setBorder ( new MarginBorder ( 10 ) );
    this.rvRect.add ( this.rvValue, BorderLayout.CENTER );

    this.rvRectBlinker = new StyleBlinker () {

        @Override
        public void update ( final CurrentStyle style )
        {
            ManualOverride.this.rvRect.setBackgroundColor ( style.background );
            ManualOverride.this.rvRect.setForegroundColor ( style.foreground );
            ManualOverride.this.rvRect.setFont ( style.font );
        }
    };
    this.rvRectStyler = new StateStyler ( this.rvRectBlinker );

    rvFigure.add ( this.rvRect, BorderLayout.CENTER );
    return rvFigure;
}
 
Example #4
Source File: TreeLayoutEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private IFigure getFeedbackFigure() {
	if (feedbackFigure == null) {
		final RoundedRectangle pl = new RoundedRectangle();
		pl.setForegroundColor(ColorConstants.black);
		pl.setBackgroundColor(ColorConstants.black);
		pl.setBounds(getFeedbackFigureBounds());
		feedbackFigure = pl;
	}
	return feedbackFigure;
}
 
Example #5
Source File: MenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void paintElements() {
    final RoundedRectangle background = new RoundedRectangle();
    background.setAlpha(50);
    background.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY));
    background.setSize(new Dimension(4*20,figureList.size()*20));
    background.setLocation(new Point(parent.getBounds().getTopLeft().x,parent.getBounds().getTopLeft().y+40));
    background.setVisible(false);
    parent.add(background);
    addElementsToShow(background);
    if (figureList != null) {
        for(final List<IFigure> eventLists : figureList){
            for(final IFigure f : eventLists){
                f.setSize(new Dimension(20,20));
                f.setLocation(new Point(parent.getBounds().getTopLeft().x +f.getSize().width*eventLists.indexOf(f),parent.getBounds().getTopLeft().y+20*(figureList.indexOf(eventLists)+2)));
                f.setVisible(false);
                background.add(f);
                if(!(f instanceof RectangleFigure)){
                    addElementsToShow(f);
                }

            }
            if(figureList.indexOf(eventLists) != figureList.size()-1){
                final Polyline lineSeparator = new Polyline();
                lineSeparator.addPoint(new Point(parent.getBounds().getTopLeft().x ,parent.getBounds().getTopLeft().y+20+20*(figureList.indexOf(eventLists)+2)));
                lineSeparator.addPoint(new Point(parent.getBounds().getTopLeft().x + 80,parent.getBounds().getTopLeft().y+20+20*(figureList.indexOf(eventLists)+2)));
                lineSeparator.setAlpha(80);
                lineSeparator.setVisible(false);
                background.add(lineSeparator);
                addElementsToShow(lineSeparator);
            }
        }
    }
}
 
Example #6
Source File: DropDownMenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createSubMenuFigure() {
	subMenuFigure = new RoundedRectangle();
	subMenuFigure.setAlpha(50);
	subMenuFigure.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY));
	subMenuFigure.setSize(new Dimension(4*20,figureList.size()*20));
	Rectangle parentBounds = parent.getBounds();
	Point newPointLocation = new Point(parentBounds.getTopLeft().x,parentBounds.getTopLeft().y+40);
	subMenuFigure.setLocation(newPointLocation);
	subMenuFigure.setVisible(false);
	parent.add(subMenuFigure);
}
 
Example #7
Source File: SelectionFeedbackEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public SelectionFeedbackEditPolicy(final EClass eClass) {

	feedBackFigure = new RoundedRectangle(){
		protected void fillShape(Graphics graphics) {
			Rectangle r = getBounds() ;

			Point topLeft = r.getTopLeft();
			Point bottomRight = r.getBottomRight();
			Color backGroundColor = null ;
			if(useSelectionColor){
				backGroundColor = ColorRegistry.getInstance().getColor(selectionColor) ;
			}else{
				backGroundColor=FiguresHelper.getFeedbackColor(eClass) ;
			}


			Pattern pattern = new Pattern(Display.getCurrent(), topLeft.x,
					topLeft.y, bottomRight.x, bottomRight.y,
					backGroundColor,30, backGroundColor,60);

			graphics.setBackgroundPattern(pattern);
			graphics.fillRoundRectangle(r, 20, 20) ;
			graphics.setAlpha(0) ;
			graphics.setBackgroundPattern(null);	
			pattern.dispose();

		};
	} ;


	figureListener = new FigureListener() {

		public void figureMoved(IFigure source) {
			hideFeedback();
			List<?> selectedEditPart = getHost().getViewer().getSelectedEditParts() ;
			if(selectedEditPart.contains(getHost())){

				if(!figureIsDisplayed()){
					showFeedback(zoomManager.getZoom());
				}
			}
		}
	};

}