本文整理汇总了Java中org.eclipse.graphiti.mm.algorithms.styles.Font类的典型用法代码示例。如果您正苦于以下问题:Java Font类的具体用法?Java Font怎么用?Java Font使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Font类属于org.eclipse.graphiti.mm.algorithms.styles包,在下文中一共展示了Font类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.eclipse.graphiti.mm.algorithms.styles.Font; //导入依赖的package包/类
@Override
public PictogramElement add(final IAddContext context) {
Object _newObject = context.getNewObject();
final State addedState = ((State) _newObject);
ContainerShape _targetContainer = context.getTargetContainer();
final Diagram targetDiagram = ((Diagram) _targetContainer);
int _xifexpression = (int) 0;
int _width = context.getWidth();
boolean _lessEqualsThan = (_width <= 0);
if (_lessEqualsThan) {
_xifexpression = 40;
} else {
int _width_1 = context.getWidth();
_xifexpression = Math.max(_width_1, 20);
}
final int width = _xifexpression;
int _xifexpression_1 = (int) 0;
int _height = context.getHeight();
boolean _lessEqualsThan_1 = (_height <= 0);
if (_lessEqualsThan_1) {
_xifexpression_1 = 40;
} else {
int _height_1 = context.getHeight();
_xifexpression_1 = Math.max(_height_1, 20);
}
final int height = _xifexpression_1;
final ContainerShape containerShape = this._iPeCreateService.createContainerShape(targetDiagram, true);
this._iPeCreateService.createChopboxAnchor(containerShape);
final Rectangle rectangle = this._iGaService.createRectangle(containerShape);
Color _manageColor = this.manageColor(IColorConstant.BLACK);
rectangle.setForeground(_manageColor);
Color _manageColor_1 = this.manageColor(IColorConstant.LIGHT_LIGHT_GRAY);
rectangle.setBackground(_manageColor_1);
int _x = context.getX();
int _y = context.getY();
this._iGaService.setLocationAndSize(rectangle, _x, _y, width, height);
this.link(containerShape, addedState);
final Shape textShape = this._iPeCreateService.createShape(containerShape, false);
String _name = addedState.getName();
final Text text = this._iGaService.createText(textShape, _name);
Color _manageColor_2 = this.manageColor(IColorConstant.BLACK);
text.setForeground(_manageColor_2);
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
Diagram _diagram = this.getDiagram();
Font _manageFont = this.manageFont(_diagram, "Arial", 12);
text.setFont(_manageFont);
this.link(textShape, addedState);
IFeatureProvider _featureProvider = this.getFeatureProvider();
final IDirectEditingInfo directEditingInfo = _featureProvider.getDirectEditingInfo();
directEditingInfo.setMainPictogramElement(containerShape);
directEditingInfo.setPictogramElement(textShape);
directEditingInfo.setGraphicsAlgorithm(text);
this.layoutPictogramElement(containerShape);
return containerShape;
}
示例2: ColoredFont
import org.eclipse.graphiti.mm.algorithms.styles.Font; //导入依赖的package包/类
/**
* Instantiates a new colored font.
*
* @param font
* the font
* @param color
* the color
*/
public ColoredFont(Font font, Color color) {
super();
setFont(font);
setColor(color);
}
示例3: getFont
import org.eclipse.graphiti.mm.algorithms.styles.Font; //导入依赖的package包/类
/**
* Gets the font.
*
* @return Returns the font.
*/
public Font getFont() {
return font;
}
示例4: setFont
import org.eclipse.graphiti.mm.algorithms.styles.Font; //导入依赖的package包/类
/**
* Sets the font.
*
* @param font
* The font to set.
*/
public void setFont(Font font) {
this.font = font;
}