summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-07-11 09:40:48 (EDT)
committer Manik Kishore2012-07-19 02:19:45 (EDT)
commit701b85570ab92625b8ab453bb5f9aa38b734009b (patch)
tree2fb1f8b96179cd4929be04f289df9891fdcaf10d
parentfb221815c607f7a116f899ae6d4f1e602c244c66 (diff)
downloadorg.eclipse.stardust.ui.web-701b85570ab92625b8ab453bb5f9aa38b734009b.zip
org.eclipse.stardust.ui.web-701b85570ab92625b8ab453bb5f9aa38b734009b.tar.gz
org.eclipse.stardust.ui.web-701b85570ab92625b8ab453bb5f9aa38b734009b.tar.bz2
Jira-ID: CRNT-25415
1)Added code to delete symbols in ActivityCommandHandler.java and GatewayCommandHandler.java 2)Added method in m_command.js createRemoveNodeSymbolCommand() and used in m_symbol.js remove method. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@57587 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/CommandHandlingMediator.java6
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java37
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java4
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java28
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js2
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_command.js3
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js4
7 files changed, 80 insertions, 4 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/CommandHandlingMediator.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/CommandHandlingMediator.java
index 1ec6afd..eaab6ac 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/CommandHandlingMediator.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/CommandHandlingMediator.java
@@ -43,15 +43,15 @@ public class CommandHandlingMediator
{
handler = new MoveNodeSymbolHandler();
}
- if ("activitySymbol.create".equals(commandId))
+ if ("activitySymbol.create".equals(commandId) || "activitySymbol.delete".equals(commandId))
{
handler = new ActivityCommandHandler();
}
- if ("eventSymbol.create".equals(commandId))
+ if ("eventSymbol.create".equals(commandId) || "eventSymbol.delete".equals(commandId))
{
handler = new EventCommandHandler();
}
- if ("gateSymbol.create".equals(commandId))
+ if ("gateSymbol.create".equals(commandId) || "gateSymbol.delete".equals(commandId))
{
handler = new GatewayCommandHandler();
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
index 3b498ea..eee200a 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
@@ -46,8 +46,19 @@ public class ActivityCommandHandler implements ICommandHandler
{
createActivity(parentLaneSymbol, model, processDefinition, request);
}
+ else if ("activitySymbol.delete".equals(commandId))
+ {
+ deleteActivity(parentLaneSymbol, model, processDefinition, request);
+ }
}
+ /**
+ *
+ * @param parentLaneSymbol
+ * @param model
+ * @param processDefinition
+ * @param request
+ */
private void createActivity(LaneSymbol parentLaneSymbol, ModelType model, ProcessDefinitionType processDefinition,
JsonObject request)
{
@@ -82,5 +93,31 @@ public class ActivityCommandHandler implements ICommandHandler
xProperty, yProperty, widthProperty, heightProperty, maxOid, activity);
}
}
+
+ /**
+ *
+ * @param parentLaneSymbol
+ * @param model
+ * @param processDefinition
+ * @param request
+ */
+ private void deleteActivity(LaneSymbol parentLaneSymbol, ModelType model, ProcessDefinitionType processDefinition,
+ JsonObject request)
+ {
+ String activityId = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY, ModelerConstants.ID_PROPERTY);
+ ActivityType activity = MBFacade.findActivity(processDefinition, activityId);
+ ActivitySymbolType activitySymbol = activity.getActivitySymbols().get(0);
+
+ synchronized (model)
+ {
+
+ processDefinition.getActivity().remove(activity);
+ processDefinition.getDiagram().get(0).getActivitySymbol().remove(activitySymbol);
+
+ parentLaneSymbol.getActivitySymbol().remove(activitySymbol);
+
+ }
+
+ }
}
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
index c64f90f..b20b16f 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
@@ -43,6 +43,10 @@ public class EventCommandHandler implements ICommandHandler
{
createEvent(targetElement, request);
}
+ else if ("eventSymbol.delete".equals(commandId))
+ {
+ //TODO : add impl code
+ }
}
private void createEvent(IModelElement targetElement, JsonObject request)
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
index 04d1351..13f7cb3 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
@@ -12,6 +12,7 @@ import static org.eclipse.stardust.ui.web.modeler.service.ModelService.X_PROPERT
import static org.eclipse.stardust.ui.web.modeler.service.ModelService.Y_PROPERTY;
import org.eclipse.stardust.model.xpdl.builder.common.AbstractElementBuilder;
+import org.eclipse.stardust.model.xpdl.builder.utils.MBFacade;
import org.eclipse.stardust.model.xpdl.builder.utils.ModelerConstants;
import org.eclipse.stardust.model.xpdl.builder.utils.XpdlModelUtils;
import org.eclipse.stardust.model.xpdl.carnot.ActivitySymbolType;
@@ -44,6 +45,10 @@ public class GatewayCommandHandler implements ICommandHandler
{
createGateway(parentLaneSymbol, model, processDefinition, request);
}
+ if ("gateSymbol.delete".equals(commandId))
+ {
+ deleteGateway(parentLaneSymbol, model, processDefinition, request);
+ }
}
private void createGateway(LaneSymbol parentLaneSymbol, ModelType model, ProcessDefinitionType processDefinition,
@@ -76,5 +81,28 @@ public class GatewayCommandHandler implements ICommandHandler
parentLaneSymbol.getActivitySymbol().add(gatewaySymbol);
}
}
+
+ /**
+ *
+ * @param parentLaneSymbol
+ * @param model
+ * @param processDefinition
+ * @param request
+ */
+ private void deleteGateway(LaneSymbol parentLaneSymbol, ModelType model, ProcessDefinitionType processDefinition,
+ JsonObject request)
+ {
+ String gatewayId = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY, ModelerConstants.ID_PROPERTY);
+ ActivityType gateway = MBFacade.findActivity(processDefinition, gatewayId);
+ ActivitySymbolType gatewaySymbol = gateway.getActivitySymbols().get(0);
+ synchronized (model)
+ {
+ processDefinition.getActivity().remove(gateway);
+ processDefinition.getDiagram().get(0).getActivitySymbol().remove(gatewaySymbol);
+
+ parentLaneSymbol.getActivitySymbol().remove(gatewaySymbol);
+
+ }
+ }
}
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js
index f3e0d9f..c9f1304 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js
@@ -524,7 +524,7 @@ define(
*
*/
function ActivitySymbol_removeClosure() {
- this.auxiliaryProperties.callbackScope.submitDeletion();
+ this.auxiliaryProperties.callbackScope.remove();
}
/**
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_command.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_command.js
index 7f1a9c3..3f7dec1 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_command.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_command.js
@@ -50,6 +50,9 @@ define([ "m_utils", "m_constants", "m_user" ], function(m_utils, m_constants, m_
createNodeSymbolCommand : function(commandType, baseUri, targetElement, newObject, context) {
return new ChangeDescriptor(commandType, [{oid: targetElement.oid, changes: newObject}], context);
},
+ createRemoveNodeSymbolCommand : function(commandType, baseUri, targetElement, newObject, context) {
+ return new ChangeDescriptor(commandType, [{oid: targetElement.oid, changes: newObject}], context);
+ },
// TODO Might be simple Request causing command to be broadcasted
createRequestJoinCommand : function(prospect) {
return new ChangeEvent(m_constants.REQUEST_JOIN_COMMAND, "/users", "requestJoin", null, prospect);
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
index 6e0ff24..8afbd03 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
@@ -1178,6 +1178,10 @@ define(
m_utils.removeItemFromArray(
this.parentSymbol.containedSymbols, this);
m_utils.removeItemFromArray(this.diagram.symbols, this);
+
+ var command = m_command.createRemoveNodeSymbolCommand(this.commandType("delete"), this.getPath(true),
+ {oid : this.parentSymbol.oid}, this.createTransferObject(), this);
+ m_commandsController.submitCommand(command);
};