Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Problems with classes that extends from JFrame in VE.
Problems with classes that extends from JFrame in VE. [message #17786] Tue, 03 February 2004 10:51 Go to next message
David is currently offline DavidFriend
Messages: 34
Registered: July 2009
Member
Hi!

I've a class named TFrame that extends from JFrame.

In VE, when I drag a JFrame class into the editor, VE creates two objects:
a JFrame and a JPanel inside.

When I drag the TFrame class VE only creates this class.

¿can I do that VE creates a JPanel class inside TFrame class too?

Note: I've observed that right click over TFrame class in the javabeans
tree permits me add a ContentPane but I need that VE adds automatically
the JPanel as JFrame case.

Many thanks.
Re: Problems with classes that extends from JFrame in VE. [message #17792 is a reply to message #17786] Tue, 03 February 2004 14:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mendelgili.netscape.net

David Díaz wrote:
> Hi!
>
> I've a class named TFrame that extends from JFrame.
>
> In VE, when I drag a JFrame class into the editor, VE creates two objects:
> a JFrame and a JPanel inside.
>
> When I drag the TFrame class VE only creates this class.
>
> ¿can I do that VE creates a JPanel class inside TFrame class too?
>
> Note: I've observed that right click over TFrame class in the javabeans
> tree permits me add a ContentPane but I need that VE adds automatically
> the JPanel as JFrame case.
>
> Many thanks.
>
>

The idea is that if you drop a JFrame, we will create a contentPane for
you, as we do not support implicits at this time. It is a temporary
bandage and given that for a JFrame the content pane is a JPanel all is
well.

If you have a customed JFrame, the assumption is that you it already has
a content pane. Hence we do not want to set a new contentPane and
"clear" the old contentPane that was most likely customed by the
customed JFrame class.

In any case, it works as following:

The JFrame (xmi) override file has the following in it


<keyedValues xsi:type="ecore:EStringToStringMapEntry"
key="org.eclipse.ve.internal.cde.core.creationtool.policy"

value=" org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.RootPane CreationPolicy "/>



This is saying that we will drive the RootPaneCreationPolicy to when a
JFrame is created (see EMFCreationTool.getCommand())

RootPaneCreationPolicy.getCommand() will only create a content pane for
a Swing component (only): if (((JavaPackage)
javaClass.getEPackage()).getPackageName().equals("javax.swing "))


If you want to override this... create an override to the TFrame class,
and create your own Creation polity.
Re: Problems with classes that extends from JFrame in VE. [message #17798 is a reply to message #17792] Wed, 04 February 2004 10:19 Go to previous message
David is currently offline DavidFriend
Messages: 34
Registered: July 2009
Member
Ok.

I've created a TFrame.override and modify the RootPaneCreationPolicy
adding my own package in the 'if' condition.

Now, VE creates a ContentPane when I add a TFrame.

Many thanks.
Re: Problems with classes that extends from JFrame in VE. [message #580079 is a reply to message #17786] Tue, 03 February 2004 14:26 Go to previous message
Gili Mendel is currently offline Gili MendelFriend
Messages: 338
Registered: July 2009
Senior Member
David Díaz wrote:
> Hi!
>
> I've a class named TFrame that extends from JFrame.
>
> In VE, when I drag a JFrame class into the editor, VE creates two objects:
> a JFrame and a JPanel inside.
>
> When I drag the TFrame class VE only creates this class.
>
> ¿can I do that VE creates a JPanel class inside TFrame class too?
>
> Note: I've observed that right click over TFrame class in the javabeans
> tree permits me add a ContentPane but I need that VE adds automatically
> the JPanel as JFrame case.
>
> Many thanks.
>
>

The idea is that if you drop a JFrame, we will create a contentPane for
you, as we do not support implicits at this time. It is a temporary
bandage and given that for a JFrame the content pane is a JPanel all is
well.

If you have a customed JFrame, the assumption is that you it already has
a content pane. Hence we do not want to set a new contentPane and
"clear" the old contentPane that was most likely customed by the
customed JFrame class.

In any case, it works as following:

The JFrame (xmi) override file has the following in it


<keyedValues xsi:type="ecore:EStringToStringMapEntry"
key="org.eclipse.ve.internal.cde.core.creationtool.policy"

value=" org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.RootPane CreationPolicy "/>



This is saying that we will drive the RootPaneCreationPolicy to when a
JFrame is created (see EMFCreationTool.getCommand())

RootPaneCreationPolicy.getCommand() will only create a content pane for
a Swing component (only): if (((JavaPackage)
javaClass.getEPackage()).getPackageName().equals("javax.swing "))


If you want to override this... create an override to the TFrame class,
and create your own Creation polity.
Re: Problems with classes that extends from JFrame in VE. [message #580122 is a reply to message #17792] Wed, 04 February 2004 10:19 Go to previous message
David is currently offline DavidFriend
Messages: 34
Registered: July 2009
Member
Ok.

I've created a TFrame.override and modify the RootPaneCreationPolicy
adding my own package in the 'if' condition.

Now, VE creates a ContentPane when I add a TFrame.

Many thanks.
Previous Topic:Problems on opening VisualClass with VE
Next Topic:VE: More about 'get methods' when I select a variable for a property.
Goto Forum:
  


Current Time: Wed Feb 05 09:45:17 GMT 2025

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

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

Back to the top