hi, thanks for the help :-) really learned something. but my problem is more UI related, i would like to have something that looks like dropdown and inside there are widgets. sorry if my question was not clear..
me On Nov 20, 7:44 am, Miroslav Genov <[email protected]> wrote: > Hello, > You could use MVP to make things much easier and to make client code to > use only objects instead of primitive widgets such as listbox. > > Here is some example that could make things more clear: > > // this class should be used by your code > class CustomerListBox { > interface Display { > void addListBoxItem(String item); > void removeListBoxItem(Integer index); > //..... > Integer getSelectedItemIndex(); > } > > private final Display display; > private final List<Customer> customers = new ArrayList<Customer>(); > > public CustomerListBox(Display display) { > this.display = display; > } > > public void addCustomer(Customer customer) { > display.addListBoxItem(customer.getCustomerName()); > customers.add(customer); > } > > public Customer getSelectedCustomer() { > return customer.get(display.getSelectedItemIndex()); > } > > public void go(HasWidgets parent) { > parent.add((Widget)display); > } > } > > class CustomerListBoxDisplay extends Composite implements > CustomerListBox.Display { > private ListBox listBox = new ListBox(); > > public CustomerListBoxDisplay() { > initWidget(listBox); > } > > public Integer getSelectedItemIndex() { > return listBox.getSelectedIndex(); > } > // and etc > > } > > CustomerListBox customerListBox = new CustomerListBox(new > CustomerListBoxDisplay()); > > customerListBox.addCustomer(new Customer("1")); > customerListBox.addCustomer(new Customer("2")); > > Customer selectedCustomer = customerListBox.getSelectedCustomer(); > and etc > > Hope this would help. > > Regards, > Miroslav > > On Thu, 2009-11-19 at 14:05 -0800, Jaimon wrote: > > hi, > > > i have need to create a listbox/drop down that create something other > > then just plain text, > > can some one show me how to do it? or tell me if it is possible to do > > it? > > > regards > > Me > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/google-web-toolkit?hl=. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
