Subversion Repositories SmartDukaan

Rev

Rev 2313 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.hotspot.dashbaord.client.inbox;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;

/**
 * The top panel, which contains the 'welcome' message and various links.
 */
public class TopPanel extends Composite {

  interface Binder extends UiBinder<Widget, TopPanel> { }
  private static final Binder binder = GWT.create(Binder.class);
  @UiField Anchor alertsCountLink;
  @UiField Anchor signOutLink;
  @UiField Anchor aboutLink;
  @UiField HTML greetingLabel;

  public TopPanel() {
        
    initWidget(binder.createAndBindUi(this));
  }

  @UiHandler("aboutLink")
  void onAboutClicked(ClickEvent event) {
    // When the 'About' item is selected, show the AboutDialog.
    // Note that showing a dialog box does not block -- execution continues
    // normally, and the dialog fires an event when it is closed.
    StatusDialog dlg = new StatusDialog();
    dlg.setText("Hotspot Order life cycle dashboard built by Shop2020");
    dlg.show();
    dlg.center();
  }
  
  public void changeGreeting(String greeting){
          greetingLabel.setText("Aloha! "+ greeting);
  }

  public void updateAlertsCount(long count){
          alertsCountLink.setText("Alerts: " + count);
  }
  
  public Anchor getAlertsCountLink(){
          return alertsCountLink;
  }
  
  public Anchor getSignOutLink(){
          return signOutLink;
  }
}