Ticket #808 (closed enhancement: fixed)

Opened 7 years ago

Last modified 7 years ago

Add Event Handling Priority/Ordering

Reported by: gharris Owned by: gharris
Priority: major Milestone: imagej2-b1-initial
Component: Event Framework Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

Add ability to set the order/priority of event handlers

Global tools should be lower down in the chain so that specific tools can override how an event is handled.

For example, the display of pixel values in the status bar (by globak tool PixelProbe) should be overridden to show the (x,y, w, h) when dragging to create a figure (e.g. Rectangle Tool).

Change History

comment:1 Changed 7 years ago by gharris

  • Status changed from new to closed
  • Resolution set to fixed

All the event handling methods in ITool/AbstractTool return a boolean indicating whether the event should be consumed or passed down the chain.

Assuming such methods return true for 'consume the event', in ToolService each of the EventSubscribers do something like this:

public void onEvent(final MsReleasedEvent event) {

if(getActiveTool().onMouseUp(event)) return;
for (final ITool tool : getGlobalTools()) {

tool.onMouseUp(event);

}

}


comment:2 Changed 7 years ago by gharris

Created new ticket #827 for remaining issue re: Fix Event Handling in JHotDrawImageCanvas

Note: See TracTickets for help on using tickets.