1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 package com.google.gwt.sample.mail.client;
17 
18 import com.google.gwt.core.client.GWT;
19 import com.google.gwt.event.dom.client.ClickEvent;
20 import com.google.gwt.uibinder.client.UiBinder;
21 import com.google.gwt.uibinder.client.UiField;
22 import com.google.gwt.uibinder.client.UiHandler;
23 import com.google.gwt.user.client.Window;
24 import com.google.gwt.user.client.ui.Anchor;
25 import com.google.gwt.user.client.ui.Composite;
26 import com.google.gwt.user.client.ui.Widget;
27 
28 /**
29  * The top panel, which contains the 'welcome' message and various links.
30  */
31 public class TopPanel extends Composite {
32 
33   interface Binder extends UiBinder<Widget, TopPanel> { }
34   private static final Binder binder = GWT.create(Binder.class);
35 
36   @UiField Anchor signOutLink;
37   @UiField Anchor aboutLink;
38 
TopPanel()39   public TopPanel() {
40     initWidget(binder.createAndBindUi(this));
41   }
42 
43   @UiHandler("aboutLink")
onAboutClicked(ClickEvent event)44   void onAboutClicked(ClickEvent event) {
45     // When the 'About' item is selected, show the AboutDialog.
46     // Note that showing a dialog box does not block -- execution continues
47     // normally, and the dialog fires an event when it is closed.
48     AboutDialog dlg = new AboutDialog();
49     dlg.show();
50     dlg.center();
51   }
52 
53   @UiHandler("signOutLink")
onSignOutClicked(ClickEvent event)54   void onSignOutClicked(ClickEvent event) {
55     Window.alert("If this were implemented, you would be signed out now.");
56   }
57 }
58