Ejemplo n.º 1
0
  /** Register or unregister the handlers used by {@link PopupPanel}. */
  private void updateHandlers() {
    // Remove any existing handlers.
    if (nativePreviewHandlerRegistration != null) {
      nativePreviewHandlerRegistration.removeHandler();
      nativePreviewHandlerRegistration = null;
    }
    if (historyHandlerRegistration != null) {
      historyHandlerRegistration.removeHandler();
      historyHandlerRegistration = null;
    }

    // Create handlers if showing.
    if (showing) {
      nativePreviewHandlerRegistration =
          Event.addNativePreviewHandler(
              new NativePreviewHandler() {
                public void onPreviewNativeEvent(NativePreviewEvent event) {
                  previewNativeEvent(event);
                }
              });
      historyHandlerRegistration =
          History.addValueChangeHandler(
              new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent<String> event) {
                  if (autoHideOnHistoryEvents) {
                    hide();
                  }
                }
              });
    }
  }
Ejemplo n.º 2
0
  private void removeTabBlockHandlers() {
    if (topBlockerRegistration != null) {
      topBlockerRegistration.removeHandler();
      topBlockerRegistration = null;

      bottomBlockerRegistration.removeHandler();
      bottomBlockerRegistration = null;
    }
  }
 public void unbind() {
   if (windowResizeRegistration != null) {
     windowResizeRegistration.removeHandler();
     windowResizeRegistration = null;
   }
   if (forceResizeEventRegistration != null) {
     forceResizeEventRegistration.removeHandler();
     forceResizeEventRegistration = null;
   }
 }
Ejemplo n.º 4
0
 public void detachHandlers() {
   /*
    * We remove the handlers to make sure unnecessary processing is not done
    */
   if (handlerRegistration == null) return;
   handlerRegistration.removeHandler();
   handlerRegistration2.removeHandler();
   handlerRegistration = null;
   handlerRegistration2 = null;
   DOM.releaseCapture(parent.getElement());
 }
  /** Clean-up the listeners. */
  private void unRegisterListeners() {
    if (!areListenersRegistered) {
      return;
    }

    btnCloseHandler.removeHandler();
    advanceContainerOpenHandler.removeHandler();
    advanceContainerCloseHandler.removeHandler();
    tabPanelHandler.removeHandler();

    areListenersRegistered = false;
  }
Ejemplo n.º 6
0
  private void initPlaceHistoryHandler(UserDto user) {
    Site.user = user;
    JQuery.select("body").removeClass("app-loading");
    if (historyHandlerRegistration != null) historyHandlerRegistration.removeHandler();
    if (user == null) {
      GWT.runAsync(
          new RunAsyncCallback() {
            public void onFailure(Throwable caught) {
              handleError(caught);
            }

            public void onSuccess() {
              initLoginPage();
            }
          });
    } else {
      GWT.runAsync(
          new RunAsyncCallback() {
            public void onFailure(Throwable caught) {
              handleError(caught);
            }

            public void onSuccess() {
              Site.service.getRoleList(
                  new SimpleAsyncCallback<List<RoleDto>>() {
                    public void onSuccess(List<RoleDto> result) {
                      roleList = result;
                      intAuthorizedUserGUI();
                    }
                  });
            }
          });
    }
  }
Ejemplo n.º 7
0
  /**
   * Enables or disabled editing of the title field.
   *
   * <p>
   *
   * @param editable if true, makes the title field editable
   */
  public void setTitleEditable(boolean editable) {

    boolean alreadyEditable = m_titleClickHandlerRegistration != null;
    if (alreadyEditable == editable) {
      return;
    }
    if (!editable) {
      m_titleClickHandlerRegistration.removeHandler();
      m_titleClickHandlerRegistration = null;

    } else {
      m_titleClickHandlerRegistration =
          m_title.addClickHandler(
              new ClickHandler() {

                /**
                 * @see
                 *     com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
                 */
                public void onClick(ClickEvent event) {

                  editTitle();
                }
              });
    }
  }
Ejemplo n.º 8
0
  /**
   * If the time field loses the focus the entered time should be checked.
   *
   * <p>
   */
  protected void onTimeBlur() {

    if (m_previewRegistration != null) {
      m_previewRegistration.removeHandler();
    }
    checkTime();
  }
Ejemplo n.º 9
0
 @Override
 public void onStop() {
   for (HandlerRegistration registration : registrations) {
     registration.removeHandler();
   }
   registrations.clear();
 }
 /** Remove all handlers on unload. */
 protected void onUnload() {
   if (registrations != null) {
     for (HandlerRegistration registration : registrations) {
       registration.removeHandler();
     }
   }
   super.onUnload();
 }
Ejemplo n.º 11
0
 @Override
 public void onStop() {
   if (hr != null) {
     hr.removeHandler();
   }
   view.clear();
   view.setPresenter(null);
 }
Ejemplo n.º 12
0
 public void updateFromUIDL(UIDL uidl) {
   if (uidl.hasAttribute(uidlAttribute) && registration == null) {
     registration = registerHandler();
   } else if (!uidl.hasAttribute(uidlAttribute) && registration != null) {
     registration.removeHandler();
     registration = null;
   }
 }
Ejemplo n.º 13
0
 @Override
 protected void onDetach() {
   for (HandlerRegistration handler : handlers) {
     handler.removeHandler();
   }
   handlers.clear();
   super.onDetach();
 }
 @Override
 protected void onUnload() {
   super.onUnload();
   if (narrativeLinkClickHandler != null) {
     narrativeLinkClickHandler.removeHandler();
     narrativeLinkClickHandler = null;
   }
 }
Ejemplo n.º 15
0
 private void clearHandlers() {
   for (HandlerRegistration h : handlers) {
     if (h != null) {
       h.removeHandler();
     }
   }
   handlers.clear();
 }
Ejemplo n.º 16
0
  @Override
  protected void onUnload() {
    if (globalKeyHandlerRegistration != null) {
      globalKeyHandlerRegistration.removeHandler();
      globalKeyHandlerRegistration = null;
    }

    super.onUnload();
  }
Ejemplo n.º 17
0
 public void removeHandlers() {
   if (handlerMap != null) {
     for (Map.Entry entry : handlerMap.entrySet()) {
       HandlerRegistration hr = (HandlerRegistration) entry.getValue();
       hr.removeHandler();
     }
     handlerMap.clear();
   }
 }
Ejemplo n.º 18
0
  /** Called when the activity stops */
  @Override
  public void onStop() {
    activityManger.setDisplay(null);
    if (rangeChangeHandler != null) {
      rangeChangeHandler.removeHandler();
      rangeChangeHandler = null;
    }

    if (selectionChangeHandler != null) {
      selectionChangeHandler.removeHandler();
      selectionChangeHandler = null;
    }

    if (placeChangeHandlerRegistration != null) {
      placeChangeHandlerRegistration.removeHandler();
    }
    request = null;
  }
Ejemplo n.º 19
0
 public void stop() {
   if (running) {
     running = false;
     if (unloadHandlerReg != null) {
       unloadHandlerReg.removeHandler();
       unloadHandlerReg = null;
     }
     doDisconnect();
   }
 }
Ejemplo n.º 20
0
    private void setEditorConnector(final AbstractComponentConnector editorConnector) {
      this.editorConnector = editorConnector;

      if (errorStateHandler != null) {
        errorStateHandler.removeHandler();
        errorStateHandler = null;
      }

      // Avoid nesting too deep
      if (editorConnector == null) {
        return;
      }

      errorStateHandler =
          editorConnector.addStateChangeHandler(
              "errorMessage",
              new StateChangeHandler() {

                @Override
                public void onStateChanged(StateChangeEvent stateChangeEvent) {

                  String error = editorConnector.getState().errorMessage;

                  if (error == null) {
                    columnToErrorMessage.remove(CustomGridColumn.this);
                  } else {
                    // The error message is formatted as HTML;
                    // therefore, we use this hack to make the
                    // string human-readable.
                    Element e = DOM.createElement("div");
                    e.setInnerHTML(editorConnector.getState().errorMessage);
                    error = getHeaderCaption() + ": " + e.getInnerText();

                    columnToErrorMessage.put(CustomGridColumn.this, error);
                  }

                  // Handle Editor RPC before updating error status
                  Scheduler.get()
                      .scheduleFinally(
                          new ScheduledCommand() {

                            @Override
                            public void execute() {
                              updateErrorColumns();
                            }
                          });
                }

                public void updateErrorColumns() {
                  getWidget()
                      .getEditor()
                      .setEditorError(getColumnErrors(), columnToErrorMessage.keySet());
                }
              });
    }
Ejemplo n.º 21
0
    @Override
    public IAnimation doClose() {
      RootPanel.get().remove(m_video);

      if (null != m_watch) {
        m_watch.removeHandler();

        m_watch = null;
      }
      return draw();
    }
  public void onGeometryEditStop(GeometryEditStopEvent event) {
    // Remove the handler that follows changes in the map view:
    if (mapViewRegistration != null) {
      mapViewRegistration.removeHandler();
      mapViewRegistration = null;
    }

    // Cleanup the geometry from the map:
    groups.clear();
    mapWidget.getVectorContext().deleteGroup(event.getGeometry());
  }
Ejemplo n.º 23
0
  @Override
  public void release() {
    for (MenuItemPresenter menuItem : menuItems) {
      menuItem.release();
    }

    for (HandlerRegistration handler : handlers) {
      handler.removeHandler();
    }
    handlers.clear();
  }
Ejemplo n.º 24
0
  private void initAnswerView() {

    if (answerRangeChangeHandler != null) {
      answerRangeChangeHandler.removeHandler();
      answerRangeChangeHandler = null;
    }

    requests
        .answerRequestNonRoo()
        .contAnswersByQuestion(question.getId())
        .fire(
            new Receiver<Long>() {

              @Override
              public void onSuccess(Long response) {

                answerTable.setRowCount(response.intValue(), true);

                onAnswerTableRangeChanged();
              }

              public void onFailure(ServerFailure error) {
                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(error.getMessage());
                Log.error(error.getMessage());
              }

              @Override
              public void onViolation(Set<Violation> errors) {
                Iterator<Violation> iter = errors.iterator();
                String message = "";
                while (iter.hasNext()) {
                  message += iter.next().getMessage() + "<br>";
                }
                Log.warn(
                    McAppConstant.ERROR_WHILE_DELETE_VIOLATION
                        + " in Antwort hinzufügen -"
                        + message);

                ErrorPanel erorPanel = new ErrorPanel();
                erorPanel.setErrorMessage(message);
              }
            });

    answerRangeChangeHandler =
        answerTable.addRangeChangeHandler(
            new RangeChangeEvent.Handler() {
              public void onRangeChange(RangeChangeEvent event) {
                ActivityQuestionDetails.this.onAnswerTableRangeChanged();
              }
            });
  }
Ejemplo n.º 25
0
 @Override
 public void setValue(Argument value) {
   super.setValue(value);
   argumentLabel.removeStyleName(appearance.getStyle().emptyGroupBgText());
   argumentLabel.setLabelSeparator("");
   final String id = Strings.nullToEmpty(value.getId());
   if (id.equals(AppTemplateUtils.EMPTY_GROUP_ARG_ID)) {
     handlerRegistration.removeHandler();
     argumentLabel.setStyleName(appearance.getStyle().emptyGroupBgText());
     argumentLabel.getElement().getStyle().setMarginTop(100, Style.Unit.PX);
     argumentLabel.getElement().getStyle().setMarginBottom(100, Style.Unit.PX);
   }
 }
Ejemplo n.º 26
0
  public void onMouseUp(MouseUpEvent event) {
    if (mouseMoveCanceled) {
      return;
    }

    Event.releaseCapture(getElement());
    setFocus(false);
    if (moveRegistration != null) {
      moveRegistration.removeHandler();
      moveRegistration = null;
    }
    int endX = event.getClientX();
    int endY = event.getClientY();
    int xDiff = startX - endX;
    int yDiff = startY - endY;
    startX = -1;
    startY = -1;
    mouseMoveStarted = false;
    Style s = getElement().getStyle();
    s.setZIndex(1);
    if (!clickTargetsResize()) {
      // check if mouse has moved over threshold of 3 pixels
      boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);

      if (!weekGrid.getCalendar().isDisabledOrReadOnly() && mouseMoved) {
        // Event Move:
        // - calendar must be enabled
        // - calendar must not be in read-only mode
        weekGrid.eventMoved(this);
      } else if (!weekGrid.getCalendar().isDisabled()) {
        // Event Click:
        // - calendar must be enabled (read-only is allowed)
        EventTarget et = event.getNativeEvent().getEventTarget();
        Element e = Element.as(et);
        if (e == caption || e == eventContent || e.getParentElement() == caption) {
          if (weekGrid.getCalendar().getEventClickListener() != null) {
            weekGrid.getCalendar().getEventClickListener().eventClick(calendarEvent);
          }
        }
      }

    } else { // click targeted resize bar
      removeGlobalResizeStyle();
      if (weekGrid.getCalendar().getEventResizeListener() != null) {
        weekGrid.getCalendar().getEventResizeListener().eventResized(calendarEvent);
      }
    }
  }
 /**
  * Set whether or not resize checking is enabled. If disabled, elements will still be resized on
  * window events, but the timer will not check their dimensions periodically.
  *
  * @param enabled true to enable the resize checking timer
  */
 public void setResizeCheckingEnabled(boolean enabled) {
   if (enabled && !resizeCheckingEnabled) {
     resizeCheckingEnabled = true;
     if (windowHandler == null) {
       windowHandler = Window.addResizeHandler(this);
     }
     resizeCheckTimer.schedule(resizeCheckDelay);
   } else if (!enabled && resizeCheckingEnabled) {
     resizeCheckingEnabled = false;
     if (windowHandler != null) {
       windowHandler.removeHandler();
       windowHandler = null;
     }
     resizeCheckTimer.cancel();
   }
 }
Ejemplo n.º 28
0
 public void setEditable(boolean isEditable) {
   if (this.isEditable != isEditable) {
     this.isEditable = isEditable;
     if (this.isEditable) {
       if (allowHtml) {
         myRegistration = myHtmlView.addClickHandler(this);
       } else {
         myRegistration = myTextView.addClickHandler(this);
       }
       // buildTooltipPopup();
     } else {
       myRegistration.removeHandler();
       //        myMouseOverHandlerRegistration.removeHandler();
       //        myMouseOutHandlerRegistration.removeHandler();
     }
   }
 }
Ejemplo n.º 29
0
  /**
   * Sets a formatter for widget.
   *
   * @param formatter
   * @param applyMask
   */
  public void setFormatter(final Formatter formatter, boolean applyMask) {
    if (this.formatter != null) {
      if (addBlurHandler != null) {
        addBlurHandler.removeHandler();
      }
      if (this.masked) {
        ((MaskedFormatter) this.formatter).removeMask(this);
      }
      if (this.filtered) {
        ((FilterFormatter) this.formatter).removeFilter(this);
      }
    }

    if (formatter != null) {
      if (applyMask && (formatter instanceof MaskedFormatter)) {
        Scheduler.get()
            .scheduleDeferred(
                new ScheduledCommand() {
                  public void execute() {
                    MaskedFormatter masked = (MaskedFormatter) formatter;
                    masked.applyMask(MaskedTextBox.this, clearIfNotValid);
                  }
                });
      } else if (formatter instanceof FilterFormatter) {
        Scheduler.get()
            .scheduleDeferred(
                new ScheduledCommand() {
                  public void execute() {
                    ((FilterFormatter) formatter).applyFilter(MaskedTextBox.this);
                  }
                });
      } else {
        addBlurHandler =
            addBlurHandler(
                new BlurHandler() {
                  public void onBlur(BlurEvent event) {
                    setUnformattedValue(getUnformattedValue());
                  }
                });
      }
    }
    this.formatter = formatter;
    this.masked = applyMask && (this.formatter instanceof MaskedFormatter);
    this.filtered = (this.formatter instanceof FilterFormatter);
  }
Ejemplo n.º 30
0
  private void cancelMouseMove() {
    mouseMoveCanceled = true;

    // reset and remove everything related to the event handling
    Event.releaseCapture(getElement());
    setFocus(false);

    if (moveRegistration != null) {
      moveRegistration.removeHandler();
      moveRegistration = null;
    }

    mouseMoveStarted = false;
    removeGlobalResizeStyle();

    Style s = getElement().getStyle();
    s.setZIndex(1);

    // reset the position of the event
    int dateCellWidth = getDateCellWidth();
    int dayOffset = startXrelative / dateCellWidth;
    s.clearLeft();

    calendarEvent.setStartTime(startDatetimeFrom);
    calendarEvent.setEndTime(startDatetimeTo);

    long startFromMinutes = (startDatetimeFrom.getHours() * 60) + startDatetimeFrom.getMinutes();
    long range = calendarEvent.getRangeInMinutes();

    startFromMinutes =
        calculateStartFromMinute(startFromMinutes, startDatetimeFrom, startDatetimeTo, dayOffset);
    if (startFromMinutes < 0) {
      range += startFromMinutes;
    }

    updatePosition(startFromMinutes, range);

    startY = -1;
    startX = -1;

    // to reset the event width
    ((DateCell) getParent()).recalculateEventWidths();
  }