Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Required format to maintain for VE-readable code?
Required format to maintain for VE-readable code? [message #79873] Thu, 10 February 2005 17:01 Go to next message
Eclipse User
Originally posted by: gouldfd.kpt.nuwc.navy.mil

We have a large project with multiple developers, and not everyone is using
Eclipse for development. I was looking for information on what format must
be adhered to for code to be readable by VE, so that we can ensure
consistency across GUI classes that people write.

For example, when a button is added, the code includes:


private JButton jButton = null;

private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(224, 135, 45, 38);
}
return jButton;
}

jPanel.add(getJButton(), null);


If I add/edit code outside of VE, do I need to have a "get" method, for
example?

And what is the purpose/meaning of the comment at the end of the class?:
} // @jve:decl-index=0:visual-constraint="118,40"


Thanks very much for any help or pointers to existing
discussions/documentation.

---
Rick Gould
gouldfd@kpt.nuwc.navy.mil
Re: Required format to maintain for VE-readable code? [message #80034 is a reply to message #79873] Mon, 14 February 2005 09:46 Go to previous messageGo to next message
Gili Mendel is currently offline Gili Mendel
Messages: 338
Registered: July 2009
Senior Member
Rick Gould wrote:
> We have a large project with multiple developers, and not everyone is using
> Eclipse for development. I was looking for information on what format must
> be adhered to for code to be readable by VE, so that we can ensure
> consistency across GUI classes that people write.
>
> For example, when a button is added, the code includes:
>
>
> private JButton jButton = null;
>
> private JButton getJButton() {
> if (jButton == null) {
> jButton = new JButton();
> jButton.setBounds(224, 135, 45, 38);
> }
> return jButton;
> }
>
> jPanel.add(getJButton(), null);
>
>
> If I add/edit code outside of VE, do I need to have a "get" method, for
> example?
>
> And what is the purpose/meaning of the comment at the end of the class?:
> } // @jve:decl-index=0:visual-constraint="118,40"
>
>
> Thanks very much for any help or pointers to existing
> discussions/documentation.
>
> ---
> Rick Gould
> gouldfd@kpt.nuwc.navy.mil
>
>
>

The following paper is a bit old, but it will give you most of the
important things... VE 1.0.2 is significantly more flexible. In
particular, the ivjXX limitation was removed... any Swing Component or
SWT widget will be modeled, as well as any instance variable with //
@jve: comment, e.g.,

private String myString = null; // @jve:decl-index=0:

http://www-106.ibm.com/developerworks/websphere/library/tech articles/0303_winchester/winchester.html
Re: Required format to maintain for VE-readable code? [message #80441 is a reply to message #80034] Thu, 17 February 2005 12:40 Go to previous messageGo to next message
Eclipse User
Originally posted by: jscott.rez1.com

Gili Mendel wrote:

> VE 1.0.2 is significantly more flexible. In
> particular, [..] any instance variable with
> // @jve: comment [will be modeled], e.g.,

> private String myString = null; // @jve:decl-index=0:


I would like to understand this better. Does this mean I should be able
to do something like:
myButton.setLabel(getButtonName());
or
myButton.setLabel(buttonName);
instead of using a string literal? Because if so, it's not working for me.

If my question's not clear enough, here's what I've tried but is not
working in the VE. Thanks in advance.


private String buttonName = null; // @jve:decl-index=0:
protected String getButtonName() {
if (buttonName == null) {
buttonName = "Hello";
}
return buttonName ;
}
protected void setButtonName(String aName) {
buttonName = aName;
}

private JButton myButton = null;
protected JButton getMyButton() {
if (myButton == null) {
myButton = new JButton();
myButton.setLabel(getButtonName());
}
return myButton;
}
Re: Required format to maintain for VE-readable code? [message #80625 is a reply to message #80441] Fri, 18 February 2005 10:43 Go to previous message
Gili Mendel is currently offline Gili Mendel
Messages: 338
Registered: July 2009
Senior Member
John Scott wrote:

Try this one, I have commented the lines that failed to work...

private String buttonName = null; // @jve:decl-index=0:
protected String getButtonName() {
if (buttonName == null) {
//buttonName = "Hello"; *** VE does not support this,
// but it should, open a bug
buttonName = new String ("Hello");
}
return buttonName ;
}
protected void setButtonName(String aName) {
buttonName = aName;
}

private JButton myButton = null;
protected JButton getMyButton() {
if (myButton == null) {
myButton = new JButton();
//myButton.setLabel(getButtonName()); *** Label is dep.
myButton.setText(getButtonName());
}
return myButton;
}



Note that @jve:decl-index=0: implies model but do not show on the free
form. to show on the free form you will need
@jve:decl-index=0:visual-constraint="" or
@jve:decl-index=0:visual-constraint="337,130"
Re: Required format to maintain for VE-readable code? [message #605223 is a reply to message #79873] Mon, 14 February 2005 09:46 Go to previous message
Gili Mendel is currently offline Gili Mendel
Messages: 338
Registered: July 2009
Senior Member
Rick Gould wrote:
> We have a large project with multiple developers, and not everyone is using
> Eclipse for development. I was looking for information on what format must
> be adhered to for code to be readable by VE, so that we can ensure
> consistency across GUI classes that people write.
>
> For example, when a button is added, the code includes:
>
>
> private JButton jButton = null;
>
> private JButton getJButton() {
> if (jButton == null) {
> jButton = new JButton();
> jButton.setBounds(224, 135, 45, 38);
> }
> return jButton;
> }
>
> jPanel.add(getJButton(), null);
>
>
> If I add/edit code outside of VE, do I need to have a "get" method, for
> example?
>
> And what is the purpose/meaning of the comment at the end of the class?:
> } // @jve:decl-index=0:visual-constraint="118,40"
>
>
> Thanks very much for any help or pointers to existing
> discussions/documentation.
>
> ---
> Rick Gould
> gouldfd@kpt.nuwc.navy.mil
>
>
>

The following paper is a bit old, but it will give you most of the
important things... VE 1.0.2 is significantly more flexible. In
particular, the ivjXX limitation was removed... any Swing Component or
SWT widget will be modeled, as well as any instance variable with //
@jve: comment, e.g.,

private String myString = null; // @jve:decl-index=0:

http://www-106.ibm.com/developerworks/websphere/library/tech articles/0303_winchester/winchester.html
Re: Required format to maintain for VE-readable code? [message #605327 is a reply to message #80034] Thu, 17 February 2005 12:40 Go to previous message
Eclipse User
Originally posted by: jscott.rez1.com

Gili Mendel wrote:

> VE 1.0.2 is significantly more flexible. In
> particular, [..] any instance variable with
> // @jve: comment [will be modeled], e.g.,

> private String myString = null; // @jve:decl-index=0:


I would like to understand this better. Does this mean I should be able
to do something like:
myButton.setLabel(getButtonName());
or
myButton.setLabel(buttonName);
instead of using a string literal? Because if so, it's not working for me.

If my question's not clear enough, here's what I've tried but is not
working in the VE. Thanks in advance.


private String buttonName = null; // @jve:decl-index=0:
protected String getButtonName() {
if (buttonName == null) {
buttonName = "Hello";
}
return buttonName ;
}
protected void setButtonName(String aName) {
buttonName = aName;
}

private JButton myButton = null;
protected JButton getMyButton() {
if (myButton == null) {
myButton = new JButton();
myButton.setLabel(getButtonName());
}
return myButton;
}
Re: Required format to maintain for VE-readable code? [message #605382 is a reply to message #80441] Fri, 18 February 2005 10:43 Go to previous message
Gili Mendel is currently offline Gili Mendel
Messages: 338
Registered: July 2009
Senior Member
John Scott wrote:

Try this one, I have commented the lines that failed to work...

private String buttonName = null; // @jve:decl-index=0:
protected String getButtonName() {
if (buttonName == null) {
//buttonName = "Hello"; *** VE does not support this,
// but it should, open a bug
buttonName = new String ("Hello");
}
return buttonName ;
}
protected void setButtonName(String aName) {
buttonName = aName;
}

private JButton myButton = null;
protected JButton getMyButton() {
if (myButton == null) {
myButton = new JButton();
//myButton.setLabel(getButtonName()); *** Label is dep.
myButton.setText(getButtonName());
}
return myButton;
}



Note that @jve:decl-index=0: implies model but do not show on the free
form. to show on the free form you will need
@jve:decl-index=0:visual-constraint="" or
@jve:decl-index=0:visual-constraint="337,130"
Previous Topic:Extending VE with own Beans
Next Topic:java.lang.NoClassDefFoundError for VE
Goto Forum:
  


Current Time: Fri Aug 22 07:54:32 EDT 2014

Powered by FUDForum. Page generated in 0.11165 seconds