Howto add multiple widgets into application?

Hello,

Im sure this issue is explaned somewhere, but either I cannot come up with proper key words for search or just am generally confused about this.

Problem: I need to add multiple widgets into one application.

After looking several IT Mill examples, they all instructs on how to make one single widget and suggest package structure which make me think I should make separate
package for each widget I need to create…
Yet we can give only one widgetset param to web.xml - this points me to direction that I should not write more than one widgetset for multiple widgets after all.

Question: Which one of “figures” below are right way, or if both are wrong, how should I layout multiple widgets?


- project
	- widgets
		- mylist
			- gwt
				- client
					- ui
						IMyList.java
					  MyListWidgetSet.java
				- public
					- mylist
						style.css
				  MyListWidgetSet.gwt.xml
			  MyList.java
		- mybutton
			- gwt
				- client
					- ui
						IMyButton.java
					  MyButtonWidgetSet.java
				- public
					- mybutton
						style.css
				  MyButtonWidgetSet.gwt.xml
			  MyButton.java

- project
	- widgets
		- mywidgets
			- gwt
				- client
					- ui
						IMyList.java
						IMyButton.java
					  MyListWidgetSet.java
					  MyButtonWidgetSet.java
				- public
					- mylist
						style.css
					- mybutton
						style.css
				  MyListWidgetSet.gwt.xml
				  MyButtonWidgetSet.gwt.xml
			  MyList.java
			  MyButton.java

Hi,

They are both incorrect, I’m afraid. You’ll want to one widgetset with many components, i.e something like:


- project
 	- widgets
 		- mywidgets
 			- gwt
 				- client
 					- ui
 						IMyList.java
 						IMyButton.java
 					  MyWidgetSet.java
 				- public
 					- mylist
 						style.css
 					- mybutton
 						style.css
 				  MyWidgetSet.gwt.xml
 			  MyList.java
 			  MyButton.java
 

When adding additional components, the only thing you need to change (except implement your components of course) is to add more if-clauses to your MyWidgetSet.java, so that it returns the component A when needed and component B when needed… :slight_smile:

Hope this helps!

Best regards,
Marc