本文整理汇总了Java中org.eclipse.graphiti.services.IGaService.createText方法的典型用法代码示例。如果您正苦于以下问题:Java IGaService.createText方法的具体用法?Java IGaService.createText怎么用?Java IGaService.createText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.graphiti.services.IGaService
的用法示例。
在下文中一共展示了IGaService.createText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
public PictogramElement add(IAddContext context) {
CloudEnvironment provider = (CloudEnvironment)context.getNewObject();
Diagram targetDiagram = (Diagram) context.getTargetContainer();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
IGaService gaService = Graphiti.getGaService();
ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);
RoundedRectangle roundedRectangle = gaService.createRoundedRectangle(containerShape, 5, 5);
gaService.setLocationAndSize(roundedRectangle, context.getX(), context.getY(), context.getWidth(), context.getHeight());
roundedRectangle.setBackground(gaService.manageColor(targetDiagram, BACKGROUND));
// roundedRectangle.setStyle(StyleUtil.getStyleForCloudProvider(targetDiagram));
Shape shape = peCreateService.createShape(containerShape, false);
Text text = gaService.createText(shape, provider.getName()==null ? "Name missing":provider.getName());
text.setForeground(gaService.manageColor(targetDiagram, TEXT));
text.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
gaService.setLocationAndSize(text, 5, 5, context.getWidth()-10, 20);
peCreateService.createChopboxAnchor(containerShape);
// TODO: enable the link to the domain object
link(containerShape, provider);
// Using PROVIDER layout
layoutPictogramElement(containerShape);
return containerShape;
}
示例2: addName
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
protected void addName(Node node, ContainerShape root, int x, int y, int w, int h){
// Get Graphiti services for easier access
IPeService peService = Graphiti.getPeService();
IGaService gaService = Graphiti.getGaService();
Shape shape = peService.createShape(root, false);
PatternUtil.addShapeID(shape, "node_name");
Text textName = gaService.createText(shape, getTitle(node));
textName.setForeground(getColorText(node));
textName.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
gaService.setLocationAndSize(textName, x, y, w, h);
}
示例3: addName
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
@Override
protected void addName(Node node, ContainerShape root, int x, int y, int w, int h){
// Get Graphiti services for easier access
IPeService peService = Graphiti.getPeService();
IGaService gaService = Graphiti.getGaService();
Shape shape = peService.createShape(root, false);
PatternUtil.addShapeID(shape, "node_name");
Text textName = gaService.createText(shape, node.getName());
textName.setForeground(getColorText(node));
textName.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
textName.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
gaService.setLocationAndSize(textName, x, y, w, h);
}
示例4: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
public PictogramElement add(IAddContext context) {
OperationInterfaceContainer oic = (OperationInterfaceContainer)context.getNewObject();
ContainerShape parentShape = context.getTargetContainer();
Diagram diagram = Graphiti.getPeService().getDiagramForPictogramElement(parentShape);
IPeCreateService peCreateService = Graphiti.getPeCreateService();
IGaService gaService = Graphiti.getGaService();
ContainerShape containerShape = peCreateService.createContainerShape(parentShape, true);
RoundedRectangle roundedRectangle = gaService.createRoundedRectangle(containerShape, 5, 5);
gaService.setLocationAndSize(roundedRectangle, context.getX(), context.getY(),
Math.max(context.getWidth(),40), Math.max(context.getHeight(),20));
if (oic instanceof ProvidedService){
roundedRectangle.setBackground(gaService.manageColor(diagram, BACKGROUND_DS_PLATFORM_SERVICE));
}
else {
roundedRectangle.setBackground(gaService.manageColor(diagram, BACKGROUND_ES_PLATFORM_SERVICE));
}
roundedRectangle.setLineVisible(true);
roundedRectangle.setLineWidth(1);
roundedRectangle.setForeground(gaService.manageColor(diagram, new ColorConstant("000000")));
// TEXT
{
Shape shape = peCreateService.createShape(containerShape, false);
Text text = gaService.createText(shape, oic.getName());
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
if(oic instanceof ProvidedService){
text.setForeground(gaService.manageColor(diagram, TEXT_ES_PLATFORM_SERVICE));
}
else{
text.setForeground(gaService.manageColor(diagram, TEXT_DS_PLATFORM_SERVICE));
}
/*
if (platformService instanceof ProvidedPlatformRuntimeService){
text.setForeground(gaService.manageColor(diagram, TEXT_ER_PLATFORM_SERVICE));
}
else if (platformService instanceof ProvidedPlatformSupportService){
text.setForeground(gaService.manageColor(diagram, TEXT_ES_PLATFORM_SERVICE));
}
else if (platformService instanceof PlatformRuntimeService){
text.setForeground(gaService.manageColor(diagram, TEXT_DR_PLATFORM_SERVICE));
}
else if (platformService instanceof PlatformSupportService){
text.setForeground(gaService.manageColor(diagram, TEXT_DS_PLATFORM_SERVICE));
}
*/
gaService.setLocationAndSize(text, 0, 0, context.getWidth(), context.getHeight());
// create link and wire it
// link(shape, oic);
// provide information to support direct-editing directly
// after object creation (must be activated additionally)
final IDirectEditingInfo directEditingInfo = getFeatureProvider().getDirectEditingInfo();
// set container shape for direct editing after object creation
directEditingInfo.setMainPictogramElement(containerShape);
// set shape and graphics algorithm where the editor for
// direct editing shall be opened after object creation
directEditingInfo.setPictogramElement(shape);
directEditingInfo.setGraphicsAlgorithm(text);
}
peCreateService.createChopboxAnchor(containerShape);
// TODO: enable the link to the domain object
link(containerShape, oic);
layoutPictogramElement(containerShape);
return containerShape;
}
示例5: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
public PictogramElement add(IAddContext context) {
// Get information from context
SoftwareServiceContainer softwareServiceContainer = (SoftwareServiceContainer) context.getNewObject();
ContainerShape parentShape = context.getTargetContainer();
Diagram diagram = Graphiti.getPeService().getDiagramForPictogramElement(parentShape);
// Get Graphiti services for easier access
IPeService peService = Graphiti.getPeService();
IGaService gaService = Graphiti.getGaService();
// Create a application server/service
ContainerShape containerShape = peService.createContainerShape(parentShape, true);
RoundedRectangle rectangle = gaService.createRoundedRectangle(containerShape, 5,5);
gaService.setLocationAndSize(rectangle, context.getX(), context.getY(), context.getWidth(), context.getHeight());
rectangle.setBackground(manageColor(BACKGROUND_APPSERVER));
if (softwareServiceContainer instanceof PlatformRuntimeService){
rectangle.setBackground(gaService.manageColor(diagram, BACKGROUND_DR_PLATFORM_SERVICE));
}
else {
rectangle.setBackground(gaService.manageColor(diagram, BACKGROUND_ER_PLATFORM_SERVICE));
}
peService.createChopboxAnchor(containerShape);
link(containerShape, softwareServiceContainer);
// Add the name on top
Shape containerName = peService.createShape(containerShape, false);
Text libraryNameText = gaService.createText(containerName);
libraryNameText.setForeground(manageColor(TEXT_APPSERVER));
libraryNameText.setValue(softwareServiceContainer.getName());
// RuntimeContainer
ContainerShape runtimeContainer = peService.createContainerShape(containerShape, false);
Rectangle rowRectangle = gaService.createRectangle(runtimeContainer);
rowRectangle.setBackground(manageColor(BACKGROUND_CONTAINER));
//link (runtimeContainer, appServer.getRuntimeContainer());
// Modules
for (SoftwareService dAppService : softwareServiceContainer.getSoftwareServices()) {
Shape moduleNameShape = peService.createShape(runtimeContainer, true);
Rectangle r = Graphiti.getGaService().createRectangle(moduleNameShape);
r.setBackground(manageColor(BACKGROUND_APPSERVER));
Text moduleNameTxt = gaService.createText(moduleNameShape);
moduleNameTxt.setForeground(manageColor(TEXT_CONTAINER));
moduleNameTxt.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
moduleNameTxt.setLineVisible(true);
moduleNameTxt.setValue(dAppService.getName());
moduleNameTxt.setFilled(true);
moduleNameTxt.setBackground(manageColor(new ColorConstant("FFFFFF")));
moduleNameTxt.setTransparency(0.1);
peService.createChopboxAnchor(moduleNameShape);
link(moduleNameShape, dAppService);
}
// Using TITLE-CONTAINER(grid layout) layout
layoutPictogramElement(containerShape);
return containerShape;
}