Skip to content

Commit

Permalink
#26 Configuration for resource path
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungpilPark committed Aug 23, 2017
1 parent 5ffc7a3 commit 20201e0
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src/main/webapp/examples/develope.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@
canvas.updateBackDoor(150, 0.7);
});


});

function save() {
opengraphJSON = canvas.toJSON();
console.log(JSON.stringify(opengraphJSON))
}
</script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/opengraph/OpenGraph-0.1.3-SNAPSHOT-All.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/webapp/opengraph/OpenGraph-0.1.3-SNAPSHOT-min.js

Large diffs are not rendered by default.

69 changes: 39 additions & 30 deletions src/main/webapp/opengraph/OpenGraph-0.1.3-SNAPSHOT.js
Original file line number Diff line number Diff line change
Expand Up @@ -11613,7 +11613,7 @@ OG.shape.HorizontalPoolShape.prototype.createSubShape = function () {
var loopShape;
switch (this.LoopType) {
case 'Standard' :
loopShape = new OG.ImageShape('resources/images/symbol/loop_standard.png');
loopShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'loop_standard.png');
break;
case 'MIParallel' :
loopShape = new OG.MIParallel();
Expand Down Expand Up @@ -12007,7 +12007,7 @@ OG.shape.bpmn.A_Task.prototype.createSubShape = function () {
var loopShape;
switch (this.LoopType) {
case 'Standard' :
loopShape = new OG.ImageShape('resources/images/symbol/loop_standard.png');
loopShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'loop_standard.png');
break;
case 'MIParallel' :
loopShape = new OG.MIParallel();
Expand All @@ -12030,31 +12030,31 @@ OG.shape.bpmn.A_Task.prototype.createSubShape = function () {
var taskTypeShape;
switch (this.TaskType) {
case "User":
taskTypeShape = new OG.ImageShape("resources/images/symbol/User.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + "User.png");
break;
case "Send":
taskTypeShape = new OG.ImageShape('resources/images/symbol/Send.png');
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'Send.png');
break;
case "Receive":
taskTypeShape = new OG.ImageShape("resources/images/symbol/Receive.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'Receive.png');
break;
case "Manual":
taskTypeShape = new OG.ImageShape("resources/images/symbol/Manual.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'Manual.png');
break;
case "Service":
taskTypeShape = new OG.ImageShape("resources/images/symbol/Service.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'Service.png');
break;
case "BusinessRule":
taskTypeShape = new OG.ImageShape("resources/images/symbol/BusinessRule.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'BusinessRule.png');
break;
case "Script":
taskTypeShape = new OG.ImageShape("resources/images/symbol/Script.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'Script.png');
break;
case "Mapper":
taskTypeShape = new OG.ImageShape("resources/images/symbol/Mapper.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'Mapper.png');
break;
case "WebService":
taskTypeShape = new OG.ImageShape("resources/images/symbol/WebService.png");
taskTypeShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'WebService.png');
break;
}
if (taskTypeShape) {
Expand All @@ -12071,10 +12071,10 @@ OG.shape.bpmn.A_Task.prototype.createSubShape = function () {
var statusShape, statusAnimation;
switch (this.status) {
case "Completed":
statusShape = new OG.ImageShape("resources/images/symbol/complete.png");
statusShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png');
break;
case "Running":
statusShape = new OG.ImageShape('resources/images/symbol/running.png');
statusShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'running.png');
statusAnimation = new OG.RectangleShape();
break;
}
Expand Down Expand Up @@ -12471,7 +12471,7 @@ OG.shape.bpmn.E_End.prototype.createSubShape = function () {

if (this.inclusion) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/complete.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png'),
width: '20px',
height: '20px',
right: '0px',
Expand Down Expand Up @@ -12576,7 +12576,7 @@ OG.shape.bpmn.E_Start.prototype.createSubShape = function () {

if (this.inclusion) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/complete.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png'),
width: '20px',
height: '20px',
right: '0px',
Expand Down Expand Up @@ -12877,10 +12877,10 @@ OG.shape.bpmn.A_Subprocess.prototype.createSubShape = function () {
var statusShape, statusAnimation;
switch (this.status) {
case "Completed":
statusShape = new OG.ImageShape("resources/images/symbol/complete.png");
statusShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + "complete.png");
break;
case "Running":
statusShape = new OG.ImageShape('resources/images/symbol/running.png');
statusShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'running.png');
statusAnimation = new OG.RectangleShape();
break;
}
Expand Down Expand Up @@ -12936,7 +12936,7 @@ OG.shape.bpmn.A_Subprocess.prototype.createSubShape = function () {

if (this.inclusion) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/complete.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png'),
width: '20px',
height: '20px',
right: '0px',
Expand All @@ -12947,7 +12947,7 @@ OG.shape.bpmn.A_Subprocess.prototype.createSubShape = function () {

if (this.HaveButton) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/subprocess.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'subprocess.png'),
width: '20px',
height: '20px',
align: 'center',
Expand Down Expand Up @@ -15450,7 +15450,7 @@ OG.shape.bpmn.Value_Chain.prototype.createSubShape = function () {

if (this.inclusion) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/complete.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png'),
width: '20px',
height: '20px',
right: '0px',
Expand All @@ -15461,7 +15461,7 @@ OG.shape.bpmn.Value_Chain.prototype.createSubShape = function () {

if (this.HaveButton) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/subprocess.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'subprocess.png'),
width: '20px',
height: '20px',
align: 'center',
Expand Down Expand Up @@ -15543,7 +15543,7 @@ OG.shape.bpmn.Value_Chain.prototype.createSubShape = function () {

if (this.inclusion) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/complete.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png'),
width: '20px',
height: '20px',
right: '0px',
Expand All @@ -15554,7 +15554,7 @@ OG.shape.bpmn.Value_Chain.prototype.createSubShape = function () {

if (this.HaveButton) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/subprocess.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'subprocess.png'),
width: '20px',
height: '20px',
align: 'center',
Expand Down Expand Up @@ -21995,6 +21995,9 @@ OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, siz
groupNode, geometry, text, image, html, xml,
me = this;

//현재 캔버스 등록
shape.currentCanvas = this._CANVAS;

if (shape instanceof OG.shape.GeomShape) {
geometry = shape.createShape();

Expand Down Expand Up @@ -22136,9 +22139,8 @@ OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, siz
// me.putInnerShapeToPool(groupNode);
// }

//shape 에 현재 캔버스,엘리먼트 등록
//shape 에 현재 엘리먼트 등록
shape.currentElement = groupNode;
shape.currentCanvas = this._CANVAS;

// drawShape event fire
if (!preventEvent) {
Expand Down Expand Up @@ -23858,7 +23860,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
if (!_isDeletable) {
return;
}
_trash = me._PAPER.image("resources/images/symbol/trash.png", 0, 0, _ctrlSize, _ctrlSize);
_trash = me._PAPER.image(me._CONFIG.IMAGE_BASE + 'trash.png', 0, 0, _ctrlSize, _ctrlSize);
_trash.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_trash);
me._add(_trash, rElement.id + OG.Constants.GUIDE_SUFFIX.TRASH);
Expand Down Expand Up @@ -24032,7 +24034,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
}

function _drawLaneQuarter(divideCount) {
_qUpper = me._PAPER.image("resources/images/symbol/quarter-upper.png", 0, 0, _ctrlSize, _ctrlSize);
_qUpper = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-upper.png", 0, 0, _ctrlSize, _ctrlSize);
_qUpper.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qUpper);
me._add(_qUpper, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER);
Expand All @@ -24041,7 +24043,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
me.divideLane(element, OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER);
});

_qBisector = me._PAPER.image("resources/images/symbol/quarter-bisector.png", 0, 0, _ctrlSize, _ctrlSize);
_qBisector = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-bisector.png", 0, 0, _ctrlSize, _ctrlSize);
_qBisector.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qBisector);
me._add(_qBisector, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR);
Expand All @@ -24050,7 +24052,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
me.divideLane(element, OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR);
});

_qThirds = me._PAPER.image("resources/images/symbol/quarter-thirds.png", 0, 0, _ctrlSize, _ctrlSize);
_qThirds = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-thirds.png", 0, 0, _ctrlSize, _ctrlSize);
_qThirds.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qThirds);
me._add(_qThirds, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS);
Expand All @@ -24059,7 +24061,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
me.divideLane(element, OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS);
});

_qLow = me._PAPER.image("resources/images/symbol/quarter-low.png", 0, 0, _ctrlSize, _ctrlSize);
_qLow = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-low.png", 0, 0, _ctrlSize, _ctrlSize);
_qLow.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qLow);
me._add(_qLow, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_LOW);
Expand Down Expand Up @@ -32248,6 +32250,8 @@ OG.handler.EventHandler.prototype = {

$(me._RENDERER.getRootElement()).find("[_selected=true]").each(function (index, item) {
shape = eval('new ' + value + '()');

shape.currentCanvas = me._RENDERER._CANVAS
if (label) {
shape.label = label;
} else {
Expand Down Expand Up @@ -35089,6 +35093,11 @@ OG.graph.Canvas = function (container, containerSize, backgroundColor, backgroun
*/
CANVAS_BACKGROUND: "#f9f9f9",

/**
* 이미지 베이스 패스
*/
IMAGE_BASE: 'resources/images/symbol/',

/**
* 이미지 url 정보
*/
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/src/graph/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ OG.graph.Canvas = function (container, containerSize, backgroundColor, backgroun
*/
CANVAS_BACKGROUND: "#f9f9f9",

/**
* 이미지 베이스 패스
*/
IMAGE_BASE: 'resources/images/symbol/',

/**
* 이미지 url 정보
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/src/handler/EventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3961,6 +3961,8 @@ OG.handler.EventHandler.prototype = {

$(me._RENDERER.getRootElement()).find("[_selected=true]").each(function (index, item) {
shape = eval('new ' + value + '()');

shape.currentCanvas = me._RENDERER._CANVAS
if (label) {
shape.label = label;
} else {
Expand Down
24 changes: 17 additions & 7 deletions src/main/webapp/src/renderer/RaphaelRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,9 @@ OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, siz
groupNode, geometry, text, image, html, xml,
me = this;

//현재 캔버스 등록
shape.currentCanvas = this._CANVAS;

if (shape instanceof OG.shape.GeomShape) {
geometry = shape.createShape();

Expand Down Expand Up @@ -1419,16 +1422,23 @@ OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, siz
// me.putInnerShapeToPool(groupNode);
// }

//shape 에 현재 캔버스,엘리먼트 등록
//shape 에 현재 엘리먼트 등록
shape.currentElement = groupNode;
shape.currentCanvas = this._CANVAS;

// drawShape event fire
if (!preventEvent) {
shape.onDrawShape();
$(this._PAPER.canvas).trigger('drawShape', [groupNode]);
}

if (!id && (me.isLane(groupNode) || me.isPool(groupNode))) {
if(me.isTopGroup(groupNode)){
console.log('top');
me.setDropablePool(groupNode);
}
//me.isTopGroup(element)
}

return groupNode;
};

Expand Down Expand Up @@ -3141,7 +3151,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
if (!_isDeletable) {
return;
}
_trash = me._PAPER.image("resources/images/symbol/trash.png", 0, 0, _ctrlSize, _ctrlSize);
_trash = me._PAPER.image(me._CONFIG.IMAGE_BASE + 'trash.png', 0, 0, _ctrlSize, _ctrlSize);
_trash.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_trash);
me._add(_trash, rElement.id + OG.Constants.GUIDE_SUFFIX.TRASH);
Expand Down Expand Up @@ -3315,7 +3325,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
}

function _drawLaneQuarter(divideCount) {
_qUpper = me._PAPER.image("resources/images/symbol/quarter-upper.png", 0, 0, _ctrlSize, _ctrlSize);
_qUpper = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-upper.png", 0, 0, _ctrlSize, _ctrlSize);
_qUpper.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qUpper);
me._add(_qUpper, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER);
Expand All @@ -3324,7 +3334,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
me.divideLane(element, OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER);
});

_qBisector = me._PAPER.image("resources/images/symbol/quarter-bisector.png", 0, 0, _ctrlSize, _ctrlSize);
_qBisector = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-bisector.png", 0, 0, _ctrlSize, _ctrlSize);
_qBisector.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qBisector);
me._add(_qBisector, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR);
Expand All @@ -3333,7 +3343,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
me.divideLane(element, OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR);
});

_qThirds = me._PAPER.image("resources/images/symbol/quarter-thirds.png", 0, 0, _ctrlSize, _ctrlSize);
_qThirds = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-thirds.png", 0, 0, _ctrlSize, _ctrlSize);
_qThirds.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qThirds);
me._add(_qThirds, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS);
Expand All @@ -3342,7 +3352,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
me.divideLane(element, OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS);
});

_qLow = me._PAPER.image("resources/images/symbol/quarter-low.png", 0, 0, _ctrlSize, _ctrlSize);
_qLow = me._PAPER.image(me._CONFIG.IMAGE_BASE + "quarter-low.png", 0, 0, _ctrlSize, _ctrlSize);
_qLow.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);
group.appendChild(_qLow);
me._add(_qLow, rElement.id + OG.Constants.GUIDE_SUFFIX.QUARTER_LOW);
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/src/shape/HorizontalPoolShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ OG.shape.HorizontalPoolShape.prototype.createSubShape = function () {
var loopShape;
switch (this.LoopType) {
case 'Standard' :
loopShape = new OG.ImageShape('resources/images/symbol/loop_standard.png');
loopShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'loop_standard.png');
break;
case 'MIParallel' :
loopShape = new OG.MIParallel();
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/src/shape/bpmn/A_Subprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ OG.shape.bpmn.A_Subprocess.prototype.createSubShape = function () {
var statusShape, statusAnimation;
switch (this.status) {
case "Completed":
statusShape = new OG.ImageShape("resources/images/symbol/complete.png");
statusShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + "complete.png");
break;
case "Running":
statusShape = new OG.ImageShape('resources/images/symbol/running.png');
statusShape = new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'running.png');
statusAnimation = new OG.RectangleShape();
break;
}
Expand Down Expand Up @@ -114,7 +114,7 @@ OG.shape.bpmn.A_Subprocess.prototype.createSubShape = function () {

if (this.inclusion) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/complete.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'complete.png'),
width: '20px',
height: '20px',
right: '0px',
Expand All @@ -125,7 +125,7 @@ OG.shape.bpmn.A_Subprocess.prototype.createSubShape = function () {

if (this.HaveButton) {
this.sub.push({
shape: new OG.ImageShape('resources/images/symbol/subprocess.png'),
shape: new OG.ImageShape(this.currentCanvas._CONFIG.IMAGE_BASE + 'subprocess.png'),
width: '20px',
height: '20px',
align: 'center',
Expand Down
Loading

0 comments on commit 20201e0

Please sign in to comment.