Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Why VE calls actionPreformed Listeners?
Why VE calls actionPreformed Listeners? [message #547887] Tue, 20 July 2010 06:02 Go to next message
Eclipse User
Originally posted by: fbondioli.autentiweb.com

Hi all,
I'm using eclipse 3.5.2 and VE 1.4 for design Swing applications.

I've noticed that VE often follows actionPerformed events linked to object and this produces very often unpredictable results.
For example in the code below, the method "inserisciNuovoCliente()" is called by the VE during setup and prevent it to display the frame correctly. If I comment
the call to inserisciNuovoCliente() the frame is displayed OK.

Is there a way to prevent this behaviour?

private JButton getBtInsNuovoCliente() {
if (btInsNuovoCliente == null) {
btInsNuovoCliente = new JButton();
btInsNuovoCliente.setText("Inserisci nuovo cliente");
btInsNuovoCliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
new Thread() {
public void run() {
inserisciNuovoCliente();
}
}.start();
}
});
}
return btInsNuovoCliente;
}

private void inserisciNuovoCliente() {
Anagrafica cli = new Anagrafica();
cli.setCliente(true);
FrameSchedaAnagrafica fsa = new FrameSchedaAnagrafica(cli);
UIUtils.showModalInternalFrame(fsa, StoreClientGlobal.desktopPane, this);
cli = fsa.getAnagObject();
if (cli.getId() != null) {
try {
ddtObject.setDestinatario(cli);
detailPanel.toControl(txtFornitore);
//txtFornitore.setBoundValue(cli);
} catch (Exception e) {
e.printStackTrace();
}
}
StoreClientGlobal.desktopPane.remove(fsa);
fsa.dispose();
}
Re: Why VE calls actionPreformed Listeners? [message #547895 is a reply to message #547887] Tue, 20 July 2010 06:48 Go to previous message
Eclipse User
Originally posted by: fbondioli.autentiweb.com

Fabio B. ha scritto:
> Hi all,
> I'm using eclipse 3.5.2 and VE 1.4 for design Swing applications.
>
> I've noticed that VE often follows actionPerformed events linked to
> object and this produces very often unpredictable results.
> For example in the code below, the method "inserisciNuovoCliente()" is
> called by the VE during setup and prevent it to display the frame
> correctly. If I comment the call to inserisciNuovoCliente() the frame is
> displayed OK.
>
> Is there a way to prevent this behaviour?
>
> private JButton getBtInsNuovoCliente() {
> if (btInsNuovoCliente == null) {
> btInsNuovoCliente = new JButton();
> btInsNuovoCliente.setText("Inserisci nuovo cliente");
> btInsNuovoCliente.addActionListener(new
> java.awt.event.ActionListener() {
> public void actionPerformed(java.awt.event.ActionEvent e) {
> new Thread() {
> public void run() {
> inserisciNuovoCliente();
> }
> }.start();
> }
> });
> }
> return btInsNuovoCliente;
> }
>
> private void inserisciNuovoCliente() {
> Anagrafica cli = new Anagrafica();
> cli.setCliente(true);
> FrameSchedaAnagrafica fsa = new FrameSchedaAnagrafica(cli);
> UIUtils.showModalInternalFrame(fsa, StoreClientGlobal.desktopPane,
> this);
> cli = fsa.getAnagObject();
> if (cli.getId() != null) {
> try {
> ddtObject.setDestinatario(cli);
> detailPanel.toControl(txtFornitore);
> //txtFornitore.setBoundValue(cli);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> StoreClientGlobal.desktopPane.remove(fsa);
> fsa.dispose();
> }


I've investigated any further and discovered that VE doesn't follows the actionPerformed events but simply try to parse the private inserisciNuovoCliente() method

the problem is that VE try to create a model for the FrameSchedaAnagrafica object that is a VisualObject (it extends JInternalFrame) and something goes wrong.

I've tried adding the VE annotation comment to the declaration of the fsa object without success:
....
FrameSchedaAnagrafica fsa = null; // @jve:
fsa = new FrameSchedaAnagrafica(cli);
....

From the info I've found googling, this annotation should tell VE not to create a model for my fsa object and not to try to visualize it, but it seems it
doesn't work.

Is there anything else I can try?

Regards

Fabio B.
Re: Why VE calls actionPreformed Listeners? [message #618419 is a reply to message #547887] Tue, 20 July 2010 06:48 Go to previous message
Eclipse User
Originally posted by: fbondioli.autentiweb.com

Fabio B. ha scritto:
> Hi all,
> I'm using eclipse 3.5.2 and VE 1.4 for design Swing applications.
>
> I've noticed that VE often follows actionPerformed events linked to
> object and this produces very often unpredictable results.
> For example in the code below, the method "inserisciNuovoCliente()" is
> called by the VE during setup and prevent it to display the frame
> correctly. If I comment the call to inserisciNuovoCliente() the frame is
> displayed OK.
>
> Is there a way to prevent this behaviour?
>
> private JButton getBtInsNuovoCliente() {
> if (btInsNuovoCliente == null) {
> btInsNuovoCliente = new JButton();
> btInsNuovoCliente.setText("Inserisci nuovo cliente");
> btInsNuovoCliente.addActionListener(new
> java.awt.event.ActionListener() {
> public void actionPerformed(java.awt.event.ActionEvent e) {
> new Thread() {
> public void run() {
> inserisciNuovoCliente();
> }
> }.start();
> }
> });
> }
> return btInsNuovoCliente;
> }
>
> private void inserisciNuovoCliente() {
> Anagrafica cli = new Anagrafica();
> cli.setCliente(true);
> FrameSchedaAnagrafica fsa = new FrameSchedaAnagrafica(cli);
> UIUtils.showModalInternalFrame(fsa, StoreClientGlobal.desktopPane,
> this);
> cli = fsa.getAnagObject();
> if (cli.getId() != null) {
> try {
> ddtObject.setDestinatario(cli);
> detailPanel.toControl(txtFornitore);
> //txtFornitore.setBoundValue(cli);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> StoreClientGlobal.desktopPane.remove(fsa);
> fsa.dispose();
> }


I've investigated any further and discovered that VE doesn't follows the actionPerformed events but simply try to parse the private inserisciNuovoCliente() method

the problem is that VE try to create a model for the FrameSchedaAnagrafica object that is a VisualObject (it extends JInternalFrame) and something goes wrong.

I've tried adding the VE annotation comment to the declaration of the fsa object without success:
....
FrameSchedaAnagrafica fsa = null; // @jve:
fsa = new FrameSchedaAnagrafica(cli);
....

From the info I've found googling, this annotation should tell VE not to create a model for my fsa object and not to try to visualize it, but it seems it
doesn't work.

Is there anything else I can try?

Regards

Fabio B.
Previous Topic:Why VE calls actionPreformed Listeners?
Next Topic:Exception Hint in VE Status Bar
Goto Forum:
  


Current Time: Sat Oct 25 19:06:54 GMT 2014

Powered by FUDForum. Page generated in 0.01710 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software