This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

cancel event order

General questions regarding the development with JVx.

cancel event order

Postby JuFi » Tue Nov 13, 2018 10:31 am

Hi,
I'am using eventBeforeRowSelect to check some conditions before the other row is actually selected. Is there a possibility to stop selecting the row? For example if a condition is false I don't want to switch to a different row - so I would like to stop the event order.

Thanks in advance.
JuFi
 
Posts: 12
Joined: Thu Oct 11, 2018 2:20 pm

Re: cancel event order

Postby Support@SIB » Tue Nov 13, 2018 10:58 am

Simply throw an Exception to show the error dialog or throw a SilentAbortException to hide the dialog.
User avatar
Support@SIB
 
Posts: 257
Joined: Mon Sep 28, 2009 1:56 pm

Re: cancel event order

Postby JuFi » Tue Nov 13, 2018 11:43 am

I tried to throw a SilentAbortException, but then I get this behaviour:

If I try to change rows for the first time and my condition is not met, I throw the SilentAbortException.
On second try my condition is met, but I seem to not get any row change events anymore.
JuFi
 
Posts: 12
Joined: Thu Oct 11, 2018 2:20 pm

Re: cancel event order

Postby Support@SIB » Tue Nov 13, 2018 2:02 pm

Here's the documentation about DataBook events.
User avatar
Support@SIB
 
Posts: 257
Joined: Mon Sep 28, 2009 1:56 pm

Re: cancel event order

Postby Development@SIB » Tue Nov 13, 2018 3:32 pm

This is a bug in the Swing Table implementation.
User avatar
Development@SIB
 
Posts: 321
Joined: Mon Sep 28, 2009 1:54 pm

Re: cancel event order

Postby Development@SIB » Tue Nov 13, 2018 4:00 pm

The problem only occurs in Swing UI, with Vaadin UI everything works.

In case of Swing, you could use the workaround:

Syntax: [ Download ] [ Hide ]
if (getApplication().getLauncher().isDesktopEnvironment())
{
    UIComponent.invokeLater(new Runnable()
    {
        @Override
        public void run()
        {
            Object o = table.getUIResource().getResource();
                       
            if (o instanceof java.awt.Component)
            {
                ((Component)o).removeNotify();
                ((Component)o).addNotify();
                ((ITableControl)table.getUIResource()).notifyRepaint();
            }
        }
    });
}

throw new SilentAbortException();

But this workaround doesn't solve the problem if you double click in the table in case of SilentAbortException. The bug is already fixed and will be available in the next JVx release or in the nightly builds!
User avatar
Development@SIB
 
Posts: 321
Joined: Mon Sep 28, 2009 1:54 pm


Return to Development