/** * Gets the current set of events sunk by a given element. * * @param elem the element whose events are to be retrieved * @return a bitfield describing the events sunk on this element (its possible * values are described in {@link Event}) */ public static int getEventsSunk(Element elem) { return DOM.getEventsSunk(elem); }
/** * Removes a set of events from this object's event list. * * @param eventBitsToRemove a bitfield representing the set of events to be * removed from this element's event set * @see #sinkEvents * @see com.google.gwt.user.client.Event */ public void unsinkEvents(int eventBitsToRemove) { DOM.sinkEvents(getElement(), DOM.getEventsSunk(getElement()) & (~eventBitsToRemove)); }
/** * Adds a set of events to be sunk by this object. Note that only * {@link Widget widgets} may actually receive events, but can receive events * from all objects contained within them. * * @param eventBitsToAdd a bitfield representing the set of events to be added * to this element's event set * @see com.google.gwt.user.client.Event */ public void sinkEvents(int eventBitsToAdd) { DOM.sinkEvents(getElement(), eventBitsToAdd | DOM.getEventsSunk(getElement())); }
/** * Dispatch an event to the cell, ensuring that the widget will catch it. * * @param widget the widget that will handle the event * @param target the cell element * @param eventBits the event bits to sink * @param event the event to fire, or null not to fire an event */ private static void dispatchCellEvent(Widget widget, Element target, int eventBits, Event event) { // Make sure that the target is still a child of the widget. We defer the // firing of some events, so its possible that the DOM structure has // changed before we fire the event. if (!widget.getElement().isOrHasChild(target)) { return; } // Temporary listen for events from the cell. The event listener will be // removed in onBrowserEvent(). DOM.setEventListener(target, widget); DOM.sinkEvents(target, eventBits | DOM.getEventsSunk(target)); // Dispatch the event to the cell. if (event != null) { target.dispatchEvent(event); } }
/** * Gets the current set of events sunk by a given element. * * @param elem the element whose events are to be retrieved * @return a bitfield describing the events sunk on this element (its possible * values are described in {@link Event}) */ public static int getEventsSunk(Element elem) { return DOM.getEventsSunk(elem); }
/** * Gets the current set of events sunk by a given element. * * @param elem the element whose events are to be retrieved * @return a bitfield describing the events sunk on this element (its possible * values are described in {@link Event}) */ public static int getEventsSunk(Element elem) { return DOM.getEventsSunk(elem); }
/** * Adds the event type to the element's sunk events. * * @param event the events to add * @return this */ public El addEventsSunk(int event) { int bits = DOM.getEventsSunk(dom); DOM.sinkEvents(dom, bits | event); return this; }
public CubaScrollTableHeaderCell(String colId, String headerText) { super(colId, headerText); Element sortIndicator = td.getChild(1).cast(); DOM.sinkEvents(sortIndicator, Event.ONCONTEXTMENU | DOM.getEventsSunk(sortIndicator)); Element captionContainer = td.getChild(2).cast(); DOM.sinkEvents(captionContainer, Event.ONCONTEXTMENU | DOM.getEventsSunk(captionContainer)); }
/** * Removes a set of events from this object's event list. * * @param eventBitsToRemove a bitfield representing the set of events to be * removed from this element's event set * @see #sinkEvents * @see com.google.gwt.user.client.Event */ public void unsinkEvents(int eventBitsToRemove) { DOM.sinkEvents(getElement(), DOM.getEventsSunk(getElement()) & (~eventBitsToRemove)); }
/** * Removes a set of events from this object's event list. * * @param eventBitsToRemove a bitfield representing the set of events to be * removed from this element's event set * @see #sinkEvents * @see com.google.gwt.user.client.Event */ public void unsinkEvents(int eventBitsToRemove) { DOM.sinkEvents(getElement(), DOM.getEventsSunk(getElement()) & (~eventBitsToRemove)); }
public CubaTreeTableHeaderCell(String colId, String headerText) { super(colId, headerText); Element sortIndicator = td.getChild(1).cast(); DOM.sinkEvents(sortIndicator, Event.ONCONTEXTMENU | DOM.getEventsSunk(sortIndicator)); Element captionContainer = td.getChild(2).cast(); DOM.sinkEvents(captionContainer, Event.ONCONTEXTMENU | DOM.getEventsSunk(captionContainer)); }
/** * Adds a set of events to be sunk by this object. Note that only * {@link Widget widgets} may actually receive events, but can receive events * from all objects contained within them. * * @param eventBitsToAdd a bitfield representing the set of events to be added * to this element's event set * @see com.google.gwt.user.client.Event */ public void sinkEvents(int eventBitsToAdd) { DOM.sinkEvents(getElement(), eventBitsToAdd | DOM.getEventsSunk(getElement())); }
/** * Adds a set of events to be sunk by this object. Note that only * {@link Widget widgets} may actually receive events, but can receive events * from all objects contained within them. * * @param eventBitsToAdd a bitfield representing the set of events to be added * to this element's event set * @see com.google.gwt.user.client.Event */ public void sinkEvents(int eventBitsToAdd) { DOM.sinkEvents(getElement(), eventBitsToAdd | DOM.getEventsSunk(getElement())); }
public CubaWindowWidget() { DOM.sinkEvents(header, DOM.getEventsSunk(header) | Event.ONCONTEXTMENU); addStyleName(NONMODAL_WINDOW_CLASSNAME); Event.sinkEvents(getModalityCurtain(), Event.ONCLICK); Event.setEventListener(getModalityCurtain(), event -> { if (closeOnClickOutside) { if (clickOnModalityCurtain != null) { clickOnModalityCurtain.run(); } } }); }
private void sink(int eventbits, String eventName) { // ensure that the gwtQuery's event listener is set as event listener of the element DOM.setEventListener((com.google.gwt.user.client.Element) element, this); if (eventbits != BITLESS) { eventBits |= eventbits; if ((eventBits | Event.FOCUSEVENTS) == Event.FOCUSEVENTS && JsUtils.isElement(element) && element.getAttribute("tabIndex").length() == 0) { element.setAttribute("tabIndex", "0"); } DOM.sinkEvents((com.google.gwt.user.client.Element) element, eventBits | DOM.getEventsSunk((com.google.gwt.user.client.Element) element)); } else { sinkBitlessEvent(element, eventName); } }
/** * Dispatch an event to the cell, ensuring that the widget will catch it. * * @param widget the widget that will handle the event * @param target the cell element * @param eventBits the event bits to sink * @param event the event to fire, or null not to fire an event */ private static void dispatchCellEvent(Widget widget, Element target, int eventBits, Event event) { // Make sure that the target is still a child of the widget. We defer the // firing of some events, so its possible that the DOM structure has // changed before we fire the event. if (!widget.getElement().isOrHasChild(target)) { return; } // Temporary listen for events from the cell. The event listener will be // removed in onBrowserEvent(). DOM.setEventListener(target, widget); DOM.sinkEvents(target, eventBits | DOM.getEventsSunk(target)); // Dispatch the event to the cell. if (event != null) { target.dispatchEvent(event); } }
/** * Dispatch an event to the cell, ensuring that the widget will catch it. * * @param widget the widget that will handle the event * @param target the cell element * @param eventBits the event bits to sink * @param event the event to fire, or null not to fire an event */ private static void dispatchCellEvent(Widget widget, Element target, int eventBits, Event event) { // Make sure that the target is still a child of the widget. We defer the // firing of some events, so its possible that the DOM structure has // changed before we fire the event. if (!widget.getElement().isOrHasChild(target)) { return; } // Temporary listen for events from the cell. The event listener will be // removed in onBrowserEvent(). DOM.setEventListener(target, widget); DOM.sinkEvents(target, eventBits | DOM.getEventsSunk(target)); // Dispatch the event to the cell. if (event != null) { target.dispatchEvent(event); } }
DOM.sinkEvents(button.getElement(), Event.ONMOUSEOVER | DOM.getEventsSunk(button.getElement()));
private void ensureFocusElement() { if (focusEl != null) { focusEl.removeFromParent(); } focusEl = getElement().appendChild(focusImpl.createFocusable()); focusEl.addClassName(treeStyles.treeStylesCss().noFocusOutline()); if (focusEl.hasChildNodes()) { focusEl.getFirstChildElement().addClassName(treeStyles.treeStylesCss().noFocusOutline()); Style focusElStyle = focusEl.getFirstChildElement().getStyle(); focusElStyle.setBorderWidth(0, Style.Unit.PX); focusElStyle.setFontSize(1, Style.Unit.PX); focusElStyle.setPropertyPx("lineHeight", 1); } focusEl.getStyle().setLeft(0, Style.Unit.PX); focusEl.getStyle().setTop(0, Style.Unit.PX); focusEl.getStyle().setPosition(Style.Position.ABSOLUTE); // subscribe for Event.FOCUSEVENTS int bits = DOM.getEventsSunk( (Element) focusEl.cast()); // do not remove redundant cast, GWT tests will fail DOM.sinkEvents((Element) focusEl.cast(), bits | Event.FOCUSEVENTS); }