/**
   * Binds the tool tip to the target widget. Allows a tool tip to switch the target widget.
   *
   * @param target the target widget
   */
  public void initTarget(final Widget target) {
    if (this.target != null) {
      handlerRegistration.removeHandler();
    }

    this.target = target;

    if (target != null) {
      Handler handler = new Handler();
      handlerRegistration = new GroupingHandlerRegistration();
      handlerRegistration.add(target.addDomHandler(handler, MouseOverEvent.getType()));
      handlerRegistration.add(target.addDomHandler(handler, MouseOutEvent.getType()));
      handlerRegistration.add(target.addDomHandler(handler, MouseMoveEvent.getType()));
      handlerRegistration.add(target.addHandler(handler, HideEvent.getType()));
      handlerRegistration.add(target.addHandler(handler, AttachEvent.getType()));
    }
  }
  @SuppressWarnings("unchecked")
  private <H extends EventHandler> void addDomHandlers(Object owner) {
    Map<Method, UiHandler> uiHandlerMethods =
        GwtReflectionUtils.getAnnotatedMethod(owner.getClass(), UiHandler.class);

    for (Map.Entry<Method, UiHandler> entry : uiHandlerMethods.entrySet()) {
      for (String uiFieldName : entry.getValue().value()) {
        Widget uiField = GwtReflectionUtils.getPrivateFieldValue(owner, uiFieldName);
        com.google.gwt.event.dom.client.DomEvent.Type<H> eventType =
            (com.google.gwt.event.dom.client.DomEvent.Type<H>) getEventType(entry.getKey());

        H handler = (H) createHandler(uiField, entry.getKey(), owner);
        uiField.addDomHandler(handler, eventType);
      }
    }
  }
Пример #3
0
 @Override
 public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
   return titlebar.addDomHandler(handler, MouseDownEvent.getType());
 }
Пример #4
0
 public HandlerRegistration addDeleteHandler(MouseDownHandler handler) {
   return delete.addDomHandler(handler, MouseDownEvent.getType());
 }
  /** Construct a new {@link MobileWebAppShellMobile}. */
  public LoveLicenseShellMobile(
      final EventBus eventBus,
      OrientationHelper orientationHelper,
      MainView mainView,
      MyInfoView myInfoView,
      SajuViewView sajuViewView,
      CurrentSajuView currentSajuView,
      SearchFriendView searchFriendView,
      GuestBookListView guestBookListView,
      GuestBookDetailView guestBookDetailView,
      GuestBookWriteView guestBookWriteView,
      GuestBookEditView guestBookEditView,
      LoveLicenseConstants constants) {

    /*
    titleName = new Label();
    titleName.setText(constants.mainTitle());*/
    // System.out.println("##############"+constants.mainTitle());

    initWidget(uiBinder.createAndBindUi(this));

    /*
     * Add all views to the DeckLayoutPanel so we can animate between them.
     * Using a DeckLayoutPanel here works because we only have a few views, and
     * we always know that the task views should animate in from the right side
     * of the screen. A more complex app will require more complex logic to
     * figure out which direction to animate.
     */
    contentContainer.add(mainView);
    contentContainer.add(guestBookListView);
    contentContainer.add(guestBookDetailView);
    contentContainer.add(guestBookWriteView);
    contentContainer.add(guestBookEditView);
    contentContainer.add(myInfoView);
    contentContainer.add(sajuViewView);
    contentContainer.add(currentSajuView);
    contentContainer.add(searchFriendView);
    contentContainer.setAnimationDuration(500);

    orientationHelper.setCommands(
        this,
        new Command() {
          @Override
          public void execute() {
            onShiftToPortrait();
          }
        },
        new Command() {
          @Override
          public void execute() {
            onShiftToLandscape();
          }
        });

    // Return to the task list when the title is clicked.
    titleBar.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            ActionEvent.fire(eventBus, ActionNames.GO_HOME);
          }
        },
        ClickEvent.getType());
  }
Пример #6
0
 private void addDomHandlers(Widget w) {
   w.addDomHandler(this, MouseDownEvent.getType());
   w.addDomHandler(this, MouseUpEvent.getType());
   w.addDomHandler(this, TouchStartEvent.getType());
   w.addDomHandler(this, TouchEndEvent.getType());
 }