001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.bpel.design.model.patterns;
020:
021: import org.netbeans.modules.bpel.design.model.DiagramModel;
022: import org.netbeans.modules.bpel.design.model.elements.ContentElement;
023: import org.netbeans.modules.bpel.design.model.elements.ProcessBorder;
024: import org.netbeans.modules.bpel.design.model.elements.VisualElement;
025: import org.netbeans.modules.bpel.design.model.elements.icons.ANDIcon2D;
026: import org.netbeans.modules.bpel.design.model.elements.icons.CatchAllIcon2D;
027: import org.netbeans.modules.bpel.design.model.elements.icons.CatchIcon2D;
028: import org.netbeans.modules.bpel.design.model.elements.icons.CompensateIcon2D;
029: import org.netbeans.modules.bpel.design.model.elements.icons.EventIcon2D;
030: import org.netbeans.modules.bpel.design.model.elements.icons.ForEachIcon2D;
031: import org.netbeans.modules.bpel.design.model.elements.icons.Icon2D;
032: import org.netbeans.modules.bpel.design.model.elements.icons.InvokeIcon2D;
033: import org.netbeans.modules.bpel.design.model.elements.icons.MessageIcon2D;
034: import org.netbeans.modules.bpel.design.model.elements.icons.RepeatUntilIcon2D;
035: import org.netbeans.modules.bpel.design.model.elements.icons.ScopeIcon2D;
036: import org.netbeans.modules.bpel.design.model.elements.icons.SequenceIcon2D;
037: import org.netbeans.modules.bpel.design.model.elements.icons.TerminationIcon2D;
038: import org.netbeans.modules.bpel.design.model.elements.icons.TimerIcon2D;
039: import org.netbeans.modules.bpel.design.model.elements.icons.WhileIcon2D;
040: import org.netbeans.modules.bpel.design.model.elements.icons.XORIcon2D;
041: import org.netbeans.modules.bpel.design.model.elements.icons.XORSmallIcon2D;
042: import org.netbeans.modules.bpel.model.api.BpelEntity;
043: import org.netbeans.modules.bpel.model.api.Catch;
044: import org.netbeans.modules.bpel.model.api.CatchAll;
045: import org.netbeans.modules.bpel.model.api.CompensationHandler;
046: import org.netbeans.modules.bpel.model.api.ElseIf;
047: import org.netbeans.modules.bpel.model.api.EventHandlers;
048: import org.netbeans.modules.bpel.model.api.FaultHandlers;
049: import org.netbeans.modules.bpel.model.api.Flow;
050: import org.netbeans.modules.bpel.model.api.ForEach;
051: import org.netbeans.modules.bpel.model.api.If;
052: import org.netbeans.modules.bpel.model.api.Invoke;
053: import org.netbeans.modules.bpel.model.api.NamedElement;
054: import org.netbeans.modules.bpel.model.api.OnAlarmEvent;
055: import org.netbeans.modules.bpel.model.api.OnAlarmPick;
056: import org.netbeans.modules.bpel.model.api.OnMessageCommon;
057: import org.netbeans.modules.bpel.model.api.PartnerLink;
058: import org.netbeans.modules.bpel.model.api.Pick;
059: import org.netbeans.modules.bpel.model.api.RepeatUntil;
060: import org.netbeans.modules.bpel.model.api.Scope;
061: import org.netbeans.modules.bpel.model.api.Sequence;
062: import org.netbeans.modules.bpel.model.api.TerminationHandler;
063: import org.netbeans.modules.bpel.model.api.While;
064:
065: /**
066: *
067: * @author anjeleevich
068: */
069: public class CollapsedPattern extends BasicActivityPattern {
070:
071: /** Creates a new instance of CollapsedPattern */
072: public CollapsedPattern(DiagramModel model) {
073: super (model);
074: }
075:
076: protected void createElementsImpl() {
077: BpelEntity bpelEntity = getOMReference();
078:
079: VisualElement element;
080:
081: Icon2D icon = null;
082:
083: BpelEntity entity = getOMReference();
084:
085: if (entity instanceof Pick) {
086: icon = EventIcon2D.INSTANCE;
087: } else if (entity instanceof Flow) {
088: icon = ANDIcon2D.INSTANCE;
089: } else if (entity instanceof If) {
090: icon = XORIcon2D.INSTANCE;
091: } else if (entity instanceof ElseIf) {
092: icon = XORSmallIcon2D.INSTANCE;
093: } else if (entity instanceof While) {
094: icon = WhileIcon2D.INSTANCE;
095: } else if (entity instanceof RepeatUntil) {
096: icon = RepeatUntilIcon2D.INSTANCE;
097: } else if (entity instanceof ForEach) {
098: icon = ForEachIcon2D.INSTANCE;
099: } else if (entity instanceof Invoke) {
100: icon = InvokeIcon2D.INSTANCE;
101: } else if (entity instanceof Sequence) {
102: icon = SequenceIcon2D.INSTANCE;
103: } else if (entity instanceof Scope) {
104: icon = ScopeIcon2D.INSTANCE;
105: } else if (entity instanceof OnMessageCommon) {
106: icon = MessageIcon2D.INSTANCE;
107: } else if (entity instanceof OnAlarmPick) {
108: icon = TimerIcon2D.INSTANCE;
109: } else if (entity instanceof OnAlarmEvent) {
110: icon = TimerIcon2D.INSTANCE;
111: } else if (entity instanceof Catch) {
112: icon = CatchIcon2D.INSTANCE;
113: } else if (entity instanceof CatchAll) {
114: icon = CatchAllIcon2D.INSTANCE;
115: } else if (entity instanceof CompensationHandler) {
116: icon = CompensateIcon2D.INSTANCE;
117: } else if (entity instanceof TerminationHandler) {
118: icon = TerminationIcon2D.INSTANCE;
119: } else if (entity instanceof FaultHandlers) {
120: icon = CatchAllIcon2D.INSTANCE;
121: } else if (entity instanceof EventHandlers) {
122: icon = MessageIcon2D.INSTANCE;
123: }
124:
125: element = new ContentElement(ContentElement.COLLAPSED_SHAPE,
126: icon);
127:
128: appendElement(element);
129:
130: if (bpelEntity instanceof NamedElement) {
131: registerTextElement(element);
132: }
133: }
134: }
|