MediaViewIMagePanel thread safety fixes

This commit is contained in:
Richard Cordovano 2020-09-15 19:44:47 -04:00
parent 87e829556e
commit 2c7663ed16

View File

@ -124,7 +124,7 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
/* /*
* JFX UI components, must be accessed in JFX thread only. * Threading policy: JFX UI components, must be accessed in JFX thread only.
*/ */
@ThreadConfined(type = ThreadConfined.ThreadType.JFX) @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private final ProgressBar progressBar = new ProgressBar(); private final ProgressBar progressBar = new ProgressBar();
@ -142,7 +142,7 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan
private ScrollPane scrollPane; private ScrollPane scrollPane;
/* /*
* Swing UI components, must be accessed in EDT only. * Threading policy: Swing UI components, must be accessed in EDT only.
*/ */
@ThreadConfined(type = ThreadConfined.ThreadType.AWT) @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
private final JPopupMenu imageTaggingOptions; private final JPopupMenu imageTaggingOptions;
@ -160,7 +160,7 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan
private final JFXPanel fxPanel; private final JFXPanel fxPanel;
/* /*
* Panel state: currently selected image file. * Panel state variables threading policy:
* *
* imageFile: The loadFile() method kicks off a JFX background task to read * imageFile: The loadFile() method kicks off a JFX background task to read
* the content of the currently selected file into a JFX Image object. If * the content of the currently selected file into a JFX Image object. If
@ -174,7 +174,8 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan
* readImageFileTask: This is a reference to a JFX background task that * readImageFileTask: This is a reference to a JFX background task that
* reads the content of the currently selected file into a JFX Image object. * reads the content of the currently selected file into a JFX Image object.
* A reference is maintained so that the task can be cancelled if it is * A reference is maintained so that the task can be cancelled if it is
* running when the selected image file changes. * running when the selected image file changes. Only accessed in the JFX
* thread.
* *
* imageTransforms: These values are mostly written in the EDT based on user * imageTransforms: These values are mostly written in the EDT based on user
* interactions with Swing components and then read in the JFX thread when * interactions with Swing components and then read in the JFX thread when
@ -1355,7 +1356,9 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan
} }
} }
private enum ZoomDirection {IN, OUT}; private enum ZoomDirection {
IN, OUT
};
/** /**
* Records a snapshot of the image transforms specified by the user. * Records a snapshot of the image transforms specified by the user.