FindNextAction.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. /**
  13. * FindAction - finds visible matching node and returns
  14. */
  15. function FindNextAction() {
  16. this.m_requestParams = null;
  17. this.m_sAction = 'findNext';
  18. }
  19. FindNextAction.prototype = new FindAction();
  20. FindNextAction.baseclass = FindAction.prototype;
  21. FindNextAction.prototype.setRequestParms = function(params)
  22. {
  23. this.setConfigAndState();
  24. }
  25. FindNextAction.prototype.execute = function() {
  26. if (this.findState) {
  27. var currentFocus = this.findState.getFocusedMatch();
  28. if (this.findState.hasNext() ) {
  29. var newFocus = this.findState.nextMatch();
  30. this.restoreMatchStyle(currentFocus);
  31. this.applyFocusStyle(newFocus);
  32. } else {
  33. this.restoreMatchStyle(currentFocus);
  34. if (this.findState.checkServerForNextMatch()) {
  35. var cv = this.getCognosViewer();
  36. return cv.executeAction('FindNextOnServer');
  37. } else {
  38. if (this.findState.isWrapAroundSearch()) { //wrap on current page
  39. currentFocus = this.findState.firstMatch();
  40. this.applyFocusStyle(currentFocus);
  41. if (this.findState.isRepeating()) {
  42. var callback = this.findConfig.getFindActionCompleteCallback();
  43. callback();
  44. }
  45. } else {
  46. //no more matches found callback
  47. var callback = this.findConfig.getFindActionCompleteCallback();
  48. callback();
  49. }
  50. }
  51. }
  52. }
  53. return true;
  54. }