summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-07-11 08:55:18 (EDT)
committer Manik Kishore2012-07-19 02:19:44 (EDT)
commitfb221815c607f7a116f899ae6d4f1e602c244c66 (patch)
tree67cc94b9e8d2dd98fab3e4f4632411b7138951fd
parent14e8e98a64c6e599bbef4c87324fb9b1bfcfe60c (diff)
downloadorg.eclipse.stardust.ui.web-fb221815c607f7a116f899ae6d4f1e602c244c66.zip
org.eclipse.stardust.ui.web-fb221815c607f7a116f899ae6d4f1e602c244c66.tar.gz
org.eclipse.stardust.ui.web-fb221815c607f7a116f899ae6d4f1e602c244c66.tar.bz2
Jira-ID: CRNT-25414
1)Renamed the CommandHandler classes for symbols 2)Create method commandType() in m_symbol.js to identify the command create/delete. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@57583 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/CommandHandlingMediator.java12
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java (renamed from web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateActivityCommandHandler.java)22
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java (renamed from web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateEventCommandHandler.java)10
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java (renamed from web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateGatewayCommandHandler.java)12
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js29
5 files changed, 59 insertions, 26 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 768a8c9..1ec6afd 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
@@ -15,9 +15,9 @@ import org.eclipse.stardust.model.xpdl.builder.session.Modification;
import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
import org.eclipse.stardust.model.xpdl.carnot.ModelType;
import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType;
-import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.CreateActivityCommandHandler;
-import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.CreateEventCommandHandler;
-import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.CreateGatewayCommandHandler;
+import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.ActivityCommandHandler;
+import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.EventCommandHandler;
+import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.GatewayCommandHandler;
import org.eclipse.stardust.ui.web.modeler.edit.diagram.node.MoveNodeSymbolHandler;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@@ -45,15 +45,15 @@ public class CommandHandlingMediator
}
if ("activitySymbol.create".equals(commandId))
{
- handler = new CreateActivityCommandHandler();
+ handler = new ActivityCommandHandler();
}
if ("eventSymbol.create".equals(commandId))
{
- handler = new CreateEventCommandHandler();
+ handler = new EventCommandHandler();
}
if ("gateSymbol.create".equals(commandId))
{
- handler = new CreateGatewayCommandHandler();
+ handler = new GatewayCommandHandler();
}
Modification change = null;
EObject changeRoot;
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateActivityCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
index 0a90cf2..3b498ea 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateActivityCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/ActivityCommandHandler.java
@@ -16,6 +16,7 @@ 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;
import org.eclipse.stardust.model.xpdl.carnot.ActivityType;
+import org.eclipse.stardust.model.xpdl.carnot.IIdentifiableElement;
import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
import org.eclipse.stardust.model.xpdl.carnot.LaneSymbol;
import org.eclipse.stardust.model.xpdl.carnot.ModelType;
@@ -26,13 +27,13 @@ import org.eclipse.stardust.ui.web.modeler.service.ModelService;
import com.google.gson.JsonObject;
-public class CreateActivityCommandHandler implements ICommandHandler
+public class ActivityCommandHandler implements ICommandHandler
{
@Override
public boolean isValidTarget(Class< ? > type)
{
- return LaneSymbol.class.isAssignableFrom(type);
+ return IIdentifiableElement.class.isAssignableFrom(type);
}
@Override
@@ -41,12 +42,21 @@ public class CreateActivityCommandHandler implements ICommandHandler
LaneSymbol parentLaneSymbol = (LaneSymbol) targetElement;
ModelType model = ModelUtils.findContainingModel(parentLaneSymbol);
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentLaneSymbol);
+ if ("activitySymbol.create".equals(commandId))
+ {
+ createActivity(parentLaneSymbol, model, processDefinition, request);
+ }
+ }
+
+ private void createActivity(LaneSymbol parentLaneSymbol, ModelType model, ProcessDefinitionType processDefinition,
+ JsonObject request)
+ {
+
String activityType = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY,
ModelerConstants.ACTIVITY_TYPE);
- String activityId = extractString(request,
- ModelerConstants.MODEL_ELEMENT_PROPERTY, ModelerConstants.ID_PROPERTY);
- String activityName = extractString(request,
- ModelerConstants.MODEL_ELEMENT_PROPERTY,
+ String activityId = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY, ModelerConstants.ID_PROPERTY);
+
+ String activityName = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY,
ModelerConstants.NAME_PROPERTY);
String participantFullID = extractString(request, ModelerConstants.MODEL_ELEMENT_PROPERTY,
ModelerConstants.PARTICIPANT_FULL_ID);
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateEventCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
index 9d81244..c64f90f 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateEventCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/EventCommandHandler.java
@@ -27,7 +27,7 @@ import org.eclipse.stardust.ui.web.modeler.edit.ICommandHandler;
import com.google.gson.JsonObject;
-public class CreateEventCommandHandler implements ICommandHandler
+public class EventCommandHandler implements ICommandHandler
{
@Override
@@ -39,6 +39,14 @@ public class CreateEventCommandHandler implements ICommandHandler
@Override
public void handleCommand(String commandId, IModelElement targetElement, JsonObject request)
{
+ if ("eventSymbol.create".equals(commandId))
+ {
+ createEvent(targetElement, request);
+ }
+ }
+
+ private void createEvent(IModelElement targetElement, JsonObject request)
+ {
LaneSymbol parentLaneSymbol = (LaneSymbol) targetElement;
ModelType model = ModelUtils.findContainingModel(parentLaneSymbol);
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentLaneSymbol);
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateGatewayCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
index 2e97040..04d1351 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/CreateGatewayCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/diagram/node/GatewayCommandHandler.java
@@ -25,7 +25,7 @@ import org.eclipse.stardust.ui.web.modeler.edit.ICommandHandler;
import com.google.gson.JsonObject;
-public class CreateGatewayCommandHandler implements ICommandHandler
+public class GatewayCommandHandler implements ICommandHandler
{
@Override
@@ -40,6 +40,15 @@ public class CreateGatewayCommandHandler implements ICommandHandler
LaneSymbol parentLaneSymbol = (LaneSymbol) targetElement;
ModelType model = ModelUtils.findContainingModel(parentLaneSymbol);
ProcessDefinitionType processDefinition = ModelUtils.findContainingProcess(parentLaneSymbol);
+ if ("gateSymbol.create".equals(commandId))
+ {
+ createGateway(parentLaneSymbol, model, processDefinition, request);
+ }
+ }
+
+ private void createGateway(LaneSymbol parentLaneSymbol, ModelType model, ProcessDefinitionType processDefinition,
+ JsonObject request)
+ {
synchronized (model)
{
long maxOid = XpdlModelUtils.getMaxUsedOid(model);
@@ -66,7 +75,6 @@ public class CreateGatewayCommandHandler implements ICommandHandler
processDefinition.getDiagram().get(0).getActivitySymbol().add(gatewaySymbol);
parentLaneSymbol.getActivitySymbol().add(gatewaySymbol);
}
-
}
}
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 bab473a..6e0ff24 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
@@ -222,18 +222,8 @@ define(
*/
Symbol.prototype.complete = function() {
this.completeNoTransfer(this);
- var commandType = null;
- if (this.type == m_constants.ACTIVITY_SYMBOL) {
- commandType = "activitySymbol.create";
- } else if (this.type == m_constants.GATEWAY_SYMBOL) {
- commandType = "gateSymbol.create";
- } else if (this.type == m_constants.EVENT_SYMBOL) {
- commandType = "eventSymbol.create";
- } else if (this.type == m_constants.DATA_SYMBOL) {
- commandType = "dataSymbol.create";
- }
var command = m_command.createNodeSymbolCommand(
- commandType, this.getPath(true), {
+ this.commandType("create"), this.getPath(true), {
oid : this.parentSymbol.oid
}, this.createTransferObject(), this);
m_commandsController.submitCommand(command);
@@ -246,6 +236,23 @@ define(
};
/**
+ * generate command type based on i/p . i.e create,remove
+ */
+ Symbol.prototype.commandType = function(str) {
+ var commandType = null;
+ if (this.type == m_constants.ACTIVITY_SYMBOL) {
+ commandType = "activitySymbol." + str;
+ } else if (this.type == m_constants.GATEWAY_SYMBOL) {
+ commandType = "gateSymbol." + str;
+ } else if (this.type == m_constants.EVENT_SYMBOL) {
+ commandType = "eventSymbol." + str;
+ } else if (this.type == m_constants.DATA_SYMBOL) {
+ commandType = "dataSymbol." + str;
+ }
+ return commandType;
+ }
+ /**
+ *
* Registers symbol in specific lists in the diagram.
*/
Symbol.prototype.register = function() {