Weasis: Mouse scroll working on two monitors?

192 views
Skip to first unread message

alex.ga...@gmail.com

unread,
Apr 18, 2019, 8:47:20 AM4/18/19
to dcm4che
Hello, I have the weasis running on two monitors. How do I make the scrolling of the mouse work on the two viewers? Thanks!

Nicolas Roduit

unread,
Apr 18, 2019, 12:01:42 PM4/18/19
to dcm4che
If you mean synchronizing the views, it is currently possible only within a Window.

Alex GA Software

unread,
Apr 22, 2019, 8:43:46 AM4/22/19
to dcm...@googlegroups.com
Can you give me a hint where I can change the code for the mouse to work on both screens? Thanks.

--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+u...@googlegroups.com.
To post to this group, send email to dcm...@googlegroups.com.
Visit this group at https://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.


--
Alex Rocha | Programador
(77) 98138-9116

Nicolas Roduit

unread,
Apr 23, 2019, 2:33:25 PM4/23/19
to dcm4che
I don't think it's trivial because the synchronization mechanisms work currently within a window. Unfortunately, I don't have time at the moment to look into this problem.

Le lundi 22 avril 2019 14:43:46 UTC+2, Alex GA Software a écrit :
Can you give me a hint where I can change the code for the mouse to work on both screens? Thanks.

Em qui, 18 de abr de 2019 às 13:01, Nicolas Roduit  escreveu:
If you mean synchronizing the views, it is currently possible only within a Window.

Le jeudi 18 avril 2019 14:47:20 UTC+2, alex.ga...@gmail.com a écrit :
Hello, I have the weasis running on two monitors. How do I make the scrolling of the mouse work on the two viewers? Thanks!

--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+unsubscribe@googlegroups.com.

To post to this group, send email to dcm...@googlegroups.com.
Visit this group at https://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.

alex.ga...@gmail.com

unread,
Apr 29, 2019, 3:23:31 PM4/29/19
to dcm4che
My solution to the problem:

EventManger.java
// GA Info: O scroll do mouse só irá funcionar em cima do container de imagens
// dicom
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (DicomExplorerFactory.tela1Aberta && DicomExplorerFactory.tela2Aberta) {
DicomExplorerFactory.tela1Aberta = false;
DicomExplorerFactory.tela2Aberta = false;
return;
}
if (isActionEnabled()) {
setSliderValue(getSliderValue() + e.getWheelRotation());
mouseMovimentSimulator(e);
}
}

public void mouseMovimentSimulator(MouseWheelEvent e) {
try {
GraphicsDevice telaAtual = selectedView2dContainer.getGraphicsConfiguration().getDevice();
Rectangle screenSizeOther;
Rectangle screenSizeAtual;
Robot robot = new Robot();
Point posInicial = MouseInfo.getPointerInfo().getLocation();

// GA info: DicomExplorerFactory.tela1 e tela2 para pegar as telas existentes ao
// DICA: Duplica a ação do mouse para a tela oposta.
if (telaAtual == DicomExplorerFactory.tela1 && DicomExplorerFactory.tela2Aberta == false) {
// Robot robot = new Robot(DicomExplorerFactory.tela2);
screenSizeAtual = new Rectangle(telaAtual.getDefaultConfiguration().getBounds());
screenSizeOther = new Rectangle(
DicomExplorerFactory.tela2.getDefaultConfiguration().getBounds());
moveMouseScreen2(screenSizeOther, screenSizeAtual, robot, e);
retornarMousePosicialInicial(posInicial, robot);
DicomExplorerFactory.tela2Aberta = true;
return;
}
if (telaAtual == DicomExplorerFactory.tela2 && DicomExplorerFactory.tela1Aberta == false) {
screenSizeAtual = new Rectangle(telaAtual.getDefaultConfiguration().getBounds());
screenSizeOther = new Rectangle(
DicomExplorerFactory.tela1.getDefaultConfiguration().getBounds());
moveMouseScreen1(screenSizeOther, screenSizeAtual, robot, e);
retornarMousePosicialInicial(posInicial, robot);
DicomExplorerFactory.tela1Aberta = true;
return;
}
} catch (AWTException exc) {
exc.printStackTrace();
}
}

public void retornarMousePosicialInicial(Point posInicial, Robot robot) {
robot.mouseMove(posInicial.x, posInicial.y);
}

public void moveMouseScreen1(Rectangle screenSizeOther, Rectangle screenSizeAtual, Robot robot,
MouseWheelEvent e) {
int x = screenSizeOther.width / 2;
int y = (screenSizeOther.height / 2);
robot.mouseMove(x, y);
robot.mouseWheel(e.getWheelRotation());
}

public void moveMouseScreen2(Rectangle screenSizeOther, Rectangle screenSizeAtual, Robot robot,
MouseWheelEvent e) {
int x = -(screenSizeOther.width / 2);
int y = (screenSizeOther.height / 2);
robot.mouseMove(x, y);
robot.mouseWheel(e.getWheelRotation());
}

alex.ga...@gmail.com

unread,
Apr 29, 2019, 3:24:59 PM4/29/19
to dcm4che
DicomExplorerFactory.java

// GA info: Colocando telas para serem usadas no EventManager "scroll do mouse"
public static GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
public static GraphicsDevice tela1 = null;
public static GraphicsDevice tela2 = null;
public static boolean tela1Aberta = false;
public static boolean tela2Aberta = false;

alex.ga...@gmail.com

unread,
Apr 29, 2019, 3:52:15 PM4/29/19
to dcm4che
@Override
public DataExplorerView createDataExplorerView(Hashtable<String, Object> properties) {
if (explorer == null) {
explorer = new DicomExplorer(model);
model.addPropertyChangeListener(explorer);
UIManager.EXPLORER_PLUGIN_TOOLBARS.add(new ImportToolBar(5, explorer));
UIManager.EXPLORER_PLUGIN_TOOLBARS.add(new ExportToolBar(7, explorer));
ViewerPluginBuilder.DefaultDataModel.firePropertyChange(
new ObservableEvent(ObservableEvent.BasicAction.NULL_SELECTION, explorer, null, null));
}
getQuantidadeMonitores();
return explorer;
}

protected void getQuantidadeMonitores() {
for (GraphicsDevice tela : ge.getScreenDevices()) {
// GA info: Pega as telas disponiveis para ser usadas no EventManager na ação de
// rolagem do mouse.
int valor = Integer.parseInt(
tela.toString().substring(tela.toString().indexOf("=") + 1, tela.toString().indexOf("]")));
if (valor == 0) {
tela1 = tela;
} else if (valor == 1) {
tela2 = tela;
} else {
System.out.println("######### HÁ MAIS DE DUAS TELA NO COMPUTADOR #############");
}
}
}



Em quinta-feira, 18 de abril de 2019 09:47:20 UTC-3, alex.ga...@gmail.com escreveu:

Nicolas Roduit

unread,
May 1, 2019, 5:09:24 AM5/1/19
to dcm4che
I think that simulating a scroll is not a good approach because it is just one aspect of synchronization and therefore does not cover the zoom, pan, rotation..., crosslines display and some other exception rules. In addition, Weasis has no restrictions on the number of screens that windows can be distributed.

A better approach would be to manage hanging protocols that allow multiple screens. This requires extending the recording of the synchronization listeners to multiple windows.

alex.ga...@gmail.com

unread,
May 2, 2019, 3:28:02 PM5/2/19
to dcm4che
Where i can manage hanging protocols for allow multiple screens? Thaks!


Em quarta-feira, 1 de maio de 2019 06:09:24 UTC-3, Nicolas Roduit escreveu:
I think that simulating a scroll is not a good approach because it is just one aspect of synchronization and therefore does not cover the zoom, pan, rotation..., crosslines display and some other exception rules. In addition, Weasis has no restrictions on the number of screens that windows can be distributed.

A better approach would be to manage hanging protocols that allow multiple screens. This requires extending the recording of the synchronization listeners to multiple windows.

Alex GA Software

unread,
May 10, 2019, 11:57:02 AM5/10/19
to dcm4che
Any idea?


Em quarta-feira, 1 de maio de 2019 06:09:24 UTC-3, Nicolas Roduit escreveu:

Nicolas Roduit

unread,
May 15, 2019, 2:16:03 AM5/15/19
to dcm4che
The hanging protocols will allow managing the layout, the screen involved, and the type of series loaded in each view. This requires a global reflection on how to proceed before starting to modify code. See this post.
Reply all
Reply to author
Forward
0 new messages