@Override
 public void onStop() {
   for (HandlerRegistration registration : registrations) {
     registration.removeHandler();
   }
   registrations.clear();
 }
Beispiel #2
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();
                  }
                }
              });
    }
  }
 /** Remove all handlers on unload. */
 protected void onUnload() {
   if (registrations != null) {
     for (HandlerRegistration registration : registrations) {
       registration.removeHandler();
     }
   }
   super.onUnload();
 }
 @Override
 protected void onDetach() {
   for (HandlerRegistration handler : handlers) {
     handler.removeHandler();
   }
   handlers.clear();
   super.onDetach();
 }
 private void clearHandlers() {
   for (HandlerRegistration h : handlers) {
     if (h != null) {
       h.removeHandler();
     }
   }
   handlers.clear();
 }
Beispiel #6
0
 public void removeHandlers() {
   if (handlerMap != null) {
     for (Map.Entry entry : handlerMap.entrySet()) {
       HandlerRegistration hr = (HandlerRegistration) entry.getValue();
       hr.removeHandler();
     }
     handlerMap.clear();
   }
 }
Beispiel #7
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;
   }
 }
Beispiel #9
0
  @Override
  public void release() {
    for (MenuItemPresenter menuItem : menuItems) {
      menuItem.release();
    }

    for (HandlerRegistration handler : handlers) {
      handler.removeHandler();
    }
    handlers.clear();
  }
Beispiel #10
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;
  }
Beispiel #12
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();
  }
  /**
   * 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();
                }
              });
    }
  }
Beispiel #14
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();
                    }
                  });
            }
          });
    }
  }
Beispiel #15
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;
   }
 }
 @Override
 public void onStop() {
   if (hr != null) {
     hr.removeHandler();
   }
   view.clear();
   view.setPresenter(null);
 }
 @Override
 protected void onUnload() {
   super.onUnload();
   if (narrativeLinkClickHandler != null) {
     narrativeLinkClickHandler.removeHandler();
     narrativeLinkClickHandler = null;
   }
 }
  @Override
  protected void onUnload() {
    if (globalKeyHandlerRegistration != null) {
      globalKeyHandlerRegistration.removeHandler();
      globalKeyHandlerRegistration = null;
    }

    super.onUnload();
  }
  /** 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;
  }
 public void stop() {
   if (running) {
     running = false;
     if (unloadHandlerReg != null) {
       unloadHandlerReg.removeHandler();
       unloadHandlerReg = null;
     }
     doDisconnect();
   }
 }
Beispiel #21
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());
                }
              });
    }
  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());
  }
    @Override
    public IAnimation doClose() {
      RootPanel.get().remove(m_video);

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

        m_watch = null;
      }
      return draw();
    }
  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();
              }
            });
  }
Beispiel #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);
   }
 }
Beispiel #26
0
  /** @see com.alkacon.geranium.client.ui.input.I_FormWidget#setEnabled(boolean) */
  public void setEnabled(boolean enabled) {

    if (!m_enabled && enabled) {
      // if the state changed to enable then add the stored handlers
      // copy the stored handlers into a new list to avoid concurred access to the list
      List<ClickHandler> handlers = new ArrayList<ClickHandler>(m_clickHandlers);
      m_clickHandlers.clear();
      for (ClickHandler handler : handlers) {
        addClickHandler(handler);
      }
      m_textboxContainer.removeStyleName(CSS.textBoxPanelDisabled());
      m_enabled = true;
    } else if (m_enabled && !enabled) {
      // if state changed to disable then remove all click handlers
      for (HandlerRegistration registration : m_clickHandlerRegistrations) {
        registration.removeHandler();
      }
      m_clickHandlerRegistrations.clear();
      m_textboxContainer.addStyleName(CSS.textBoxPanelDisabled());
      setErrorMessage(null);
      m_enabled = false;
    }
    m_textbox.setEnabled(m_enabled);
  }
  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();
   }
 }
Beispiel #29
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();
     }
   }
 }
  /**
   * 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);
  }