Author: Lars Michelsen <[email protected]>
Date: Tue Apr 12 19:20:31 2011 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Tue Apr 12 19:20:31 2011 +0200
Shapes can also be edited, moved, deleted used the regular frontend now
---
share/frontend/nagvis-js/js/NagVisObject.js | 14 ++++++++++++++
share/frontend/nagvis-js/js/NagVisShape.js | 19 +++++++++++++++----
.../frontend/nagvis-js/js/NagVisStatefulObject.js | 12 ------------
3 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js
b/share/frontend/nagvis-js/js/NagVisObject.js
index 090f9e0..c270aa8 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -670,6 +670,18 @@ var NagVisObject = Base.extend({
},
/**
+ * Moves the icon to it's location as described by this js object
+ *
+ * @author Lars Michelsen <[email protected]>
+ */
+ moveIcon: function () {
+ var container = document.getElementById(this.conf.object_id +
'-icondiv');
+ container.style.top = this.parseCoord(this.conf.y, 'y') + 'px';
+ container.style.left = this.parseCoord(this.conf.x, 'x') + 'px';
+ container = null;
+ },
+
+ /**
* Entry point for repositioning objects in NagVis frontend
* Handles whole redrawing of the object while moving
*
@@ -718,6 +730,8 @@ var NagVisObject = Base.extend({
this.parseIconControls();
else if(this.conf.type === 'textbox')
this.parseBoxControls();
+ else if(this.conf.type === 'shape')
+ this.parseShapeControls();
},
addControl: function (obj) {
diff --git a/share/frontend/nagvis-js/js/NagVisShape.js
b/share/frontend/nagvis-js/js/NagVisShape.js
index 655580b..3c697a7 100644
--- a/share/frontend/nagvis-js/js/NagVisShape.js
+++ b/share/frontend/nagvis-js/js/NagVisShape.js
@@ -46,10 +46,7 @@ var NagVisShape = NagVisStatelessObject.extend({
// Create container div
oContainerDiv = document.createElement('div');
oContainerDiv.setAttribute('id', this.conf.object_id);
-
- var oShape = this.parseShape();
- oContainerDiv.appendChild(oShape);
- oShape = null;
+ oContainerDiv.appendChild(this.parseShape());
// When this is an update, remove the object first
this.remove();
@@ -61,6 +58,10 @@ var NagVisShape = NagVisStatelessObject.extend({
}
oContainerDiv = null;
+
+ // Enable the controls when the object is not locked
+ if(!this.bIsLocked)
+ this.parseControls();
},
/**
@@ -71,6 +72,7 @@ var NagVisShape = NagVisStatelessObject.extend({
*/
parseShape: function () {
var oIconDiv = document.createElement('div');
+ oIconDiv.setAttribute('id', this.conf.object_id+'-icondiv');
oIconDiv.setAttribute('class', 'icon');
oIconDiv.setAttribute('className', 'icon');
oIconDiv.style.top = this.conf.y+'px';
@@ -113,5 +115,14 @@ var NagVisShape = NagVisStatelessObject.extend({
parseHoverMenu: function () {
this.getHoverMenu(this.conf.object_id+'-icon');
+ },
+
+ parseShapeControls: function () {
+ this.parseControlDrag(0, this.parseCoord(this.conf.x, 'x'),
this.parseCoord(this.conf.y, 'y'), 5, -15, 10);
+ this.parseControlDelete(1, this.parseCoord(this.conf.x, 'x'),
this.parseCoord(this.conf.y, 'y'), 20, -15, 10);
+ this.parseControlModify(2, this.parseCoord(this.conf.x, 'x'),
this.parseCoord(this.conf.y, 'y'), 35, -15, 10);
+
+ // Simply make it dragable. Maybe will be extended in the future...
+ makeDragable([this.conf.object_id+'-drag-0'], this.saveObject,
this.moveObject);
}
});
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index adf0e3f..fe0308d 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -820,18 +820,6 @@ var NagVisStatefulObject = NagVisObject.extend({
},
/**
- * Moves the icon to it's location as described by this js object
- *
- * @author Lars Michelsen <[email protected]>
- */
- moveIcon: function () {
- var container = document.getElementById(this.conf.object_id +
'-icondiv');
- container.style.top = this.parseCoord(this.conf.y, 'y') + 'px';
- container.style.left = this.parseCoord(this.conf.x, 'x') + 'px';
- container = null;
- },
-
- /**
* Moves the label of the object
*
* @author Lars Michelsen <[email protected]>
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins