本文整理汇总了Java中org.eclipse.graphiti.mm.pictograms.PictogramElement类的典型用法代码示例。如果您正苦于以下问题:Java PictogramElement类的具体用法?Java PictogramElement怎么用?Java PictogramElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PictogramElement类属于org.eclipse.graphiti.mm.pictograms包,在下文中一共展示了PictogramElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: add
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
final IAddConnectionContext addConContext = (IAddConnectionContext) context;
final Link addedConnection = (Link) context.getNewObject();
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final IGaService gaService = Graphiti.getGaService();
// Create the connection
final FreeFormConnection connection = peCreateService.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
// Create the line corresponding to the connection
final Polyline polyline = gaService.createPolyline(connection);
// final ConnectionDecorator cd =
// peCreateService.createConnectionDecorator(connection, false, 1.0,
// true);
// Draw the arrow on the target side of the connection
// Setup styles
polyline.setStyle(StyleUtils.linkShape(getDiagram()));
// create link and wire it
link(connection, addedConnection);
return connection;
}
开发者ID:turnus,项目名称:turnus,代码行数:27,代码来源:LinkPattern.java
示例2: update
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
final PictogramElement pe = context.getPictogramElement();
if (PropertiesUtils.isExpectedPc(pe, Medium.class)) {
final Text text = (Text) PropertiesUtils.findPcFromIdentifier(pe, LABEL_ID);
if (text == null) {
return false;
}
final Medium medium = (Medium) getBusinessObjectForPictogramElement(pe);
if (!medium.getName().equals(text.getValue())) {
text.setValue(medium.getName());
// Do not force refinement update in case of simply renaming
return true;
}
return true;
}
return super.update(context);
}
开发者ID:turnus,项目名称:turnus,代码行数:23,代码来源:MediumPattern.java
示例3: update
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
final PictogramElement pe = context.getPictogramElement();
if (PropertiesUtils.isExpectedPc(pe, type)) {
final Text text = (Text) PropertiesUtils.findPcFromIdentifier(pe, LABEL_ID);
if (text == null) {
return false;
}
final ProcessingUnit obj = (ProcessingUnit) getBusinessObjectForPictogramElement(pe);
if (!obj.getName().equals(text.getValue())) {
text.setValue(obj.getName());
// Do not force refinement update in case of simply renaming
return true;
}
return true;
}
return super.update(context);
}
开发者ID:turnus,项目名称:turnus,代码行数:23,代码来源:AbstractProcessingUnitPattern.java
示例4: findPcFromIdentifier
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
/**
* Search for a PictogramElement with given id as identifier. This method
* check the given pe and its corresponding GraphicsAlgorithm. If the given
* pe is a ContainerShape, children shapes are also checked.
*
* @param pe
* A PictogramElement
* @param id
* Identifier to found
* @return A PropertyContainer or null if it can't be found
*/
public static PropertyContainer findPcFromIdentifier(final PictogramElement pe, final String id) {
if (isExpectedPc(pe, id)) {
return pe;
}
final GraphicsAlgorithm ga = pe.getGraphicsAlgorithm();
if (ga != null) {
final PropertyContainer pc = findPcFromIdentifier(ga, id);
if (pc != null) {
return pc;
}
}
if (pe instanceof ContainerShape) {
for (final Shape child : ((ContainerShape) pe).getChildren()) {
final PropertyContainer foundPropertyContainer = findPcFromIdentifier(child, id);
if (foundPropertyContainer != null) {
return foundPropertyContainer;
}
}
}
return null;
}
开发者ID:turnus,项目名称:turnus,代码行数:37,代码来源:PropertiesUtils.java
示例5: getToolTip
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public Object getToolTip(GraphicsAlgorithm ga) {
PictogramElement pe = ga.getPictogramElement();
Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(pe);
if (bo instanceof Vertex) {
// For a vertex, we want to show the name of the containing relation
bo = ((Vertex) bo).getContainer();
}
if (bo instanceof NamedObj) {
String name = ((NamedObj) bo).getName();
if (name != null && !(name.length() == 0)) {
return name;
}
}
return super.getToolTip(ga);
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:17,代码来源:TriqToolBehaviorProvider.java
示例6: update
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
boolean result = false;
PictogramElement pe = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pe);
if ((pe instanceof ContainerShape) && (bo instanceof Director)) {
ContainerShape cs = (ContainerShape) pe;
Director director = (Director) bo;
for (Shape shape : cs.getChildren()) {
BoCategory boCategory = BoCategory.retrieveFrom(shape);
if (BoCategory.Director.equals(boCategory)) {
Text text = (Text) shape.getGraphicsAlgorithm();
text.setValue(director.getName());
result = true;
Graphiti.getPeService().setPropertyValue(shape, FeatureConstants.BO_NAME, director.getName());
}
}
}
return result;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:22,代码来源:DirectorUpdateFeature.java
示例7: canExecute
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public boolean canExecute(ICustomContext context) {
boolean ret = false;
PictogramElement pe = context.getInnerPictogramElement();
if (pe == null) {
PictogramElement[] pes = context.getPictogramElements();
if (pes != null && pes.length == 1) {
pe = pes[0];
}
}
// prevent double click action on actor's name's Text field
if (pe != null) {
BoCategory boCategory = BoCategory.retrieveFrom(pe);
ret = ((BoCategory.CompositeActor.equals(boCategory) || BoCategory.Actor.equals(boCategory) || BoCategory.Director.equals(boCategory) || (BoCategory.Annotation.equals(boCategory))
|| (BoCategory.Port.equals(boCategory))) && !(pe.getGraphicsAlgorithm() instanceof Text)) || BoCategory.Parameter.equals(boCategory);
}
return ret;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:19,代码来源:ModelElementConfigureFeature.java
示例8: execute
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public void execute(ICustomContext context) {
PictogramElement[] pes = context.getPictogramElements();
if (pes != null && pes.length == 1) {
Object bo = getBusinessObjectForPictogramElement(pes[0]);
if (bo instanceof NamedObj) {
NamedObj modelElement = (NamedObj) bo;
Shell shell = EclipseUtils.getActivePage().getActivePart().getSite().getShell();
NamedObjDialog dialog = new NamedObjDialog(shell, modelElement);
dialog.open();
if (dialog.getReturnCode() != Window.OK) {
throw new OperationCanceledException();
}
}
}
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:17,代码来源:ModelElementConfigureFeature.java
示例9: canExecute
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public boolean canExecute(ICustomContext context) {
boolean ret = false;
PictogramElement pe = context.getInnerPictogramElement();
if (pe == null) {
PictogramElement[] pes = context.getPictogramElements();
if (pes != null && pes.length == 1) {
pe = pes[0];
}
}
if (pe != null) {
BoCategory boCategory = BoCategory.retrieveFrom(pe);
ret = (BoCategory.Annotation.equals(boCategory));
}
return ret;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:17,代码来源:AnnotationChangeColorFeature.java
示例10: resizeShape
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public void resizeShape(IResizeShapeContext context) {
int width = context.getWidth();
int height = context.getHeight();
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
if (bo instanceof Annotation && pictogramElement instanceof Shape) {
Annotation annotation = (Annotation) bo;
Shape shape = (Shape) pictogramElement;
BoCategory boCategory = BoCategory.retrieveFrom(shape);
if (BoCategory.Annotation.equals(boCategory)) {
MultiText text = EditorUtils.getGraphicsAlgorithmOfShape(shape, MultiText.class);
if (text != null) {
text.setWidth(width - 5);
text.setHeight(height / (annotation.getTextSize() + 5));
Graphiti.getGaService().setLocationAndSize(text, 5, 0, width, height);
}
}
}
super.resizeShape(context);
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:23,代码来源:AnnotationResizeFeature.java
示例11: updateNeeded
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public IReason updateNeeded(IUpdateContext context) {
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
Port p = null;
if (bo instanceof Port && pictogramElement instanceof Anchor) {
p = (Port) bo;
Anchor anchor = (Anchor) pictogramElement;
PortCategory anchorCategory = PortCategory.retrieveFrom(anchor);
PortCategory portCategory = PortCategory.retrieveFrom(p);
boolean portDirectionChange = portCategory != anchorCategory;
// a bit more complex : check port colour and compare it to multiport property
GraphicsAlgorithm portGA = anchor.getGraphicsAlgorithm();
IColorConstant expectedPortBackgroundColor = p.isMultiPort() ? PORT_BACKGROUND_MULTIPORT : PORT_BACKGROUND_SINGLEPORT;
boolean portMultiPortChange = !portGA.getBackground().equals(manageColor(expectedPortBackgroundColor));
if (portDirectionChange || portMultiPortChange) {
context.putProperty(PORT_CHANGED, p.getName());
context.putProperty(PORT_CHANGED_IO, Boolean.toString(portDirectionChange));
context.putProperty(PORT_CHANGED_MULTI, Boolean.toString(portMultiPortChange));
return Reason.createTrueReason("Port change");
}
}
return Reason.createFalseReason();
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:27,代码来源:PortUpdateFeature.java
示例12: add
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
IAddConnectionContext addConContext = (IAddConnectionContext) context;
Relation addedRelation = (Relation) context.getNewObject();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
// CONNECTION WITH POLYLINE
Connection connection = peCreateService.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
IGaService gaService = Graphiti.getGaService();
Polyline polyline = gaService.createPolyline(connection);
polyline.setLineWidth(2);
polyline.setForeground(manageColor(CONNECTION_FOREGROUND));
// create link and wire it
link(connection, addedRelation);
return connection;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:22,代码来源:ConnectionAddFeature.java
示例13: copy
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
public void copy(ICopyContext context) {
copyX = Integer.MAX_VALUE;
copyY = Integer.MAX_VALUE;
// get the business objects for all pictogram elements
// we already verified that all business objects are FlowElements
PictogramElement[] pes = context.getPictogramElements();
Object[] bos = new Object[pes.length];
for (int i = 0; i < pes.length; i++) {
PictogramElement pe = pes[i];
copyX = Math.min(copyX, pe.getGraphicsAlgorithm().getX());
copyY = Math.min(copyY, pe.getGraphicsAlgorithm().getY());
bos[i] = getBusinessObjectForPictogramElement(pe);
}
// put all business objects to the clipboard
putToClipboard(bos);
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:CopyFlowElementFeature.java
示例14: link
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
/**
* Extends Graphiti's default linking between a pictogram element and a business object,
* by also storing extra properties to facilitate determining changes between business model and graphical model.
*
* @param pe
* @param businessObject
* @param categories
*/
protected void link(IContext context, PictogramElement pe, Object businessObject, Category... categories) {
super.link(pe, businessObject);
// add property on the graphical model element, identifying the associated triq model element
// so we can easily distinguish and identify them later on for updates etc
for (Category category : categories) {
category.storeIn(pe);
}
if (businessObject instanceof NamedObj) {
Graphiti.getPeService().setPropertyValue(pe, FeatureConstants.BO_NAME, ((NamedObj) businessObject).getName());
String iconResource = (String) context.getProperty("icon");
if(iconResource!=null) {
Graphiti.getPeService().setPropertyValue(pe, FeatureConstants.ICON, iconResource);
}
String iconType = (String) context.getProperty("iconType");
if(iconType!=null) {
Graphiti.getPeService().setPropertyValue(pe, FeatureConstants.ICON_TYPE, iconType);
}
}
Graphiti.getPeService().setPropertyValue(pe, FeatureConstants.BO_CLASS, businessObject.getClass().getName());
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:29,代码来源:ActorAddFeature.java
示例15: checkValueValid
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public String checkValueValid(String value, IDirectEditingContext context) {
PictogramElement pe = context.getPictogramElement();
NamedObj bo = (NamedObj) getBusinessObjectForPictogramElement(pe);
if (!bo.getName().equals(value)) {
if (value.length() < 1)
return "The name should be non-empty";
if (value.contains("."))
return "Dots are not allowed in names.";
if (value.contains("\n"))
return "Line breakes are not allowed in names.";
if (bo.getContainer() instanceof CompositeEntity && ((CompositeEntity) bo.getContainer()).getChild(value) != null) {
return "Duplicate name";
}
}
// null means, that the value is valid
return null;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:20,代码来源:ModelElementNameDirectEditFeature.java
示例16: getUpdateFeature
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public IUpdateFeature getUpdateFeature(IUpdateContext context) {
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
if (bo instanceof Parameter) {
return new ParameterUpdateFeature(this);
} else if (bo instanceof Port) {
return new PortUpdateFeature(this);
} else if (bo instanceof Annotation) {
return new AnnotationUpdateFeature(this);
} else if (bo instanceof Director) {
return new DirectorUpdateFeature(this);
} else if ((bo instanceof Actor) || (bo instanceof CompositeActor && !(pictogramElement instanceof Diagram))) {
return new ActorUpdateFeature(this);
}
return super.getUpdateFeature(context);
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:18,代码来源:TriqFeatureProvider.java
示例17: create
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public Connection create(final ICreateConnectionContext context) {
Anchor _sourceAnchor = context.getSourceAnchor();
AnchorContainer _parent = _sourceAnchor.getParent();
Object _businessObjectForPictogramElement = this.getBusinessObjectForPictogramElement(_parent);
final State source = ((State) _businessObjectForPictogramElement);
Anchor _targetAnchor = context.getTargetAnchor();
AnchorContainer _parent_1 = _targetAnchor.getParent();
Object _businessObjectForPictogramElement_1 = this.getBusinessObjectForPictogramElement(_parent_1);
final State target = ((State) _businessObjectForPictogramElement_1);
final Transition transition = StatemachineFactory.eINSTANCE.createTransition();
transition.setSourceState(source);
transition.setTargetState(target);
EObject _eContainer = source.eContainer();
final Statemachine statemachine = ((Statemachine) _eContainer);
EList<Transition> _transitions = statemachine.getTransitions();
_transitions.add(transition);
Anchor _sourceAnchor_1 = context.getSourceAnchor();
Anchor _targetAnchor_1 = context.getTargetAnchor();
final AddConnectionContext addContext = new AddConnectionContext(_sourceAnchor_1, _targetAnchor_1);
addContext.setNewObject(transition);
IFeatureProvider _featureProvider = this.getFeatureProvider();
PictogramElement _addIfPossible = _featureProvider.addIfPossible(addContext);
return ((Connection) _addIfPossible);
}
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:26,代码来源:CreateTransitionFeature.java
示例18: refresh
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public void refresh() {
PictogramElement pe = getSelectedPictogramElement();
if (pe != null) {
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
// the filter assured, that it is a EClass
if (bo == null)
return;
StartEvent startEvent = ((StartEvent) bo);
if(startEvent.getFormKey() != null) {
formTypeCombo.removeFocusListener(listener);
String condition = startEvent.getFormKey();
formTypeCombo.setText(condition);
formTypeCombo.addFocusListener(listener);
} else {
formTypeCombo.setText("");
}
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:PropertyAlfrescoStartEventSection.java
示例19: refresh
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public void refresh() {
PictogramElement pe = getSelectedPictogramElement();
if (pe != null) {
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (bo == null)
return;
}
for (final CustomPropertyField field : customPropertyFields) {
field.refresh();
}
// Perform validation now the fields are populated
validateFields();
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:PropertyCustomServiceTaskSection.java
示例20: refresh
import org.eclipse.graphiti.mm.pictograms.PictogramElement; //导入依赖的package包/类
@Override
public void refresh() {
actionCombo.removeFocusListener(listener);
roleCombo.removeFocusListener(listener);
buttonBox.removeFocusListener(listener);
checkCount=0;
PictogramElement pe = getSelectedPictogramElement();
if (pe != null) {
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (bo == null)
return;
Activity activity = (Activity) bo;
displayPermissions(activity);
actionCombo.addFocusListener(listener);
roleCombo.addFocusListener(listener);
buttonBox.addFocusListener(listener);
roleCombo.removeAll();
List<Role> roleList=SecurityUtil.getRoles(getDiagram());
for (int i = 0; i < roleList.size(); i++) {
roleCombo.add(roleList.get(i).getName());
}
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:PropertyRbacSection.java
注:本文中的org.eclipse.graphiti.mm.pictograms.PictogramElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论