UndoableClientActionBase.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2013
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. function UndoableClientActionBase() {}
  13. UndoableClientActionBase.prototype = new CognosViewerAction();
  14. UndoableClientActionBase.prototype.setContainerId = function(containerId)
  15. {
  16. this.m_sContainerId = containerId;
  17. };
  18. UndoableClientActionBase.prototype.doRedo = function(containerId)
  19. {
  20. this.setContainerId(containerId)
  21. this.execute();
  22. };
  23. UndoableClientActionBase.prototype.doUndo = function(containerId)
  24. {
  25. factory = this.getCognosViewer().getActionFactory();
  26. var unfreezeAction = factory.load(this.getUndoClass());
  27. unfreezeAction.setContainerId(containerId);
  28. unfreezeAction.execute();
  29. };
  30. /**
  31. * return the container id of the selected container (without namespace)
  32. */
  33. UndoableClientActionBase.prototype.getSelectedContainerId = function()
  34. {
  35. var selectedObjects = this.m_oCV.getSelectionController().getAllSelectedObjects();
  36. if (selectedObjects && selectedObjects.length) {
  37. var lid=selectedObjects[0].getLayoutElementId();
  38. if (lid) {
  39. return this.removeNamespace(lid);
  40. }
  41. }
  42. return null;
  43. };