Bug #1127

RCP: 0.7.6, focus bugs in chart editors

Added by Sebastien Jacquot over 4 years ago. Updated 3 months ago.

Status:Feedback Start date:09/11/2014
Priority:Normal Due date:
Assignee:- % Done:

50%

Category:Charts Spent time: -
Target version:TXM 0.8.1

Description

There are still some bugs related to focus gain in chart editors. These bugs are OS dependent and JVM version dependent.

Focus behaviors current state with 0.7.7 alpha and embedded JDKs: openjdk 1.6.0-unofficial-b31 (Linux and Window) and Apple JDK 1.6.0_65-b14-462-11M4609 (Mac Os X)

  • Linux Ubuntu 64bit 14.04 VM (bugs)
    • when editor is created, the chart component gets the focus as expected
      • zoom mouse wheel, keyboard shortcuts and rollover tool tips work as expected
    • when clicking outside the editor, the zoom mouse wheel keeps to work but it mustn't
      • this bug is linked to AWT hasFocus() method which acts differently according to the OS/JRE version (maybe due of the SWT/AWT mix)
    • when reopening an editor from a result node, the chart component does not get the focus back, only the mouse wheel works because of the above bug
  • Windows 7 64bit (everything is OK)
    • when editor is created, the chart component gets the focus as expected
      • zoom mouse wheel, keyboard shortcuts and rollover tool tips work as expected
    • when clicking outside the editor, the mouse wheel, keyboard and tool tips don't work, as expected
    • when reopening an editor from a result node, the chart component gets the focus back and zoom mouse wheel, keyboard shortcuts and rollover tool tips work as expected
  • Windows XP 32bit
  • Mac OS X 10.9.4 VM (bugs)
    • when editor is created, the chart component does not get the focus as expected
      • zoom mouse wheel works but it mustn't
    • when clicking in the editor, it becomes active and get the focus, as expected
      • zoom mouse wheel, keyboard shortcuts and rollover tool tips work but the keyboard zoom is done with CTRL key instead of CMD (it's another bug)
    • when clicking outside the editor, the zoom mouse wheel keeps to work but it mustn't
    • when reopening an editor from a result node, the chart component does not get the focus back, only the mouse wheel works because of the above bug

Actually we also need to discuss about the editors focus policy. The Index, Concordance, etc. editors focus policy on double click on tree node result or on click on the tab is not clear/uniform too. (The charts components provider implements its own focus policy giving focus to the chart component when the editor becomes active but it may not be the classic/default RCP behavior.)


Subtasks

Bug #1006: RCP: Charts editor, Mac OS X, When creating or reopening ...New

Bug #1005: RCP: Charts editor, Ubuntu, When reopening a chart editor...New

Bug #1128: RCP: 0.7.6, Ubuntu, CA chart editor focus bug when select...Closed

Bug #1129: RCP: 0.7.6, Ubuntu, CA multipages editor, focus is never ...Closed


Related issues

related to Feature #989: RCP: X.X, embed a jre in TXM setups Closed 02/16/2015

History

#1 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#2 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#3 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#4 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#5 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#6 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#7 Updated by Sebastien Jacquot over 4 years ago

  • Status changed from New to Feedback

#8 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#9 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#10 Updated by Sebastien Jacquot over 4 years ago

In last discussions, it has been decided to automatically give the focus to the chart component on first chart editor creation/opening, on double click on a tree node result and on click on the tab title, and to discuss later about focus policy of other TXM command editors.

#11 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#12 Updated by Sebastien Jacquot over 4 years ago

NOTE: the events of SWT and AWT are not managed the same way on Windows and Linux (even with same openJDK 6 build) and on Mac OS X (Apple 6 JDK).

Windows

on mouse entering a chart editor, the AWT event is fired but the SWT is not fired. The AWT event is fired even if the SWT editor has not the focus.

Linux

on mouse entering a chart editor, the AWT event is fired but the SWT is not fired. The AWT event is fired even if the SWT editor has not the focus. (The problem here is that the tool tips don't appear if the chart editor has not the focus unlike the Windows behavior)

Mac OS X

on mouse entering a chart editor, if the chart editor has the focus, both the AWT and SWT events are fired. If the editor has not the focus, only the SWT event is fired.

#13 Updated by Sebastien Jacquot about 4 years ago

  • Target version changed from TXM 0.7.7 to TXM 0.7.8

We need to fix the embedded JRE versions for OS X before continuing the work on this issue.

#14 Updated by Matthieu Decorde almost 4 years ago

  • Target version changed from TXM 0.7.8 to TXM 0.8.0a (split/restructuration)

#15 Updated by Sebastien Jacquot over 3 years ago

See: org.txm.rcp.chartsengine.base.SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new MouseListener() {...}.mousePressed(MouseEvent)
if we need to activate() the editor part on mouse pressed.

#16 Updated by Sebastien Jacquot 12 months ago

  • Target version changed from TXM 0.8.0a (split/restructuration) to TXM 0.8.0

#17 Updated by Sebastien Jacquot 6 months ago

  • Target version changed from TXM 0.8.0 to TXM 0.8.1

#18 Updated by Sebastien Jacquot 3 months ago

1) This issue needs a full rewriting, first notes here: https://groupes.renater.fr/wiki/txm-users/public/retours_de_bugs_logiciel/txm_0.8.0#visualisations_graphiques_d_une_maniere_generale

2) Second notes:

Récapitulatif des comportements différents selon les OS et JVM
Tests sur PartitionDimensions

Windows

- ouverture de l'éditeur
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowActivated()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusGained()

- appelé grâce au ChartEditor.setFocus() qui appelle Composite.setFocus() qui semble trigger les listener AWT en donnant le focus à la Frame

- clic dans un chart
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowActivated()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusGained()

- ne transmet pas l'état Activate à l'EditorPart

- clic à l'extérieur de la Frame (barres d'outils inclues)
Cela dépend si l'éditeur est déjà actif :
- S'il n'est pas actif, ça le rend actif donc appelle le set focus qui redonne le focus Swing

- S'il est déjà actif, le focus Swing est lost et pas redonné
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusLost()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowLostFocus()
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowDeactivated()

- clic sur le titre/onglet de l'éditeur
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusLost()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowLostFocus()
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowDeactivated()
ChartEditor.setFocus(): giving focus to chart composite...
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowActivated()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusGained()

- clic à l'extérieur de TXM
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusLost()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowLostFocus()
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowDeactivated()

- revenir dans TXM
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowActivated()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusGained()

Linux

- ouverture de l'éditeur

ChartEditor.setFocus(): giving focus to chart composite...
SwingChartComposite.setFocus(): trying to give focus to SWT composite and AWT component...
SwingChartComposite.setFocus(): SWT composite focus given state = true.

- [BUG 1] les événement AWT ne sont apparemment pas déclenchés par l'appel Composite.setFocus() appelé par ChartEditor.setFocus()

- clic dans un chart
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowActivated()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusGained()

- ne transmet pas l'état Activate à l'EditorPart

- clic à l'extérieur de la Frame
- peu importe où on clique le focus reste dans la Frame AWT

- clic à l'extérieur de TXM
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusLost()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowLostFocus()
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowDeactivated()

- revenir dans TXM

- réactive l'éditeur mais ne donne pas le focus AWT (une fois le [BUG 1] fixé cela devrait marcher)

Mac Mojave 10.14 (VM)

- ouverture de l'éditeur
ChartEditor.setFocus(): giving focus to chart composite...
SwingChartComposite.setFocus(): trying to give focus to SWT composite and AWT component...
SwingChartComposite.setFocus(): SWT composite focus given state = true.
ChartEditor.activateContext(): context activated (token = ContextActivation(contextId=org.txm.chartsengine.rcp.editors.ChartEditor,sourcePriority=1048576)).
SwingChartComposite.SwingChartComposite(...).new WindowListener() {...}.windowActivated()
SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusGained()
TXMPreferences.flush(): Local preferences for object /project/VOEUX/txm_res_20190228_092507022_0000_PartitionDimensions saved to file.
TXMResult.compute(): PartitionDimensions: computing of result type class org.txm.partition.core.functions.PartitionDimensions done.
TXMResult.compute(): PartitionDimensions: cascade computing of 0 child(ren).
TXMEditor.refresh(): PartitionDimensionsEditor: auto updating editor from result.
TXMEditor.autoUpdateEditorFieldsFromResult(): PartitionDimensionsEditor: setting editor parameter chart_dimensions_sort_by_parts_size = false (class java.lang.Boolean to object ToolItem {})
TXMEditor.refresh(): PartitionDimensionsEditor: updating subclass editor from result.
Loading chart of type Properties.
org.txm.chartsengine.jfreechart.rcp.JFCSWTChartsComponentsProvider: creating a chart container...
ChartComposite.setCurrentContextMenu(): setting menu to 1 / Menu {Export view ⌘E, Copy chart view to clipboard ⌘C, |, Reset view ⌘R}
TXMEditor.refresh(): PartitionDimensionsEditor: synchronizing and refreshing result children opened editors.
ChartEditor.setFocus(): giving focus to chart composite...
SwingChartComposite.setFocus(): trying to give focus to SWT composite and AWT component...
SwingChartComposite.setFocus(): SWT composite focus given state = true.
Done in 6 sec.
SwingChartComposite.requestFocusInChartComponent(): AWT component focus given state = false.
SwingChartComposite.SwingChartComposite(...).new FocusListener() {...}.focusLost()

- clic dans un chart

- clic à l'extérieur de la Frame (barres d'outils inclues)

- clic sur le titre/onglet de l'éditeur

- clic à l'extérieur de TXM

- revenir dans TXM

3) Tests have been done with the library JFreeChartFX based on Java FX. It seems to fix all the focus and Editor activation bugs but not the RCP Context menu contribution based on context activation. It breaks HTML Swing tooltip and also few modifications are needed to well manage some callback events (eg. Progression to Concordance, etc.)

Also available in: Atom PDF