Java Code Examples for org.eclipse.draw2d.Label#setFont()

The following examples show how to use org.eclipse.draw2d.Label#setFont() . 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: EntityFigureListener.java    From JDeodorant with MIT License 6 votes vote down vote up
public void mouseExited(MouseEvent me) {

		List<JConnection> connections = figure.getOutgoingConnections();
		for(JConnection connection: connections){
			connection.setAlpha(null);
			connection.setLineWidth(1);
			Label l = connection.getLabel();


			if(l != null){
				//l.setFont(new Font(null, "Arial", 10, SWT.BOLD));
				l.setFont(DecorationConstants.normalFont);
				ConnectionLocator locator = connection.getLocator();
				locator.setRelativePosition(PositionConstants.CENTER);
				connection.add(l, locator);
			}

		}
	}
 
Example 2
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 3
Source File: GaugeFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public GaugeFigure() {
	super();
	transparent = true;
	scale.setScaleLineVisible(false);
	scale.setTickLabelSide(LabelSide.Secondary);
	ramp.setRampWidth(10);
	
	valueLabel = new Label();	
	valueLabel.setFont(DEFAULT_LABEL_FONT);
	
	unitLabel = new Label();
	unitLabel.setFont(DEFAULT_LABEL_FONT);
	
	titleLabel = new Label();
	titleLabel.setFont(DEFAULT_LABEL_FONT);
	
	needle = new Needle();
	needle.setFill(true);
	needle.setOutline(false);
	
	needleCenter = new NeedleCenter();
	needleCenter.setOutline(false);
	
	setLayoutManager(new GaugeLayout());
	add(ramp, GaugeLayout.RAMP);
	add(scale, GaugeLayout.SCALE);		
	add(valueLabel, GaugeLayout.VALUE_LABEL);
	add(unitLabel, GaugeLayout.UNIT_LABEL);
	add(titleLabel, GaugeLayout.TITLE_LABEL);
	add(needle, GaugeLayout.NEEDLE);
	add(needleCenter, GaugeLayout.NEEDLE_CENTER);		
	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			ramp.setDirty(true);
			revalidate();	
		}
	});	
	
}
 
Example 4
Source File: MeterFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public MeterFigure() {
	super();
	//TODO, remove this if clip is supported by RAP
	if(SWT.getPlatform().startsWith("rap"))//$NON-NLS-1$
		ramp.setVisible(false);
	setTransparent(false);
	scale.setScaleLineVisible(false);
	
	((RoundScale)scale).setStartAngle(180-SPACE_ANGLE);
	((RoundScale)scale).setEndAngle(SPACE_ANGLE);
	ramp.setRampWidth(12);
	setLoColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
	setHiColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
	
	valueLabel = new Label();		
	valueLabel.setFont(DEFAULT_LABEL_FONT);
	needle = new Needle();
	needle.setFill(true);
	needle.setOutline(false);
	
//	needleCenter = new Ellipse();
//	needleCenter.setOutline(false);
	
	setLayoutManager(new XMeterLayout());
	add(ramp, XMeterLayout.RAMP);
	add(scale, XMeterLayout.SCALE);			
	add(needle, XMeterLayout.NEEDLE);
//	add(needleCenter, XMeterLayout.NEEDLE_CENTER);		
	add(valueLabel, XMeterLayout.VALUE_LABEL);
	
	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			ramp.setDirty(true);
			revalidate();	
		}
	});	
	
}
 
Example 5
Source File: KnobFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public KnobFigure() {
	super();
	transparent = true;
	scale.setScaleLineVisible(false);
	ramp.setRampWidth(12);		
	valueLabel = new Label();		
	valueLabel.setFont(DEFAULT_LABEL_FONT);
	bulb = new Bulb();
	
	thumb = new Thumb();
	thumb.setOutline(false);
	setLayoutManager(new KnobLayout());
	add(ramp, KnobLayout.RAMP);
	add(bulb, KnobLayout.BULB);		
	add(scale, KnobLayout.SCALE);		
	add(valueLabel, KnobLayout.VALUE_LABEL);
	
	add(thumb, KnobLayout.THUMB);		
	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			ramp.setDirty(true);
			revalidate();	
		}
	});	
	
	
}
 
Example 6
Source File: CrossflowTextSelectionEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void updateLabel(Label target) {
	Label source = (Label) getHostFigure();
	target.setText(source.getText());
	target.setTextAlignment(source.getTextAlignment());
	target.setFont(source.getFont());
}
 
Example 7
Source File: CrossflowTextNonResizableEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void updateLabel(Label target) {
	Label source = (Label) getHostFigure();
	target.setText(source.getText());
	target.setTextAlignment(source.getTextAlignment());
	target.setFont(source.getFont());
}
 
Example 8
Source File: PriorityFigure.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public PriorityFigure(IMapMode mapMode, int priority) {
	this.priority = priority;
	this.setLayoutManager(new StackLayout());
	setForegroundColor(ColorConstants.black);
	setBackgroundColor(ColorConstants.white);
	this.setOutline(false);
	setOpaque(false);
	setFill(true);
	this.setLineWidth(-1);
	label = new Label(String.valueOf(priority));
	label.setFont(createFont(priority));
	add(label);
}
 
Example 9
Source File: EntityFigureListener.java    From JDeodorant with MIT License 5 votes vote down vote up
public void mouseEntered(MouseEvent me) {

		List<JConnection> connections = figure.getOutgoingConnections();
		for(JConnection connection: connections){

			connection.setLineWidth(3);
			Label l = connection.getLabel();

			if(l != null){

				//String fontStyle = "Arial";
				ConnectionEndpointLocator locator = new ConnectionEndpointLocator(connection, true);

				if(connection.isWrite()){
					locator.setUDistance(95);
					locator.setVDistance(0);
				} else{
					locator.setUDistance(42);
					locator.setVDistance(0);
				}


				//l.setFont(new Font(null, fontStyle, 14 , SWT.BOLD));
				l.setFont(DecorationConstants.highlightFont);

				connection.add(l, locator);
			}

			PolygonDecoration decoration = new PolygonDecoration();
			decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
			decoration.setSize(20, 20);
			decoration.setBackgroundColor(connection.getForegroundColor());
			connection.setTargetDecoration(decoration);
		}
	}
 
Example 10
Source File: ProcessTextNonResizableEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void updateLabel(Label target) {
	Label source = (Label) getHostFigure();
	target.setText(source.getText());
	target.setTextAlignment(source.getTextAlignment());
	target.setFont(source.getFont());
}
 
Example 11
Source File: ProcessTextSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void updateLabel(Label target) {
	Label source = (Label) getHostFigure();
	target.setText(source.getText());
	target.setTextAlignment(source.getTextAlignment());
	target.setFont(source.getFont());
}
 
Example 12
Source File: ComponentMeterFigure.java    From arx with Apache License 2.0 5 votes vote down vote up
public ComponentMeterFigure() {
    super();
    setTransparent(false);
    scale.setScaleLineVisible(false);
    
    ((RoundScale)scale).setStartAngle(180-SPACE_ANGLE);
    ((RoundScale)scale).setEndAngle(SPACE_ANGLE);
    ramp.setRampWidth(12);
    setLoColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
    setHiColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW));
    
    valueLabel = new Label();       
    valueLabel.setFont(DEFAULT_LABEL_FONT);
    needle = new Needle();
    needle.setFill(true);
    needle.setOutline(false);
    
    setLayoutManager(new XMeterLayout());
    add(ramp, XMeterLayout.RAMP);
    add(scale, XMeterLayout.SCALE);         
    add(needle, XMeterLayout.NEEDLE);
    add(valueLabel, XMeterLayout.VALUE_LABEL);
    
    addFigureListener(new FigureListener() {            
        public void figureMoved(IFigure source) {
            ramp.setDirty(true);
            revalidate();   
        }
    }); 
    
}