10/07/2006 ●S GWT Widget Gallery ca m…v google comett 16 GWT comes with lots of widgets
GWT comes with lots of widgets. Source: http://code.google.com/webtoolkit/ 16 GWT Widget Gallery 10/07/2006
10/07/2006 令Sn Building User Interface Custom Composite Widget
Building User Interface: Custom Composite Widget 10/07/2006
10/07/2006 ●S Custom Composite Widget Composite widget is a specialized widget that can contain another component(typically, a panel) You can easily combine groups of existing widgets into a composite widget that is itself a reusable widget The most effective way to create new widgets 18 Composites are by far the most effective way to create new widgets. You can easily combine groups of existing widgets into a composite that is itself a reusable widget Composite is a specialized widget that can contain another component (typically, a panel) but behaves as if it were its contained widget. Using Composite is preferable to attempting to create complex widgets by subclassing Panel because a composite usually wants to control which methods are publicly accessible without exposing those methods that it would inherit from its panel superclass
Composites are by far the most effective way to create new widgets. You can easily combine groups of existing widgets into a composite that is itself a reusable widget. Composite is a specialized widget that can contain another component (typically, a panel) but behaves as if it were its contained widget. Using Composite is preferable to attempting to create complex widgets by subclassing Panel because a composite usually wants to control which methods are publicly accessible without exposing those methods that it would inherit from its panel superclass Source: http://code.google.com/webtoolkit/ 18 Custom Composite Widget • Composite widget is a specialized widget that can contain another component (typically, a panel) > You can easily combine groups of existing widgets into a composite widget that is itself a reusable widget • The most effective way to create new widgets 10/07/2006
10/07/2006 ●S Example: Composite Widget public static class Optional TextBox extends Composite implements ClickListener ivate TextBox textBox =new TextBox( private Check Box check Box=new Check Box( Constructs an Optional TextBox with the given caption on the check @param caption the caption to be displayed with the check box blic Optional TextBox(String caption)( lace the check above the text box using a vertical panel VerticalPanel panel = new VerticalPanelo anel. add(checkBox ): l Set the check boxs caption, and check it by default. checkBox. addClickListener(this Source hatede googlecomebtc 19
. Source: http://code.google.com/webtoolkit/ 19 Example: Composite Widget public static class OptionalTextBox extends Composite implements ClickListener { private TextBox textBox = new TextBox(); private CheckBox checkBox = new CheckBox(); /** * Constructs an OptionalTextBox with the given caption on the check. * * @param caption the caption to be displayed with the check box */ public OptionalTextBox(String caption) { // Place the check above the text box using a vertical panel. VerticalPanel panel = new VerticalPanel(); panel.add(checkBox); panel.add(textBox); // Set the check box's caption, and check it by default. checkBox.setText(caption); checkBox.setChecked(true); checkBox.addClickListener(this); // All composites must call initWidget() in their constructors. 10/07/2006
10/07/2006 令Sn Building User Interface Event Handling
Building User Interface: Event Handling 10/07/2006