Subversion Repositories SmartDukaan

Rev

Rev 2427 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1961 ankur.sing 1
package in.shop2020.catalog.dashboard.client;
2
 
3
import com.google.gwt.core.client.GWT;
4
import com.google.gwt.event.dom.client.ClickEvent;
2489 ankur.sing 5
import com.google.gwt.event.dom.client.ClickHandler;
1961 ankur.sing 6
import com.google.gwt.uibinder.client.UiBinder;
7
import com.google.gwt.uibinder.client.UiField;
8
import com.google.gwt.uibinder.client.UiHandler;
9
import com.google.gwt.user.client.ui.Anchor;
2489 ankur.sing 10
import com.google.gwt.user.client.ui.Button;
1961 ankur.sing 11
import com.google.gwt.user.client.ui.Composite;
2489 ankur.sing 12
import com.google.gwt.user.client.ui.DialogBox;
1961 ankur.sing 13
import com.google.gwt.user.client.ui.HTML;
14
import com.google.gwt.user.client.ui.Widget;
15
 
16
/**
2427 ankur.sing 17
 * Contains logo, welcome message, about and sign out link.
1961 ankur.sing 18
 */
19
public class TopPanel extends Composite {
20
 
21
  interface Binder extends UiBinder<Widget, TopPanel> { }
22
  private static final Binder binder = GWT.create(Binder.class);
23
 
24
  @UiField Anchor signOutLink;
25
  @UiField Anchor aboutLink;
26
  @UiField HTML greetingLabel;
27
 
28
  public TopPanel() {
29
    initWidget(binder.createAndBindUi(this));
30
  }
31
 
32
  @UiHandler("aboutLink")
33
  void onAboutClicked(ClickEvent event) {
2489 ankur.sing 34
    final DialogBox dlg = new DialogBox();
35
    Button ok = new Button("Close");
36
    ok.addClickHandler(new ClickHandler() {
37
        @Override
38
        public void onClick(ClickEvent event) {
39
            dlg.hide();               
40
        }
41
    });
1961 ankur.sing 42
    dlg.setText("Catalog Dashboard.\nYou can edit the item details here.");
2489 ankur.sing 43
    dlg.setWidget(ok);
44
    dlg.setAutoHideEnabled(true);
45
    dlg.setGlassEnabled(true);
46
    dlg.setPopupPosition(500, 250);
1961 ankur.sing 47
    dlg.show();
48
    dlg.center();
49
  }
50
 
2427 ankur.sing 51
  /**
52
   * Called from CatalogDashboard.java after login authentication is successful.
53
   * @param greeting
54
   */
1961 ankur.sing 55
  public void changeGreeting(String greeting){
2427 ankur.sing 56
	  greetingLabel.setText("Welcome "+ greeting);
1961 ankur.sing 57
  }
58
 
2427 ankur.sing 59
  /**
60
   * Click listener of sign out link is added in CatalogDashboard.initMainDB(String)
61
   * @return
62
   */
1961 ankur.sing 63
  public Anchor getSignOutLink(){
64
	  return signOutLink;
65
  }
66
}