Skip to content

Commit

Permalink
Patient/Study/Series/Image navigation via keyboard shortcuts #483
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Nov 7, 2023
1 parent 70dad3e commit a6b41aa
Showing 1 changed file with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
package org.weasis.core.ui.editor.image;

import bibliothek.gui.dock.control.focus.DefaultFocusRequest;
import bibliothek.gui.dock.control.focus.FocusController;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
Expand Down Expand Up @@ -57,6 +59,7 @@
import org.weasis.core.api.image.ZoomOp.Interpolation;
import org.weasis.core.api.media.data.ImageElement;
import org.weasis.core.api.media.data.MediaSeries;
import org.weasis.core.api.service.UICore;
import org.weasis.core.ui.editor.image.dockable.MeasureTool;
import org.weasis.core.ui.model.graphic.Graphic;
import org.weasis.core.ui.model.layer.LayerAnnotation;
Expand Down Expand Up @@ -251,16 +254,24 @@ default void setFocused(Boolean focused) {
}

if (isFocused) {
// Delay the request focus
Timer timer = new Timer();
timer.schedule(
new TimerTask() {
@Override
public void run() {
SwingUtilities.invokeLater(() -> getJComponent().requestFocus());
}
},
500);
if (WinUtil.getParentOfClass(getJComponent(), ViewerPlugin.class)
instanceof ViewerPlugin<?> viewerPlugin) {
FocusController focusController =
UICore.getInstance().getDockingControl().getController().getFocusController();
focusController.focus(
new DefaultFocusRequest(viewerPlugin.getDockable().intern(), getJComponent(), true));
} else {
// Delay the request focus
Timer timer = new Timer();
timer.schedule(
new TimerTask() {
@Override
public void run() {
SwingUtilities.invokeLater(() -> getJComponent().requestFocus());
}
},
500);
}
}
}

Expand Down

0 comments on commit a6b41aa

Please sign in to comment.