Skip to main content

Intercepting mouse click on the expand/collapse icon of a gantt table in a JSF JViews Gantt application


Technote (troubleshooting)


Problem(Abstract)

How to intercept mouse click on the expand/collapse icon of a gantt table in a JSF JViews Gantt application?

Resolving the problem

You can intercept the selection event via the interceptInteractor. This interceptInteractor can be configured with various interators including selectInteractor, tooltipInteractor, etc.

In order to determine if the mouse click occurs on the expand/collapse icon or somewhere else along the row of a gantt table, you must have access to the mouse event. Furthermore, you will need to rely on the tooltip data of the hitmap to determine if the mouse location is on the expand/collapse icon or at the activity's title. Consequently, you should use intercept interactor on tooltip interactor rather than on select interactor.

Below is sample code you can add in your JSP file to declare such tooltip and intercept interactors; as well as JavaScript code implementing detection of mouse click location thanks to hitmap technology. The beforeTableSelect function illustrates how to detect if a row is already selected and if mouse click occurred on the expand/collapse icon or somewhere else on the Gantt table row:

<script type="text/javascript">
    var selectedId="";
</script>
...
<jvf:tooltipInteractor id="tableTooltip" template="tooltip_callback"/>
<jv:interceptInteractor beforeHandler="beforeTableSelect" interactor="tableTooltip" eventType="mouseUp" id="tooltipIntercept"/>
...
function beforeTableSelect(e) {
 var selection = gantt.getTableView().getSelectionManager()
                   .getSelection();
 if (!selection) {
    alert("No selection");
 } else { // some selection
    if (selection.length == 1) {
      if (selectedId != selection[0].id) {
        selectedId = selection[0].id;
        // check if mouse click is on expand icon
        var view = gantt.getTableView();
        var tooltip = view.getHitInfos().tooltip;
        var hitmap = view.hitmap;
        var x = e.mouseX, y = e.mouseY;
        x += view.ganttView.tableScrollbar.value;
    if(hitmap ){
          var index = hitmap.hittest(x, y);
          if( index != 0 ) {
             if( !tooltip[index].indexGroup) //not at expand icon
                alert("New selection");
             }
         else {
       selectedId = "";
         }
          }
        }
        //else {
            //alert("Already selected");
        //}
      }//selection.length == 1
      else {  // deselect
         selectedId = "";
      }
  }// else some selection
}


Cross reference information
Segment Product Component Platform Version Edition
Business Integration IBM ILOG JViews Enterprise SDK:Thin Client Platform Independent 8.8 All Editions

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

IBM ILOG JViews Gantt

SDK:Thin Client


Software version:
8.8


Operating system(s):
Platform Independent


Reference #:
1618599


Modified date:
2012-12-07

Translate my page

Content navigation