Home » Archived » Visual Editor (VE) » Prevent adding into a component in VE
Prevent adding into a component in VE [message #69287] |
Thu, 28 October 2004 02:48 |
Eclipse User |
|
|
|
Originally posted by: txfen.hands.com.my
Hiya guys...
I actually have this component, let's say MyTextPanel, which extends AWT
Container, and have a few textfields inside, so user can use this
component as a bean, inside VE.
The problem is, because it extends Container, if this MyTextPanel is added
to the designer, user can actually add another component into MyTextPanel,
which is not what I want.
Is there anyway which i can prevent user from adding component into
MyTextPanel?
Thanks a lot guys~
klutzie
|
|
|
Re: Prevent adding into a component in VE [message #69346 is a reply to message #69287] |
Thu, 28 October 2004 16:50 |
Eclipse User |
|
|
|
Originally posted by: mendelgili.netscape.net
klutzie wrote:
> Hiya guys...
>
> I actually have this component, let's say MyTextPanel, which extends AWT
> Container, and have a few textfields inside, so user can use this
> component as a bean, inside VE.
>
> The problem is, because it extends Container, if this MyTextPanel is added
> to the designer, user can actually add another component into MyTextPanel,
> which is not what I want.
>
> Is there anyway which i can prevent user from adding component into
> MyTextPanel?
>
> Thanks a lot guys~
>
>
>
> klutzie
>
You can create BeanInfo for your bean and hide properties you do not need to show on the PS.
You can also hide these properties from a VE override file, but it will take a plugin to do so.
|
|
|
Re: Prevent adding into a component in VE [message #69985 is a reply to message #69287] |
Thu, 04 November 2004 10:28 |
Joe Winchester Messages: 496 Registered: July 2009 |
Senior Member |
|
|
Hi klutzie,
> I actually have this component, let's say MyTextPanel, which extends AWT
> Container, and have a few textfields inside, so user can use this
> component as a bean, inside VE.
>
> The problem is, because it extends Container, if this MyTextPanel is added
> to the designer, user can actually add another component into MyTextPanel,
> which is not what I want.
>
> Is there anyway which i can prevent user from adding component into
> MyTextPanel?
We have the same problem for Swing where everything (JButton,
JTextField, etc...) is really a Container subclass. What we do is
override the behavior of the edit parts (and its edit policies) in
JComponent which subclasses Container and is the root of all Swing
components.
One thing to try is inheriting from JComponent instead of Container and
seeing what happens. I think you'll pick up our JComponent behavior
which disallows your component from being a container.
If this doesn't work I could talk you through writing a plugin with an
override to your specific bean, but before that I'd like you to try
subclassing JComponent as if this works it'll be the easiest solution
for you.
Best regards,
Joe Winchester
|
|
|
Re: Prevent adding into a component in VE [message #602395 is a reply to message #69287] |
Thu, 28 October 2004 16:50 |
Gili Mendel Messages: 338 Registered: July 2009 |
Senior Member |
|
|
klutzie wrote:
> Hiya guys...
>
> I actually have this component, let's say MyTextPanel, which extends AWT
> Container, and have a few textfields inside, so user can use this
> component as a bean, inside VE.
>
> The problem is, because it extends Container, if this MyTextPanel is added
> to the designer, user can actually add another component into MyTextPanel,
> which is not what I want.
>
> Is there anyway which i can prevent user from adding component into
> MyTextPanel?
>
> Thanks a lot guys~
>
>
>
> klutzie
>
You can create BeanInfo for your bean and hide properties you do not need to show on the PS.
You can also hide these properties from a VE override file, but it will take a plugin to do so.
|
|
|
Re: Prevent adding into a component in VE [message #602600 is a reply to message #69287] |
Thu, 04 November 2004 10:28 |
Joe Winchester Messages: 496 Registered: July 2009 |
Senior Member |
|
|
Hi klutzie,
> I actually have this component, let's say MyTextPanel, which extends AWT
> Container, and have a few textfields inside, so user can use this
> component as a bean, inside VE.
>
> The problem is, because it extends Container, if this MyTextPanel is added
> to the designer, user can actually add another component into MyTextPanel,
> which is not what I want.
>
> Is there anyway which i can prevent user from adding component into
> MyTextPanel?
We have the same problem for Swing where everything (JButton,
JTextField, etc...) is really a Container subclass. What we do is
override the behavior of the edit parts (and its edit policies) in
JComponent which subclasses Container and is the root of all Swing
components.
One thing to try is inheriting from JComponent instead of Container and
seeing what happens. I think you'll pick up our JComponent behavior
which disallows your component from being a container.
If this doesn't work I could talk you through writing a plugin with an
override to your specific bean, but before that I'd like you to try
subclassing JComponent as if this works it'll be the easiest solution
for you.
Best regards,
Joe Winchester
|
|
|
Goto Forum:
Current Time: Sat Oct 19 17:51:03 GMT 2024
Powered by FUDForum. Page generated in 0.03619 seconds
|