Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Custom GWT component
Custom GWT component [message #662857] Fri, 01 April 2011 09:16 Go to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
hello,
I created my own GWT component that inherits from composite and I managed to add it to my palette.Then i creates the XML file to specify the method invocation, but it does not work.
to do that i use this toturiel in NewComponentsToturiel.pdf and DesignerCustomizationAPI.PDF


the code of custum component is:
package com.sqsdqs.client;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;

public class Mybutton extends Composite{
Button vermeg = new Button("VERMEG");
public Mybutton(){
VerticalPanel panel = new VerticalPanel();


panel.add(vermeg);
initWidget(panel);
}




public void setButton(){
Window.alert("jjjjj");
vermeg.setText("bhjbhj");
}


}

and the core of xml file is:

<?xml version="1.0" encoding="UTF-8"?>
<component xmlns:scr="http://www.eclipse.org/wb/WBPComponent" name="Mybutton">
<creation>
<source><![CDATA[new com.component.client.Mybutton()]]></source>
<invocation signature="setButton()"/>
</creation>
</component>
Re: Custom GWT component [message #662924 is a reply to message #662857] Fri, 01 April 2011 13:56 Go to previous messageGo to next message
Wojtek Surowka is currently offline Wojtek SurowkaFriend
Messages: 10
Registered: March 2011
Junior Member
The component is in the package "com.sqsdqs.client", and in the xml file you have a different one "com.component.client".

Regards,
Wojtek
Re: Custom GWT component [message #662940 is a reply to message #662924] Fri, 01 April 2011 14:19 Go to previous messageGo to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
Think I have corrected, but it dont works. The xml file and java file must be in same folder?
Re: Custom GWT component [message #662944 is a reply to message #662940] Fri, 01 April 2011 14:26 Go to previous messageGo to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
I did not understand, when I created my costum button how he knows there is a xml file that corresponds?
Beside, in other meaning How it work the relation between Mybutton.java and Mybutton.wbp-component.xml knowing that not in same folder.
Re: Custom GWT component [message #662946 is a reply to message #662940] Fri, 01 April 2011 14:36 Go to previous messageGo to next message
Wojtek Surowka is currently offline Wojtek SurowkaFriend
Messages: 10
Registered: March 2011
Junior Member
The xml file must be named Mybutton.wbp-component.xml and it should be in the same folder where the .class file is. Normally it is the subfolder of bin folder, in your case bin/com/sqsdqs/client. (The xml file could be also placed in wbp-meta folder, but for testing /bin is easier).

Regards,
Wojtek
Re: Custom GWT component [message #662952 is a reply to message #662946] Fri, 01 April 2011 14:47 Go to previous messageGo to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
it's very clear.But i am in GWT project.so .class not exist.
do you can tell me what is steps to create my custom component and using .wbp-component for this component.
thinks
Re: Custom GWT component [message #663152 is a reply to message #662952] Mon, 04 April 2011 06:55 Go to previous messageGo to next message
Wojtek Surowka is currently offline Wojtek SurowkaFriend
Messages: 10
Registered: March 2011
Junior Member
You can also put the xml file in the nested folders named wbp-meta/com/sqsdqs/client where wbp-meta is at the same level as src folder

Regards,
Wojtek
Re: Custom GWT component [message #663186 is a reply to message #663152] Mon, 04 April 2011 09:23 Go to previous messageGo to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
My xml file is :

<?xml version="1.0" encoding="UTF-8"?>
<component xmlns="http://www.eclipse.org/wb/WBPComponent">
<creation>
<source><![CDATA[new com.sqsdqs.client.Mybutton()]]></source>
<invocation signature="setButton()"/>
</creation>
</component>

and i place it in some level as src folder and it dont work.

[Updated on: Mon, 04 April 2011 09:24]

Report message to a moderator

Re: Custom GWT component [message #663237 is a reply to message #663186] Mon, 04 April 2011 12:42 Go to previous messageGo to next message
Wojtek Surowka is currently offline Wojtek SurowkaFriend
Messages: 10
Registered: March 2011
Junior Member
It should not be at the same level as src. As I have written before, the structure should be:

- src
    ,,,
- wbp-meta
   - com
      - sqsdqs
          - client
              - Mybutton.wbp-component.xml

Regards,
Wojtek

[Updated on: Mon, 04 April 2011 12:43]

Report message to a moderator

Re: Custom GWT component [message #663246 is a reply to message #663237] Mon, 04 April 2011 12:54 Go to previous messageGo to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
yes i understand you.
I did as you said and doesn't work. Embarrassed
Re: Custom GWT component [message #663262 is a reply to message #663246] Mon, 04 April 2011 13:35 Go to previous messageGo to next message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
is what I must mention the file. wbp-component that I use in defining component in the palette?

this is my file .wbp-palette.xml

<?xml version="1.0" encoding="UTF-8"?>
<palette>
<category id="someUniqueId" name="Custom category" description="Category added for project Azeer" open="true">
<component class="com.sqsdqs.client.Mybutton"/>
<component class="javax.swing.JRadioButton" name="Your name" description="You can write any description here."/>
</category>
</palette>

[Updated on: Mon, 04 April 2011 13:36]

Report message to a moderator

Re: Custom GWT component [message #663263 is a reply to message #663246] Mon, 04 April 2011 13:36 Go to previous messageGo to next message
Wojtek Surowka is currently offline Wojtek SurowkaFriend
Messages: 10
Registered: March 2011
Junior Member
It works for me, and it should generally work. I don't know how can I help you more. Check all the names for the correct spelling. Remember about reopening the editor window, or better restarting Eclipse after placing the file in the appropriate directory, so GWT Designer can see the xml file. You can also try to put the xml file beside Mybutton.class file, which should be located at <project>/war/WEB-INF/classes/com/sqsdqs/client, but wbp-meta location is better for GWT.

Regards,
Wojtek
Re: Custom GWT component [message #663269 is a reply to message #663262] Mon, 04 April 2011 13:40 Go to previous messageGo to next message
Wojtek Surowka is currently offline Wojtek SurowkaFriend
Messages: 10
Registered: March 2011
Junior Member
The wbp-component.xml files are located automatically based on the class name of the component, and in other files - such as palette, etc. - you should continue to use the classes as usual.

Regards,
Wojtek
Re: Custom GWT component [message #663274 is a reply to message #663263] Mon, 04 April 2011 13:53 Go to previous message
George  is currently offline George Friend
Messages: 34
Registered: March 2011
Member
Very nice.Now wahen i reboots eclipse it work perfectky.
think you very much
Previous Topic:Class diagram of WB
Next Topic:Generation java file
Goto Forum:
  


Current Time: Fri Mar 29 14:25:31 GMT 2024

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

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

Back to the top