Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » How does VE decide whether to instantiate a bean in initialize?
How does VE decide whether to instantiate a bean in initialize? [message #145450] Tue, 25 November 2008 05:45 Go to next message
Eclipse User
Originally posted by: eli_lato.hotmail.com

If I choose a JLabel from the Choose Bean button, and drop the JLabel on the panel, the VE instantiates the JLabel in the initialize method:
private void initialize() {
jLabel = new JLabel();
...

But if I choose a JFormattedTextField from the Choose Bean button, and drop the JFormattedTextField on the panel, the VE instantiates it in a lazy getter:
private JFormattedTextField getJFormattedTextField() (
if (jFormattedTextField == null...

How does the VE decide where to instantiate the bean?

Thanks,
Eli
Re: How does VE decide whether to instantiate a bean in initialize? [message #145460 is a reply to message #145450] Wed, 26 November 2008 04:16 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin Scheglov
Messages: 554
Registered: July 2009
Senior Member
Eli Lato wrote:

I'm not 100% sure, but AFAIK VE always uses "lazy creation" pattern.

> If I choose a JLabel from the Choose Bean button, and drop the JLabel on the panel, the VE instantiates the JLabel in the initialize method:
> private void initialize() {
> jLabel = new JLabel();
> ...
>
> But if I choose a JFormattedTextField from the Choose Bean button, and drop the JFormattedTextField on the panel, the VE instantiates it in a lazy getter:
> private JFormattedTextField getJFormattedTextField() (
> if (jFormattedTextField == null...
>
> How does the VE decide where to instantiate the bean?
>
> Thanks,
> Eli


Konstantin Scheglov,
Google, Inc.
Re: How does VE decide whether to instantiate a bean in initialize? [message #145510 is a reply to message #145450] Tue, 02 December 2008 14:58 Go to previous message
Eclipse User
Originally posted by: richkulp.us.NO_SPAM.ibm.com

A few specific widgets such as JLabel have no children and only a few
properties set and would never be referenced in an event outside of the
initialize method, so those were specifically hard-coded to not have a
lazy getter. Everything else has a lazy get.

Eli Lato wrote:
> If I choose a JLabel from the Choose Bean button, and drop the JLabel on the panel, the VE instantiates the JLabel in the initialize method:
> private void initialize() {
> jLabel = new JLabel();
> ...
>
> But if I choose a JFormattedTextField from the Choose Bean button, and drop the JFormattedTextField on the panel, the VE instantiates it in a lazy getter:
> private JFormattedTextField getJFormattedTextField() (
> if (jFormattedTextField == null...
>
> How does the VE decide where to instantiate the bean?
>
> Thanks,
> Eli

--
Thanks,
Rich Kulp
Re: How does VE decide whether to instantiate a bean in initialize? [message #617301 is a reply to message #145450] Wed, 26 November 2008 04:16 Go to previous message
Konstantin Scheglov is currently offline Konstantin Scheglov
Messages: 554
Registered: July 2009
Senior Member
Eli Lato wrote:

I'm not 100% sure, but AFAIK VE always uses "lazy creation" pattern.

> If I choose a JLabel from the Choose Bean button, and drop the JLabel on the panel, the VE instantiates the JLabel in the initialize method:
> private void initialize() {
> jLabel = new JLabel();
> ...
>
> But if I choose a JFormattedTextField from the Choose Bean button, and drop the JFormattedTextField on the panel, the VE instantiates it in a lazy getter:
> private JFormattedTextField getJFormattedTextField() (
> if (jFormattedTextField == null...
>
> How does the VE decide where to instantiate the bean?
>
> Thanks,
> Eli


Konstantin Scheglov,
Google, Inc.
Re: How does VE decide whether to instantiate a bean in initialize? [message #617306 is a reply to message #145450] Tue, 02 December 2008 14:58 Go to previous message
Eclipse User
Originally posted by: richkulp.us.NO_SPAM.ibm.com

A few specific widgets such as JLabel have no children and only a few
properties set and would never be referenced in an event outside of the
initialize method, so those were specifically hard-coded to not have a
lazy getter. Everything else has a lazy get.

Eli Lato wrote:
> If I choose a JLabel from the Choose Bean button, and drop the JLabel on the panel, the VE instantiates the JLabel in the initialize method:
> private void initialize() {
> jLabel = new JLabel();
> ...
>
> But if I choose a JFormattedTextField from the Choose Bean button, and drop the JFormattedTextField on the panel, the VE instantiates it in a lazy getter:
> private JFormattedTextField getJFormattedTextField() (
> if (jFormattedTextField == null...
>
> How does the VE decide where to instantiate the bean?
>
> Thanks,
> Eli

--
Thanks,
Rich Kulp
Previous Topic:Genereta XML file with VE
Next Topic:palette Component on Visual editor
Goto Forum:
  


Current Time: Sat Aug 23 11:34:08 EDT 2014

Powered by FUDForum. Page generated in 0.02371 seconds