当前位置: 首页>>代码示例>>Java>>正文


Java Event类代码示例

本文整理汇总了Java中elemental.events.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Event类属于elemental.events包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleEndFor

import elemental.events.Event; //导入依赖的package包/类
public void handleEndFor(Element elem) {
  // TODO: Keep an eye on whether or not webkit supports the
  // vendor prefix free version. If they ever do we should remove this.
  elem.addEventListener(Event.WEBKITTRANSITIONEND, this, false);
  // For FF4 when we are ready.
  elem.addEventListener("transitionend", this, false);
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:AnimationController.java

示例2: doActionsForDoubleClick

import elemental.events.Event; //导入依赖的package包/类
private void doActionsForDoubleClick(Element treeNodeBody, Object evt) {
  SignalEvent signalEvent =
      SignalEventImpl.create((com.google.gwt.user.client.Event) evt, true);
  // Select the node.
  dispatchNodeSelectedEvent(treeNodeBody, signalEvent, css);

  // Don't dispatch a node action if there is a modifier key depressed.
  if (!(signalEvent.getCommandKey() || signalEvent.getShiftKey())) {
    dispatchNodeActionEvent(treeNodeBody, css);

    TreeNodeElement<D> node = getTreeNodeFromTreeNodeBody(treeNodeBody, css);
    if (node.hasChildrenContainer()) {
      dispatchExpansionEvent(node, css);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:Tree.java

示例3: show

import elemental.events.Event; //导入依赖的package包/类
/** Makes the View visible and schedules it to be re-hidden if the user does not mouse over. */
public void show() {
  // Nothing to do if it is showing.
  if (isShowing()) {
    return;
  }

  getView().show();
  getModel().hidden = false;

  // Catch clicks that are outside the autohide component to trigger a hide.
  outsideClickListenerRemover =
      Elements.getBody().addEventListener(Event.MOUSEDOWN, outsideClickListener, true);

  if (autoHideHandler != null) {
    autoHideHandler.onShow();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:AutoHideComponent.java

示例4: handleEvent

import elemental.events.Event; //导入依赖的package包/类
@Override
public void handleEvent(Event evt) {
  MouseEvent mouseEvent = (MouseEvent) evt;
  updateXYState(mouseEvent);

  if (evt.getType().equals(Event.MOUSEMOVE)) {
    onMouseMove(mouseEvent);
  } else if (evt.getType().equals(Event.MOUSEUP)) {
    release();
    onMouseUp(mouseEvent);
  } else if (evt.getType().equals(Event.MOUSEDOWN)) {
    if (onMouseDown(mouseEvent)) {
      // Start the capture
      MouseEventCapture.capture(this);
      mouseEvent.preventDefault();
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:MouseCaptureListener.java

示例5: preventExcessiveScrollingPropagation

import elemental.events.Event; //导入依赖的package包/类
/**
 * Prevent propagation of scrolling to parent containers on mouse wheeling, when target container
 * can not be scrolled anymore.
 */
public static void preventExcessiveScrollingPropagation(final Element container) {
  // The MOUSEWHEEL does not exist on FF, so in FF the common browser behavior won't be canceled
  // and the parent container will be scrolled.
  container.addEventListener(
      Event.MOUSEWHEEL,
      new EventListener() {
        @Override
        public void handleEvent(Event evt) {
          int deltaY = DOM.eventGetMouseWheelVelocityY((com.google.gwt.user.client.Event) evt);
          int scrollTop = container.getScrollTop();
          if (deltaY < 0 && scrollTop == 0) {
            evt.preventDefault();
          } else if (deltaY > 0
              && scrollTop == (container.getScrollHeight() - container.getClientHeight())) {
            evt.preventDefault();
          }
          evt.stopPropagation();
        }
      },
      false);
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:DomUtils.java

示例6: handleEvent

import elemental.events.Event; //导入依赖的package包/类
@Override
public void handleEvent(Event evt) {
  /*
   * Transition events propagate, so the event target could be a child of
   * the element that we are controlling. For example, the child could be a
   * button (with transitions enabled) within a form that is being animated.
   *
   * We verify that the target is actually being animated by the
   * AnimationController by checking its current state. It will only have a
   * state if the AnimationController added the state attribute to the
   * target.
   */
  Element target = (Element) evt.getTarget();
  if (isAnyState(target, State.SHOWING)) {
    showWithoutAnimating(target); // Puts element in SHOWN state
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:AnimationController.java

示例7: animatePropertySet

import elemental.events.Event; //导入依赖的package包/类
/**
 * Enables animations prior to setting the value for the specified style property on the supplied
 * element. The end result is that there property is transitioned to.
 *
 * @param elem the {@link Element} we want to set the style property on.
 * @param property the name of the style property we want to set.
 * @param value the target value of the style property.
 * @param duration the time in seconds we want the transition to last.
 * @param animationCallback callback that is invoked when the animation completes. It will be
 *     passed a {@code null} event if the animation was pre-empted by some other animation on the
 *     same element.
 */
public static void animatePropertySet(
    final Element elem,
    String property,
    String value,
    double duration,
    final EventListener animationCallback) {
  final CSSStyleDeclaration style = elem.getStyle();
  enableTransitions(style, duration);

  if (UserAgent.isFirefox()) {
    // For FF4.
    new TransitionEndHandler(animationCallback).handleEndFor(elem, "transitionend");
  } else {
    // For webkit based browsers.
    // TODO: Keep an eye on whether or not webkit supports the
    // vendor prefix free version. If they ever do we should remove this.
    new TransitionEndHandler(animationCallback).handleEndFor(elem, Event.WEBKITTRANSITIONEND);
  }

  style.setProperty(property, value);
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:AnimationUtils.java

示例8: renderAction

import elemental.events.Event; //导入依赖的package包/类
private Node renderAction(String title, final Action action) {
  final Presentation presentation = presentationFactory.getPresentation(action);
  Element divElement = Elements.createDivElement(style.listElement());
  divElement.addEventListener(
      "click",
      new EventListener() {
        @Override
        public void handleEvent(Event evt) {
          ActionEvent event = new ActionEvent(presentation, actionManager);
          action.actionPerformed(event);
        }
      },
      true);
  divElement.getStyle().setCursor("pointer");
  divElement.getStyle().setColor(Style.getOutputLinkColor());
  Element label = Elements.createDivElement(style.actionLabel());
  label.setInnerText(title);
  divElement.appendChild(label);

  String hotKey =
      KeyMapUtil.getShortcutText(keyBindingAgent.getKeyBinding(actionManager.getId(action)));
  if (hotKey == null) {
    hotKey = "&nbsp;";
  } else {
    hotKey = "<nobr>&nbsp;" + hotKey + "&nbsp;</nobr>";
  }
  SpanElement hotKeyElement = Elements.createSpanElement(style.hotKey());
  hotKeyElement.setInnerHTML(hotKey);
  divElement.appendChild(hotKeyElement);
  return divElement;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:EmptyEditorsPanel.java

示例9: setWorkspace

import elemental.events.Event; //导入依赖的package包/类
/** Sets the current workspace. */
public void setWorkspace(WorkspaceImpl workspace) {
  this.workspace = new WorkspaceImpl(workspace);

  if (appStateEventRemover != null) {
    appStateEventRemover.remove();
  }

  // in some cases IDE doesn't save preferences on window close
  // so try to save if window lost focus
  appStateEventRemover =
      Elements.getWindow()
          .addEventListener(Event.BLUR, evt -> appStateManager.get().persistWorkspaceState());
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:AppContextImpl.java

示例10: runActions

import elemental.events.Event; //导入依赖的package包/类
/**
 * Finds and runs an action cancelling original key event
 *
 * @param actionIds list containing action ids
 * @param keyEvent original key event
 */
private void runActions(List<String> actionIds, Event keyEvent) {
  for (String actionId : actionIds) {
    Action action = actionManager.getAction(actionId);
    if (action == null) {
      continue;
    }
    ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager);
    action.update(e);

    if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) {
      /** Stop handling the key event */
      keyEvent.preventDefault();
      keyEvent.stopPropagation();

      /** Perform the action */
      action.actionPerformed(e);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:KeyBindingManager.java

示例11: createItem

import elemental.events.Event; //导入依赖的package包/类
public Element createItem(final CompletionProposal proposal) {
  final Element element = Elements.createLiElement(popupResources.popupStyle().item());

  final Element icon = Elements.createDivElement(popupResources.popupStyle().icon());
  if (proposal.getIcon() != null && proposal.getIcon().getSVGImage() != null) {
    icon.appendChild((Node) proposal.getIcon().getSVGImage().getElement());
  } else if (proposal.getIcon() != null && proposal.getIcon().getImage() != null) {
    icon.appendChild((Node) proposal.getIcon().getImage().getElement());
  }
  element.appendChild(icon);

  final SpanElement label = Elements.createSpanElement(popupResources.popupStyle().label());
  label.setInnerHTML(proposal.getDisplayString());
  element.appendChild(label);

  final EventListener validateListener =
      new EventListener() {
        @Override
        public void handleEvent(final Event evt) {
          proposal.getCompletion(
              new CompletionProposal.CompletionCallback() {
                @Override
                public void onCompletion(final Completion completion) {
                  HandlesUndoRedo undoRedo = null;
                  if (textEditor instanceof UndoableEditor) {
                    UndoableEditor undoableEditor =
                        (UndoableEditor) QuickAssistWidget.this.textEditor;
                    undoRedo = undoableEditor.getUndoRedo();
                  }
                  try {
                    if (undoRedo != null) {
                      undoRedo.beginCompoundChange();
                    }
                    completion.apply(textEditor.getDocument());
                    final LinearRange selection =
                        completion.getSelection(textEditor.getDocument());
                    if (selection != null) {
                      textEditor.getDocument().setSelectedRange(selection, true);
                    }
                  } catch (final Exception e) {
                    Log.error(getClass(), e);
                  } finally {
                    if (undoRedo != null) {
                      undoRedo.endCompoundChange();
                    }
                  }
                }
              });
          hide();
        }
      };

  element.addEventListener(Event.DBLCLICK, validateListener, false);
  element.addEventListener(CUSTOM_EVT_TYPE_VALIDATE, validateListener, false);

  return element;
}
 
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:QuickAssistWidget.java

示例12: createCloseElement

import elemental.events.Event; //导入依赖的package包/类
private SpanElement createCloseElement(final ProcessTreeNode node) {
  SpanElement closeButton =
      Elements.createSpanElement(resources.getCss().processesPanelCloseButtonForProcess());
  ensureDebugId(closeButton, "close-terminal-node-button");

  SVGImage icon = new SVGImage(partResources.closeIcon());
  closeButton.appendChild((Node) icon.getElement());

  Tooltip.create(closeButton, BOTTOM, MIDDLE, locale.viewCloseProcessOutputTooltip());

  closeButton.addEventListener(
      Event.CLICK,
      event -> {
        if (stopProcessHandler != null) {
          stopProcessHandler.onCloseProcessOutputClick(node);
        }
      },
      true);

  return closeButton;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:TerminalNodeRenderStrategy.java

示例13: createStopProcessElement

import elemental.events.Event; //导入依赖的package包/类
private SpanElement createStopProcessElement(final ProcessTreeNode node) {
  SpanElement stopProcessButton =
      Elements.createSpanElement(resources.getCss().processesPanelStopButtonForProcess());
  ensureDebugId(stopProcessButton, "stop-process-button-element");

  Tooltip.create(stopProcessButton, BOTTOM, MIDDLE, locale.viewStropProcessTooltip());

  stopProcessButton.addEventListener(
      Event.CLICK,
      event -> {
        if (stopProcessHandler != null) {
          stopProcessHandler.onStopProcessClick(node);
        }
      },
      true);

  return stopProcessButton;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:CommandNodeRenderStrategy.java

示例14: createCloseElement

import elemental.events.Event; //导入依赖的package包/类
private SpanElement createCloseElement(final ProcessTreeNode node) {
  SpanElement closeButton =
      Elements.createSpanElement(resources.getCss().processesPanelCloseButtonForProcess());
  ensureDebugId(closeButton, "close-command-node-button");

  SVGImage icon = new SVGImage(partResources.closeIcon());
  closeButton.appendChild((Node) icon.getElement());

  Tooltip.create(closeButton, BOTTOM, MIDDLE, locale.viewCloseProcessOutputTooltip());

  closeButton.addEventListener(
      Event.CLICK,
      event -> {
        if (stopProcessHandler != null) {
          stopProcessHandler.onCloseProcessOutputClick(node);
        }
      },
      true);

  return closeButton;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:CommandNodeRenderStrategy.java

示例15: loadChunk

import elemental.events.Event; //导入依赖的package包/类
/**
 * Triggers an async request to load the chunk. The chunk is forwarded to all workers to be processed before being returned to the client
 *
 * @param x
 *         The chunk x position
 * @param z
 *         The chunk z position
 */
private void loadChunk(final int x, final int z) {
    final String key = chunkKey(x, z);
    if (loadingChunks.contains(key) || isLoaded(x, z)) {
        return;
    }
    final XMLHttpRequest xmlHttpRequest = Browser.getWindow().newXMLHttpRequest();
    xmlHttpRequest.open("POST", "http://" + mapViewer.getConnection().getAddress() + "/server/chunk", true);
    xmlHttpRequest.setResponseType("arraybuffer");
    xmlHttpRequest.setOnreadystatechange(new EventListener() {
        @Override
        public void handleEvent(Event evt) {
            if (xmlHttpRequest.getReadyState() != 4) return;
            if (xmlHttpRequest.getStatus() == 200) {
                // Got the chunk successfully, move on
                // to processing the chunk
                ArrayBuffer data = (ArrayBuffer) xmlHttpRequest.getResponse();
                ViewBuffer dataStream = JavascriptViewBuffer.create(data, false, 0, data.getByteLength());
                if (dataStream.getInt8(0) == 0) {
                    loadingChunks.remove(key);
                    return;
                }
                UByteBuffer sendableData = JavascriptUByteBuffer.create(data, 0, data.getByteLength());
                mapViewer.getWorkerPool().sendMessage(new ChunkLoadMessage(x, z, sendableData), true);
            } else {
                // Request failed (e.g. non-existing chunk)
                // remove from the loadingChunks set so
                // that it may be tried again
                loadingChunks.remove(key);
            }
        }
    });
    xmlHttpRequest.send(key);
}
 
开发者ID:Thinkofname,项目名称:ThinkMap,代码行数:42,代码来源:ClientWorld.java


注:本文中的elemental.events.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。