Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » VE and Custom-Widgets
VE and Custom-Widgets [message #76815] Fri, 14 January 2005 15:56 Go to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Is it possible to use custom widgets in VE. The problem I'm facing is
that SWT-Widget should not be subclassed and that's why I'm going to
layout my classes in the following manner:

--------------------8<--------------------
Object
+ AbstractSwtWidget
+ SingleValueField (uses an org.eclipse.swt.Text)
+ TextField
+ NumberField
+ DateField
+ FormattedField
+ MultiValueField
+ DropDown (uses an org.eclipse.swt.Combo)
+ ListBox (uses an org.eclipse.swt.List )
--------------------8<--------------------

All of these fields have at least these constructors:

* TextField() // not really useful but without its not a been
* TextField(Composite parent, int style) // same than all SWT-Widgets

Can I use something like that in VE out of the box (I assume not)?
What has to done to use something like that in VE?
Can there be done at all?

Does this also suffer from the problem but there is a solution to this
problem? I think this is the preferred way in SWT to create your own
widget if I have understood the docs appropiately.

----------------8<----------------
Object
+ DateField (uses an org.eclipse.swt.Text)
+ NumberField (uses an org.eclipse.swt.Text)
----------------8<----------------

Are there any known problem regarding eclipse-3.1M4 and VE because on
eclipse 3.0.1 everything is working as expected but eclipse 3.1M4 I get
a ClassCastException

Tom
Re: VE and Custom-Widgets [message #76832 is a reply to message #76815] Fri, 14 January 2005 16:19 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Tom Schindl wrote:
> Hi,
>
> Is it possible to use custom widgets in VE. The problem I'm facing is
> that SWT-Widget should not be subclassed and that's why I'm going to
> layout my classes in the following manner:
>
> --------------------8<--------------------
> Object
> + AbstractSwtWidget
> + SingleValueField (uses an org.eclipse.swt.Text)
> + TextField
> + NumberField
> + DateField
> + FormattedField
> + MultiValueField
> + DropDown (uses an org.eclipse.swt.Combo)
> + ListBox (uses an org.eclipse.swt.List )
> --------------------8<--------------------
>
> All of these fields have at least these constructors:
>
> * TextField() // not really useful but without its not a been
> * TextField(Composite parent, int style) // same than all SWT-Widgets

Rich or somebody please correct me if I'm wrong, but I don't believe
this will work in VE because it does not inherit from anywhere in the
SWT class hierarchy.

The way SWT itself does this sort of thing is to subclass either Canvas
or Composite and draw or embed the other control inside. See CLabel,
CCombo, etc. (the classes that begin with an extra 'C'.

If you subclass Composite, you can even use VE to design your new
control. :-)

Once you have your custom control written, you can use the "Choose Bean"
button on the tool bar to place it on your form.

Or read any of several recent threads about how to add your control to
the palette.


Regards,

Dave Orme
--
Visual Editor Project leader
db4objects Senior Engineer (www.db4o.com)
Essential Data Project maintainer (essentialdata.sf.net)
Re: VE and Custom-Widgets [message #76864 is a reply to message #76832] Fri, 14 January 2005 16:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
David Orme wrote:
>
> The way SWT itself does this sort of thing is to subclass either Canvas
> or Composite and draw or embed the other control inside. See CLabel,
> CCombo, etc. (the classes that begin with an extra 'C'.
>
> If you subclass Composite, you can even use VE to design your new
> control. :-)
>
> Once you have your custom control written, you can use the "Choose Bean"
> button on the tool bar to place it on your form.
>

So this would work?

-------------------8<-------------------
Object
+ AbstractSwtWidget (extends org.eclipse.swt.Composite)
+ SingleValueField (uses an org.eclipse.swt.Text)
+ TextField
+ NumberField
+ DateField
+ FormattedField
+ MultiValueField
+ DropDown (uses an org.eclipse.swt.Combo)
+ ListBox (uses an org.eclipse.swt.List )
-------------------8<-------------------

> Or read any of several recent threads about how to add your control to
> the palette.
>
>
> Regards,
>
> Dave Orme
Re: VE and Custom-Widgets [message #76911 is a reply to message #76864] Fri, 14 January 2005 18:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

As long as your constructor is

xyz(Composite parent, int style)

Then we should be able to handle it.

Tom Schindl wrote:
> David Orme wrote:
>
>>
>> The way SWT itself does this sort of thing is to subclass either
>> Canvas or Composite and draw or embed the other control inside. See
>> CLabel, CCombo, etc. (the classes that begin with an extra 'C'.
>>
>> If you subclass Composite, you can even use VE to design your new
>> control. :-)
>>
>> Once you have your custom control written, you can use the "Choose
>> Bean" button on the tool bar to place it on your form.
>>
>
> So this would work?
>
> -------------------8<-------------------
> Object
> + AbstractSwtWidget (extends org.eclipse.swt.Composite)
> + SingleValueField (uses an org.eclipse.swt.Text)
> + TextField
> + NumberField
> + DateField
> + FormattedField
> + MultiValueField
> + DropDown (uses an org.eclipse.swt.Combo)
> + ListBox (uses an org.eclipse.swt.List )
> -------------------8<-------------------
>
>> Or read any of several recent threads about how to add your control to
>> the palette.
>>
>>
>> Regards,
>>
>> Dave Orme
>
>
>

--
Thanks,
Rich Kulp
Re: VE and Custom-Widgets [message #77101 is a reply to message #76911] Sun, 16 January 2005 13:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tomAtLinux.gmx.at

Hi Rich,

do you mean that I could use the structure without deriving my
widget from a composite?

Tom

Rich Kulp wrote:
> As long as your constructor is
>
> xyz(Composite parent, int style)
>
> Then we should be able to handle it.
>
> Tom Schindl wrote:
>
>> David Orme wrote:
>>
>>>
>>> The way SWT itself does this sort of thing is to subclass either
>>> Canvas or Composite and draw or embed the other control inside. See
>>> CLabel, CCombo, etc. (the classes that begin with an extra 'C'.
>>>
>>> If you subclass Composite, you can even use VE to design your new
>>> control. :-)
>>>
>>> Once you have your custom control written, you can use the "Choose
>>> Bean" button on the tool bar to place it on your form.
>>>
>>
>> So this would work?
>>
>> -------------------8<-------------------
>> Object
>> + AbstractSwtWidget (extends org.eclipse.swt.Composite)
>> + SingleValueField (uses an org.eclipse.swt.Text)
>> + TextField
>> + NumberField
>> + DateField
>> + FormattedField
>> + MultiValueField
>> + DropDown (uses an org.eclipse.swt.Combo)
>> + ListBox (uses an org.eclipse.swt.List )
>> -------------------8<-------------------
>>
>>> Or read any of several recent threads about how to add your control
>>> to the palette.
>>>
>>>
>>> Regards,
>>>
>>> Dave Orme
>>
>>
>>
>>
>
Re: VE and Custom-Widgets [message #77143 is a reply to message #77101] Sun, 16 January 2005 21:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

No, I meant in addition. You need the right constructor and you need to
inherit from Composite or Canvas.



--
Thanks,
Rich Kulp
Re: VE and Custom-Widgets [message #77331 is a reply to message #77143] Mon, 17 January 2005 14:30 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ok. I have now rethought my Object-Structure and use a MVC. One more
question what when it comes to table-controls. Can I also have a:

TextColumn (extends TableColumn) and use it in the VE?

Tom

Rich Kulp wrote:
> No, I meant in addition. You need the right constructor and you need to
> inherit from Composite or Canvas.
>
>
>
Re: VE and Custom-Widgets [message #77345 is a reply to message #77331] Mon, 17 January 2005 14:54 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

That's a good question. We've never tested it, so I don't know. Give it
a try, but make sure you have a constructor of

public TextColumn (Table parent, int style)



Tom Schindl wrote:
> Ok. I have now rethought my Object-Structure and use a MVC. One more
> question what when it comes to table-controls. Can I also have a:
>
> TextColumn (extends TableColumn) and use it in the VE?
>
> Tom
>
> Rich Kulp wrote:
>
>> No, I meant in addition. You need the right constructor and you need
>> to inherit from Composite or Canvas.
>>
>>
>>

--
Thanks,
Rich Kulp
Re: VE and Custom-Widgets [message #604431 is a reply to message #76815] Fri, 14 January 2005 16:19 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Tom Schindl wrote:
> Hi,
>
> Is it possible to use custom widgets in VE. The problem I'm facing is
> that SWT-Widget should not be subclassed and that's why I'm going to
> layout my classes in the following manner:
>
> --------------------8<--------------------
> Object
> + AbstractSwtWidget
> + SingleValueField (uses an org.eclipse.swt.Text)
> + TextField
> + NumberField
> + DateField
> + FormattedField
> + MultiValueField
> + DropDown (uses an org.eclipse.swt.Combo)
> + ListBox (uses an org.eclipse.swt.List )
> --------------------8<--------------------
>
> All of these fields have at least these constructors:
>
> * TextField() // not really useful but without its not a been
> * TextField(Composite parent, int style) // same than all SWT-Widgets

Rich or somebody please correct me if I'm wrong, but I don't believe
this will work in VE because it does not inherit from anywhere in the
SWT class hierarchy.

The way SWT itself does this sort of thing is to subclass either Canvas
or Composite and draw or embed the other control inside. See CLabel,
CCombo, etc. (the classes that begin with an extra 'C'.

If you subclass Composite, you can even use VE to design your new
control. :-)

Once you have your custom control written, you can use the "Choose Bean"
button on the tool bar to place it on your form.

Or read any of several recent threads about how to add your control to
the palette.


Regards,

Dave Orme
--
Visual Editor Project leader
db4objects Senior Engineer (www.db4o.com)
Essential Data Project maintainer (essentialdata.sf.net)
Re: VE and Custom-Widgets [message #604441 is a reply to message #76832] Fri, 14 January 2005 16:39 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
David Orme wrote:
>
> The way SWT itself does this sort of thing is to subclass either Canvas
> or Composite and draw or embed the other control inside. See CLabel,
> CCombo, etc. (the classes that begin with an extra 'C'.
>
> If you subclass Composite, you can even use VE to design your new
> control. :-)
>
> Once you have your custom control written, you can use the "Choose Bean"
> button on the tool bar to place it on your form.
>

So this would work?

-------------------8<-------------------
Object
+ AbstractSwtWidget (extends org.eclipse.swt.Composite)
+ SingleValueField (uses an org.eclipse.swt.Text)
+ TextField
+ NumberField
+ DateField
+ FormattedField
+ MultiValueField
+ DropDown (uses an org.eclipse.swt.Combo)
+ ListBox (uses an org.eclipse.swt.List )
-------------------8<-------------------

> Or read any of several recent threads about how to add your control to
> the palette.
>
>
> Regards,
>
> Dave Orme
Re: VE and Custom-Widgets [message #604454 is a reply to message #76864] Fri, 14 January 2005 18:43 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

As long as your constructor is

xyz(Composite parent, int style)

Then we should be able to handle it.

Tom Schindl wrote:
> David Orme wrote:
>
>>
>> The way SWT itself does this sort of thing is to subclass either
>> Canvas or Composite and draw or embed the other control inside. See
>> CLabel, CCombo, etc. (the classes that begin with an extra 'C'.
>>
>> If you subclass Composite, you can even use VE to design your new
>> control. :-)
>>
>> Once you have your custom control written, you can use the "Choose
>> Bean" button on the tool bar to place it on your form.
>>
>
> So this would work?
>
> -------------------8<-------------------
> Object
> + AbstractSwtWidget (extends org.eclipse.swt.Composite)
> + SingleValueField (uses an org.eclipse.swt.Text)
> + TextField
> + NumberField
> + DateField
> + FormattedField
> + MultiValueField
> + DropDown (uses an org.eclipse.swt.Combo)
> + ListBox (uses an org.eclipse.swt.List )
> -------------------8<-------------------
>
>> Or read any of several recent threads about how to add your control to
>> the palette.
>>
>>
>> Regards,
>>
>> Dave Orme
>
>
>

--
Thanks,
Rich Kulp
Re: VE and Custom-Widgets [message #604528 is a reply to message #76911] Sun, 16 January 2005 13:06 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Rich,

do you mean that I could use the structure without deriving my
widget from a composite?

Tom

Rich Kulp wrote:
> As long as your constructor is
>
> xyz(Composite parent, int style)
>
> Then we should be able to handle it.
>
> Tom Schindl wrote:
>
>> David Orme wrote:
>>
>>>
>>> The way SWT itself does this sort of thing is to subclass either
>>> Canvas or Composite and draw or embed the other control inside. See
>>> CLabel, CCombo, etc. (the classes that begin with an extra 'C'.
>>>
>>> If you subclass Composite, you can even use VE to design your new
>>> control. :-)
>>>
>>> Once you have your custom control written, you can use the "Choose
>>> Bean" button on the tool bar to place it on your form.
>>>
>>
>> So this would work?
>>
>> -------------------8<-------------------
>> Object
>> + AbstractSwtWidget (extends org.eclipse.swt.Composite)
>> + SingleValueField (uses an org.eclipse.swt.Text)
>> + TextField
>> + NumberField
>> + DateField
>> + FormattedField
>> + MultiValueField
>> + DropDown (uses an org.eclipse.swt.Combo)
>> + ListBox (uses an org.eclipse.swt.List )
>> -------------------8<-------------------
>>
>>> Or read any of several recent threads about how to add your control
>>> to the palette.
>>>
>>>
>>> Regards,
>>>
>>> Dave Orme
>>
>>
>>
>>
>
Re: VE and Custom-Widgets [message #604542 is a reply to message #77101] Sun, 16 January 2005 21:12 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

No, I meant in addition. You need the right constructor and you need to
inherit from Composite or Canvas.



--
Thanks,
Rich Kulp
Re: VE and Custom-Widgets [message #604589 is a reply to message #77143] Mon, 17 January 2005 14:30 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ok. I have now rethought my Object-Structure and use a MVC. One more
question what when it comes to table-controls. Can I also have a:

TextColumn (extends TableColumn) and use it in the VE?

Tom

Rich Kulp wrote:
> No, I meant in addition. You need the right constructor and you need to
> inherit from Composite or Canvas.
>
>
>
Re: VE and Custom-Widgets [message #604595 is a reply to message #77331] Mon, 17 January 2005 14:54 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

That's a good question. We've never tested it, so I don't know. Give it
a try, but make sure you have a constructor of

public TextColumn (Table parent, int style)



Tom Schindl wrote:
> Ok. I have now rethought my Object-Structure and use a MVC. One more
> question what when it comes to table-controls. Can I also have a:
>
> TextColumn (extends TableColumn) and use it in the VE?
>
> Tom
>
> Rich Kulp wrote:
>
>> No, I meant in addition. You need the right constructor and you need
>> to inherit from Composite or Canvas.
>>
>>
>>

--
Thanks,
Rich Kulp
Previous Topic:Using customised wrapper beans in VE
Next Topic:Import JBuilder GUI Projects to Eclipse VE
Goto Forum:
  


Current Time: Wed Jul 17 16:17:04 GMT 2024

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

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

Back to the top