org.eclipse.draw2d.LineBorder Java Examples

The following examples show how to use org.eclipse.draw2d.LineBorder. 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: ClassFigure.java    From JDeodorant with MIT License 6 votes vote down vote up
public ClassFigure(String name, Color color) {
	ToolbarLayout layout = new ToolbarLayout();
	layout.setSpacing(5);
	setLayoutManager(layout);	
	setBorder(new CompoundBorder( new LineBorder(1), new MarginBorder(0, 0, 0, 0)));
	setBackgroundColor(color);
	setOpaque(true);

	Label className = new Label(name, DecorationConstants.CLASS);
	className.setToolTip(new Label(name));
	className.setFont(DecorationConstants.classFont);

	add(className);

	new ClassFigureMover(this);

}
 
Example #2
Source File: RowHandle.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	setOpaque( true );
	LineBorder bd = new LineBorder( 1 );
	bd.setColor( ReportColorConstants.HandleBorderColor );
	setBorder( bd );

	String tp = getTooltipText( );
	if ( tp != null )
	{
		Label tooltip = new Label( tp );
		tooltip.setBorder( new MarginBorder( 0, 2, 0, 2 ) );
		setToolTip( tooltip );
	}

	setCursor( Cursors.ARROW );
}
 
Example #3
Source File: PlaceHolderEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void refreshFigure( )
{
	StyleHandle style = ( (DesignElementHandle) getDefaultHandle( ) )
			.getPrivateStyle( );

	//TODO:fixed the bug 191874
	//( (LabelFigure) getFigure( ) ).setFont( getFont( ) ); 
	( (LabelFigure) getFigure( ) ).setImage( getImage( ) );
	( (LabelFigure) getFigure( ) ).setAlignment( PositionConstants.WEST );
	( (LabelFigure) getFigure( ) ).setDirection( getTextDirection( getDefaultHandle( )) ); // bidi_hcg
	( (LabelFigure) getFigure( ) ).setText( getTemplateModel( )
			.getDisplayDescription( ) );
	( (LabelFigure) getFigure( ) )
			.setTextAlign( DesignChoiceConstants.TEXT_ALIGN_CENTER );
	( (LabelFigure) getFigure( ) )
			.setForegroundColor( ReportColorConstants.ShadowLineColor );
	( (LabelFigure) getFigure( ) ).setDisplay( style.getDisplay( ) );

	getFigure( ).setBorder( new LineBorder( 1 ) );
}
 
Example #4
Source File: DestroyEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void refreshFigure( )
{
	StyleHandle style = ( (DesignElementHandle) getModel( ) ).getPrivateStyle( );
	( (LabelFigure) getFigure( ) ).setFont( FontManager.getFont("Dialog", 10, SWT.ITALIC) ); //$NON-NLS-1$
	
	//( (LabelFigure) getFigure( ) ).setImage( getImage( ) );
	( (LabelFigure) getFigure( ) ).setAlignment( PositionConstants.WEST );
	
	// bidi_hcg start
	// Set direction before setting text
	( (LabelFigure) getFigure( ) ).setDirection( getTextDirection( ) );
	// bidi_hcg end
	( (LabelFigure) getFigure( ) ).setText( MESSAGE );
	( (LabelFigure) getFigure( ) ).setTextAlign( DesignChoiceConstants.TEXT_ALIGN_LEFT );
	( (LabelFigure) getFigure( ) ).setForegroundColor( ReportColorConstants.RedWarning );
	( (LabelFigure) getFigure( ) ).setDisplay( style.getDisplay( ) );

	getFigure( ).setBorder( new LineBorder( 1 ) );
}
 
Example #5
Source File: CompartmentSegment.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public CompartmentSegment(EObject eObject, ISegmentFigure innerSegment, PrimitiveFigureFactory primitiveFactory) {
	super(eObject);
	setEntry(primitiveFactory.createCrossPoint(this));
	setExit(primitiveFactory.createCrossPoint(this));
	add(innerSegment);
	primitiveFactory.createConnection(getEntry(), innerSegment.getEntry(), this);
	primitiveFactory.createConnection(innerSegment.getExit(), getExit(), this);
	setBorder(new LineBorder(getForegroundColor(), 1, Graphics.LINE_DASH));
	innerFigure = innerSegment;
}
 
Example #6
Source File: StatisticFigure.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public StatisticFigure() {
	setOpaque(true);
	setBackgroundColor(ColorConstants.white);
	setForegroundColor(ColorConstants.black);
	setBorder(new LineBorder(ColorConstants.black, 1));
	GridLayout gl = new GridLayout();
	gl.numColumns = 12;
	setLayoutManager(gl);
	numberLabel = initLabel("results");
	meanLabel = initLabel("mean");
	standardDevLabel = initLabel("standard deviation");
	perc5Label = initLabel("5% percentile");
	perc95Label = initLabel("95% percentile");
	medianLabel = initLabel("median");
}
 
Example #7
Source File: ExchangeFigure.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
ExchangeFigure(ExchangeNode node) {
	this.node = node;
	if (node.isDummy())
		return;
	Exchange exchange = node.exchange;
	setBorder(new LineBorder(ColorConstants.white, 1));
	setForegroundColor(exchange.isAvoided ? BACKGROUND_COLOR : TEXT_COLOR);
	setBackgroundColor(BACKGROUND_COLOR);
	setToolTip(new Label(getToolTipText()));
}
 
Example #8
Source File: CornerHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	setOpaque( true );
	LineBorder bd = new LineBorder( 1 );
	bd.setColor( ReportColorConstants.HandleBorderColor );
	setBorder( bd );
	setCursor( Cursors.ARROW );
}
 
Example #9
Source File: ColumnHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	setOpaque( true );
	LineBorder bd = new LineBorder( 1 );
	bd.setColor( ReportColorConstants.HandleBorderColor );
	setBorder( bd );
	setCursor( Cursors.ARROW );
}
 
Example #10
Source File: TableHFHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	//should draw the fill rectangle
	setOpaque( true );
	//draw the border line width is 1
	LineBorder bd = new LineBorder( 1 );
	bd.setColor( ReportColorConstants.HandleBorderColor );
	setBorder( bd );

	//set the default cursor, may not be a SIZEALL cursor()
	setCursor( Cursors.ARROW );

	initChildrenHandle( );
}
 
Example #11
Source File: RowDragHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	setOpaque( true );
	setBorder( new LineBorder( 1 ) );
	setCursor( Cursors.SIZENS );
}
 
Example #12
Source File: ColumnDragHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	setOpaque( true );
	setBorder( new LineBorder( 1 ) );
	setCursor( Cursors.SIZEWE );
}
 
Example #13
Source File: ClassFigure.java    From JDeodorant with MIT License 5 votes vote down vote up
public void addThreeCompartments(){
	addFieldCompartment();
	extractMethodFigure.setBorder(new LineBorder());
	extractMethodFigure.setBackgroundColor(DecorationConstants.entityColor);
	add(extractMethodFigure);
	add(methodFigure);
}
 
Example #14
Source File: PackageFigure.java    From JDeodorant with MIT License 5 votes vote down vote up
public PackageFigure(String name, double scale){
	this.name= name;

	setLayoutManager(new ProportionalFlowLayout(scale,5, 10));
	setToolTip(new Label(name));
	LineBorder border = new LineBorder();
	border.setColor(ColorConstants.white);
	
	setBorder(new CompoundBorder(border, new MarginBorder(10, 5, 10, 5)));

}
 
Example #15
Source File: PackageMapDiagram.java    From JDeodorant with MIT License 5 votes vote down vote up
public PMClassFigure createSmellyClass(PMClassFigure classFigure, String key){
	List<CandidateRefactoring> candidates = keyMap.get(key);
	classFigure.setCandidates(candidates);
	int severity = candidates.size();
	Color color = calculateSeverityColor(severity);

	LineBorder border= (LineBorder)classFigure.getBorder();
	//classFigure.setToolTip(null);
	classFigure.setOriginalBackgroundColor(color);
	border.setColor(classFigure.getBackgroundColor());
	classFigure.setOriginalBorder(border);
	new SmellyClassMouseListener(this, classFigure);
	return classFigure;
}
 
Example #16
Source File: MethodClassSection.java    From JDeodorant with MIT License 4 votes vote down vote up
public void addFigure(Figure figure){
	this.add(figure);
	figure.setBackgroundColor(DecorationConstants.entityColor);
	figure.setBorder(new CompoundBorder( new LineBorder(1), new MarginBorder(3,3,3,3)));
	numOfMethods++;
}
 
Example #17
Source File: PMClassFigure.java    From JDeodorant with MIT License 4 votes vote down vote up
public void setOriginalBorder(LineBorder originalBorder) {
	this.originalBorder = originalBorder;
	this.setBorder(originalBorder);
}
 
Example #18
Source File: PMClassFigure.java    From JDeodorant with MIT License 4 votes vote down vote up
public LineBorder getOriginalBorder() {
	return originalBorder;
}
 
Example #19
Source File: SmellyClassMouseListener.java    From JDeodorant with MIT License 4 votes vote down vote up
public void mousePressed(MouseEvent me) {
	if(classFigure.isSelected()){
		classFigure.setSelected(false);

		classFigure.setToOriginalState();
	}
	else{
		classFigure.setSelected(true);

		classFigure.setBackgroundColor(classFigure.getOriginalColor());
		classFigure.setBorder(new LineBorder(4));
		classFigure.setToolTip(null);
	}

	List<PMClassFigure> classFigures = diagram.getAllClassFigures();
	List<CandidateRefactoring> candidates = classFigure.getCandidates();


	for(PMClassFigure figure: classFigures){

		//clearing previous decoration
		if(!figure.equals(classFigure)){
			if(figure.isSelected())
				figure.setSelected(false);


			figure.setToOriginalState();
		}

		if(!candidates.isEmpty() && candidates.get(0) instanceof MoveMethodCandidateRefactoring){


			//finding and decorating target classes
			for(CandidateRefactoring candidate: candidates){
				MoveMethodCandidateRefactoring moveCandidate = (MoveMethodCandidateRefactoring) candidate;
				String name = moveCandidate.getTarget();

				if(figure.getName().equals(name)){
					if (classFigure.isSelected()){
						figure.setBackgroundColor(ColorConstants.black);

						if(!figure.isInnerClass()){
							LineBorder border = new LineBorder();
							border.setColor(ColorConstants.black);
							figure.setBorder(border);
						}

					}

				}

			} 
		}

	}
}
 
Example #20
Source File: ProductSystemFigure.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
ProductSystemFigure(ProductSystemNode node) {
	setForegroundColor(ColorConstants.black);
	setBorder(new LineBorder(1));
	node.figure = this;
	this.node = node;
}
 
Example #21
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 #22
Source File: ProductSystemFigure.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
public ProductSystemFigure(ProductSystemNode node) {
	setForegroundColor(ColorConstants.black);
	setBorder(new LineBorder(1));
	this.node = node;
	addMouseListener(new SelectionChange());
}