org.eclipse.draw2d.Label Java Examples

The following examples show how to use org.eclipse.draw2d.Label. 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: BoundaryTimerEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #2
Source File: BoundaryTimerEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #3
Source File: CatchLinkEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #4
Source File: FunnyStyleSupport.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void addIndex(IndexFigure indexFigure, String name, boolean isFirst) {
    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 0, 0, 19)));
    image.setImage(Activator.getImage(ImageKey.BLANK_WHITE));
    image.setOpaque(true);
    indexFigure.add(image);

    final StringBuilder text = new StringBuilder();
    text.append(name);
    final Label label = createColumnLabel();
    label.setBorder(new MarginBorder(new Insets(1, 0, 0, 4)));
    label.setForegroundColor(ColorConstants.black);
    label.setText(text.toString());

    indexFigure.add(label);
}
 
Example #5
Source File: StartSignalEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #6
Source File: RoundDetailsPart.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private void createRoundArrow ( final Figure figure )
{
    final PolylineConnection c = new PolylineConnection ();
    c.setSourceAnchor ( new ChopboxAnchor ( this.sourceRect ) );
    c.setTargetAnchor ( new ChopboxAnchor ( this.targetRect ) );

    final PolygonDecoration dec = new PolygonDecoration ();
    dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
    c.setTargetDecoration ( dec );

    final MidpointLocator typeLocator = new MidpointLocator ( c, 0 );
    typeLocator.setRelativePosition ( PositionConstants.NORTH );
    this.typeLabel = new Label ( "" ); //$NON-NLS-1$
    c.add ( this.typeLabel, typeLocator );

    figure.add ( c );
    this.roundConnection = c;
}
 
Example #7
Source File: StartTimerEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #8
Source File: ANDGatewayLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #9
Source File: EventFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public EventFigure(ITimelineEvent event) {

		final ToolbarLayout layout = new ToolbarLayout(false);
		layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
		layout.setStretchMinorAxis(true);
		setLayoutManager(layout);
		setLayoutManager(new CenterLayout());

		setLineWidth(2);

		fLabel = new Label(event.getTitle());
		fLabel.setForegroundColor(ColorConstants.black);
		add(fLabel);

		if (event.getMessage() != null)
			setToolTip(new EventTooltip(event.getMessage()));
	}
 
Example #10
Source File: StartEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #11
Source File: XYGraph.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @param axesFactory
 *            The {@link IAxesFactory} to use to create the primary axes for
 *            the graph. Should not be {@code null}
 */
public XYGraph(IAxesFactory axesFactory) {
	setOpaque(!transparent);
	legendMap = new LinkedHashMap<Axis, Legend>();
	titleLabel = new Label();
	String sysFontName = Display.getCurrent().getSystemFont().getFontData()[0].getName();
	setTitleFont(XYGraphMediaFactory.getInstance().getFont(new FontData(sysFontName, 12, SWT.BOLD)));
	setFont(Display.getCurrent().getSystemFont());
	// titleLabel.setVisible(false);
	xAxisList = new ArrayList<>();
	yAxisList = new ArrayList<>();
	plotArea = createPlotArea(this);
	getPlotArea().setOpaque(!transparent);

	add(titleLabel);
	add(plotArea);
	primaryYAxis = axesFactory.createYAxis();
	addAxis(primaryYAxis);

	primaryXAxis = axesFactory.createXAxis();
	addAxis(primaryXAxis);

	operationsManager = new OperationsManager();
}
 
Example #12
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 #13
Source File: EndTerminatedEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #14
Source File: PMClassFigure.java    From JDeodorant with MIT License 6 votes vote down vote up
public PMClassFigure(String name, int numOfAttributes, int numOfMethods){
	this.numOfAttributes = numOfAttributes;
	this.numOfMethods= numOfMethods;
	this.name = name;
	Label classLabel = new Label(name , DecorationConstants.CLASS);
	Label infoLabel = new Label(" Number Of Methods: "+ numOfMethods + "\n Number Of Attributes: "+ numOfAttributes);
	originalTooltip.setLayoutManager(new ToolbarLayout());
	originalTooltip.add(classLabel);
	originalTooltip.add(infoLabel);
	setToolTip(originalTooltip);
	
	originalBorder.setColor(originalColor);
	setBorder(originalBorder);
	
	setBackgroundColor(originalColor);
}
 
Example #15
Source File: ProcessFigure.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void initializeFigure() {
	String tooltip = null;
	if (node.process instanceof ProcessDescriptor) {
		ProcessDescriptor d = (ProcessDescriptor) node.process;
		tooltip = Labels.of(d.processType)
				+ ": " + node.getName();
	} else {
		tooltip = M.ProductSystem + ": " + node.getName();
	}
	setToolTip(new Label(tooltip));
	setForegroundColor(TEXT_COLOR);
	setBounds(new Rectangle(0, 0, 0, 0));
	setSize(calculateSize());
	GridLayout layout = new GridLayout(1, true);
	layout.horizontalSpacing = 10;
	layout.verticalSpacing = 0;
	layout.marginHeight = MARGIN_HEIGHT;
	layout.marginWidth = MARGIN_WIDTH;
	setLayoutManager(layout);
	paintBorder();
}
 
Example #16
Source File: IntermediateErrorCatchEventLabel5EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	EObject obj = resolveSemanticElement();
	if (obj != null && obj instanceof ThrowLinkEvent) {
		if (((ThrowLinkEvent) obj).getTo() != null) {
			text = ((ThrowLinkEvent) obj).getTo().getName();
			if (text == null) {
				text = "";
			}
		} else {
			text = "";
		}
	}
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #17
Source File: EndMessageEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
	if (figure instanceof WrappingLabel) {
		return ((WrappingLabel) figure).getIcon();
	} else if (figure instanceof Label) {
		return ((Label) figure).getIcon();
	} else {
		return getLabelDelegate().getIcon(0);
	}
}
 
Example #18
Source File: StartMessageEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
	if (figure instanceof WrappingLabel) {
		return ((WrappingLabel) figure).getText();
	} else if (figure instanceof Label) {
		return ((Label) figure).getText();
	} else {
		return getLabelDelegate().getText();
	}
}
 
Example #19
Source File: RelationEditPart.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    final ERDiagramConnection connection = createERDiagramConnection();

    final ConnectionEndpointLocator targetLocator = new ConnectionEndpointLocator(connection, true);
    targetLabel = new Label("");
    connection.add(targetLabel, targetLocator);

    return connection;
}
 
Example #20
Source File: BoundarySignalEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void setLabelIconHelper(IFigure figure, Image icon) {
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setIcon(icon);
		return;
	} else if (figure instanceof Label) {
		((Label) figure).setIcon(icon);
		return;
	} else {
		getLabelDelegate().setIcon(icon, 0);
	}
}
 
Example #21
Source File: LaneNameEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else {
		((Label) figure).setText(text);
	}
}
 
Example #22
Source File: FieldNameType2EditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else if (figure instanceof Label) {
		((Label) figure).setText(text);
	} else {
		getLabelDelegate().setText(text);
	}
}
 
Example #23
Source File: CallActivityName2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void setLabelIconHelper(IFigure figure, Image icon) {
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setIcon(icon);
		return;
	} else if (figure instanceof Label) {
		((Label) figure).setIcon(icon);
		return;
	} else {
		getLabelDelegate().setIcon(icon, 0);
	}
}
 
Example #24
Source File: FunnyStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public void initTitleBar(Figure top) {
    top.setLayoutManager(new BorderLayout());

    final FlowLayout layout = new FlowLayout();
    layout.setStretchMinorAxis(true);
    final Figure title = new Figure();
    top.add(title, BorderLayout.TOP);
    title.setLayoutManager(layout);

    title.setBorder(new MarginBorder(new Insets(2, 2, 2, 2)));

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 0, 0, 0)));
    image.setImage(Activator.getImage(getTableFigure().getImageKey()));
    title.add(image);

    this.nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(0, 0, 0, 20)));
    title.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(ColorConstants.black);
    separater.setOpaque(true);

    top.add(separater, BorderLayout.BOTTOM);
}
 
Example #25
Source File: StartSignalEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
	if (figure instanceof WrappingLabel) {
		return ((WrappingLabel) figure).getText();
	} else if (figure instanceof Label) {
		return ((Label) figure).getText();
	} else {
		return getLabelDelegate().getText();
	}
}
 
Example #26
Source File: LanguageNameEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setText(text);
	} else if (figure instanceof Label) {
		((Label) figure).setText(text);
	} else {
		getLabelDelegate().setText(text);
	}
}
 
Example #27
Source File: CrossflowTextNonResizableEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshSelectionFeedback() {
	if (selectionFeedbackFigure != null) {
		if (selectionFeedbackFigure instanceof Label) {
			updateLabel((Label) selectionFeedbackFigure);
			selectionFeedbackFigure.setBounds(getFeedbackBounds());
		} else {
			selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
		}
	}
}
 
Example #28
Source File: ActivityNameEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void setLabelIconHelper(IFigure figure, Image icon) {
	if (figure instanceof WrappingLabel) {
		((WrappingLabel) figure).setIcon(icon);
		return;
	} else if (figure instanceof Label) {
		((Label) figure).setIcon(icon);
		return;
	} else {
		getLabelDelegate().setIcon(icon, 0);
	}
}
 
Example #29
Source File: SendTaskLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
	if (figure instanceof WrappingLabel) {
		return ((WrappingLabel) figure).getText();
	} else if (figure instanceof Label) {
		return ((Label) figure).getText();
	} else {
		return getLabelDelegate().getText();
	}
}
 
Example #30
Source File: CsvSinkNameEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
	if (figure instanceof WrappingLabel) {
		return ((WrappingLabel) figure).getIcon();
	} else if (figure instanceof Label) {
		return ((Label) figure).getIcon();
	} else {
		return getLabelDelegate().getIcon(0);
	}
}