Java Code Examples for com.google.gwt.user.client.Event#ONCLICK
The following examples show how to use
com.google.gwt.user.client.Event#ONCLICK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaNotification.java From cuba with Apache License 2.0 | 6 votes |
@Override public boolean onEventPreview(Event event) { int type = DOM.eventGetType(event); if ((type == Event.ONCLICK || type == Event.ONTOUCHEND) && event.getEventTarget() != null) { Element target = Element.as(event.getEventTarget()); if (containsSubstring(target.getClassName(), CUBA_NOTIFICATION_MODALITY_CURTAIN)) { hide(); return false; } } if (type == Event.ONKEYDOWN && event.getKeyCode() == KeyCodes.KEY_ESCAPE) { if (!getElement().getClassName().contains(TRAY_STYLE)) { hide(); return false; } } return super.onEventPreview(event); }
Example 2
Source File: CubaGroupBoxWidget.java From cuba with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && isEnabled()) { if (collapsable && (DOM.eventGetTarget(event) == expander || DOM.eventGetTarget(event) == captionNode.getChild(1))) { toggleExpanded(event); } else if (DOM.eventGetTarget(event) == contextHelpIcon && contextHelpClickHandler != null) { contextHelpClickHandler.accept(event); } else { super.onBrowserEvent(event); } } else { super.onBrowserEvent(event); } }
Example 3
Source File: InputDatePicker.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { int type = event.getTypeInt(); Element target = event.getCurrentTarget(); if (type == Event.ONCLICK) { String dataDate = target.getAttribute(InputDatePicker.ATTRIBUTE_DATA_DATE); String dataCursor = target.getAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR); String dataYear = target.getAttribute(InputDatePicker.ATTRIBUTE_DATA_YEAR); if (dataDate != null && dataDate.length() > 0) { this.mode = Mode.CALENDAR; this.setValue(InputDatePicker.ATTRIBUTE_DATE_FORMAT.parse(dataDate), true); } else if (dataCursor != null && dataCursor.length() > 0) { this.mode = Mode.CALENDAR; this.cursor = InputDatePicker.ATTRIBUTE_DATE_FORMAT.parse(dataCursor); this.redraw(); } else if (dataYear != null && dataYear.length() > 0) { this.openMonthOfYear(Integer.valueOf(dataYear)); } else if (target == this.monthPickerButton) { if (this.mode != Mode.MONTH) { this.mode = Mode.MONTH; } else { this.mode = Mode.CALENDAR; } this.redraw(); } event.stopPropagation(); event.preventDefault(); } else if (type == Event.ONKEYDOWN) { this.handleKeyPress(event.getKeyCode()); event.stopPropagation(); event.preventDefault(); } else { super.onBrowserEvent(event); } }
Example 4
Source File: CourseCurriculaTable.java From unitime with Apache License 2.0 | 5 votes |
public void onBrowserEvent(Event event) { Element td = getEventTargetCell(event); if (td==null) return; Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); final int row = DOM.getChildIndex(body, tr); final ChainedCommand command = iRowClicks.get(row); switch (DOM.eventGetType(event)) { case Event.ONMOUSEOVER: getRowFormatter().setStyleName(row, "unitime-TableRowHover"); if (command == null) getRowFormatter().getElement(row).getStyle().setCursor(Cursor.AUTO); break; case Event.ONMOUSEOUT: getRowFormatter().setStyleName(row, null); break; case Event.ONCLICK: if (command == null) break; if (command.getLoadingMessage() != null) LoadingWidget.getInstance().show(command.getLoadingMessage()); getRowFormatter().setStyleName(row, "unitime-TableRowSelected"); iSelectedRow = row; command.execute(new ConditionalCommand() { @Override public void executeOnSuccess() { //getRowFormatter().setStyleName(row, null); if (command.getLoadingMessage() != null) LoadingWidget.getInstance().hide(); } @Override public void executeOnFailure() { getRowFormatter().setStyleName(row, "unitime-TableRowHover"); if (command.getLoadingMessage() != null) LoadingWidget.getInstance().hide(); } }); break; } }
Example 5
Source File: VSliderPanel.java From vaadin-sliderpanel with MIT License | 5 votes |
@Override public void onBrowserEvent(final Event event) { if (!isEnabled()) { return; } if (event != null && (event.getTypeInt() == Event.ONCLICK)) { animateTo(!this.expand, this.animationDuration, true); } super.onBrowserEvent(event); }
Example 6
Source File: MobileUniversalPopup.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCLICK && event.getTarget() == shadow) { hideCommand.execute(); } else { super.onBrowserEvent(event); } }
Example 7
Source File: TextButton.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (mouseListener == null) { super.onBrowserEvent(event); return; } switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: mouseListener.onMouseDown(); break; case Event.ONMOUSEOUT: mouseListener.onMouseLeave(); break; case Event.ONMOUSEOVER: mouseListener.onMouseEnter(); break; case Event.ONMOUSEUP: mouseListener.onMouseUp(); break; case Event.ONCLICK: mouseListener.onClick(); if (stopPropagation) { event.stopPropagation(); } break; } super.onBrowserEvent(event); }
Example 8
Source File: TableEmptyState.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCLICK) { Element fromElement = Element.as(event.getEventTarget()); if (linkMessageLabel.isOrHasChild(fromElement) && linkClickHandler != null) { linkClickHandler.run(); } } }
Example 9
Source File: Tools.java From cuba with Apache License 2.0 | 5 votes |
@Override protected void onPreviewNativeEvent(Event.NativePreviewEvent event) { super.onPreviewNativeEvent(event); NativeEvent nativeEvent = event.getNativeEvent(); Element target = Element.as(nativeEvent.getEventTarget()); if (Event.ONCLICK == event.getTypeInt()) { if (getElement().isOrHasChild(target)) { Scheduler.get().scheduleDeferred(this::hide); } } previewTableContextMenuEvent(event); }
Example 10
Source File: CubaLabelWidget.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && contextHelpClickHandler != null && DOM.eventGetTarget(event) == contextHelpIcon) { contextHelpClickHandler.accept(event); } else { super.onBrowserEvent(event); } }
Example 11
Source File: MockComponent.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Invoked by GWT whenever a browser event is dispatched to this component. */ @Override public void onBrowserEvent(Event event) { if (!shouldCancel(event)) return; switch (event.getTypeInt()) { case Event.ONTOUCHSTART: case Event.ONTOUCHEND: if (isForm()) { select(); } case Event.ONTOUCHMOVE: case Event.ONTOUCHCANCEL: cancelBrowserEvent(event); DomEvent.fireNativeEvent(event, handlers); break; case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: case Event.ONMOUSEMOVE: case Event.ONMOUSEOVER: case Event.ONMOUSEOUT: cancelBrowserEvent(event); mouseListeners.fireMouseEvent(this, event); break; case Event.ONCLICK: cancelBrowserEvent(event); select(); break; default: // Ignore unexpected events break; } }
Example 12
Source File: RoomsTable.java From unitime with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if(event.getTypeInt() == Event.ONCLICK) { event.stopPropagation(); } super.onBrowserEvent(event); }
Example 13
Source File: GwtEditorImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONCLICK: myEditor.changeLine(this); break; default: event.preventDefault(); break; } }
Example 14
Source File: CubaFieldGroupLayoutComponentSlot.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK) { Element target = Element.as(event.getEventTarget()); ComponentConnector componentConnector = Util.findConnectorFor(getWidget()); if (target == contextHelpIndicatorElement && componentConnector instanceof HasContextHelpConnector) { HasContextHelpConnector connector = (HasContextHelpConnector) componentConnector; if (hasContextHelpIconListeners(componentConnector.getState())) { connector.contextHelpIconClick(event); } } } }
Example 15
Source File: CubaTokenListLabelWidget.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && handler != null) { if (DOM.eventGetTarget(event) == closeDiv && editable) { handler.remove(); } } }
Example 16
Source File: SuggestionsContainer.java From cuba with Apache License 2.0 | 4 votes |
@Override public void onBrowserEvent(Event event) { if (getElement() == DOM.eventGetTarget(event)) { return; } SuggestionItem item = findItem(DOM.eventGetTarget(event)); switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: { if (BrowserInfo.get().isIE()) { suggestionFieldWidget.iePreventBlur = true; } break; } case Event.ONCLICK: { if (event.getButton() == NativeEvent.BUTTON_LEFT) { performItemCommand(item); } break; } case Event.ONMOUSEOVER: { if (item != null) { selectItem(item); } break; } case Event.ONKEYDOWN: { int keyCode = KeyCodes.maybeSwapArrowKeysForRtl( event.getKeyCode(), LocaleInfo.getCurrentLocale().isRTL() ); switch (keyCode) { case KeyCodes.KEY_UP: selectPrevItem(); preventEvent(event); break; case KeyCodes.KEY_DOWN: selectNextItem(); preventEvent(event); break; case KeyCodes.KEY_ESCAPE: selectItem(null); preventEvent(event); break; case KeyCodes.KEY_TAB: selectItem(null); break; case KeyCodes.KEY_ENTER: performItemCommand(item); preventEvent(event); break; } break; } } super.onBrowserEvent(event); }
Example 17
Source File: PerspectiveDragConfigModalView.java From dashbuilder with Apache License 2.0 | 4 votes |
@SinkNative(Event.ONCLICK) @EventHandler("cancelButton") public void cancelClick(final Event event) { buttonPressed = ButtonPressed.CANCEL; presenter.onCancel(); }
Example 18
Source File: NavComponentConfigModalView.java From dashbuilder with Apache License 2.0 | 4 votes |
@SinkNative(Event.ONCLICK) @EventHandler("cancelButton") public void cancelClick(final Event event) { buttonPressed = ButtonPressed.CANCEL; presenter.onCancel(); }
Example 19
Source File: ExtendedTree.java From document-management-system with GNU General Public License v2.0 | 4 votes |
@Override public void onBrowserEvent(Event event) { // When de button mouse is released if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) { // When de button mouse is released mouseX = DOM.eventGetClientX(event); mouseY = DOM.eventGetClientY(event); // remove dragable item Main.get().draggable.clear(); switch (DOM.eventGetButton(event)) { case Event.BUTTON_RIGHT: DOM.eventPreventDefault(event); // Prevent to fire event to browser flagPopup = true; mouseDownX = 0; mouseDownY = 0; dragged = false; Main.get().activeFolderTree.menuPopup.disableAllOptions(); fireSelection(elementClicked(DOM.eventGetTarget(event))); break; default: flagPopup = false; // dragging is enable only if cursor is inside actual item dragged = isCursorInsideActualItem(elementClicked(DOM.eventGetTarget(event))); mouseDownX = event.getScreenX(); mouseDownY = event.getClientY(); } } else if (DOM.eventGetType(event) == Event.ONMOUSEMOVE) { mouseX = DOM.eventGetClientX(event); mouseY = DOM.eventGetClientY(event); if (Main.get().activeFolderTree.canDrag() && dragged && mouseDownX > 0 && mouseDownY > 0 && evalDragPixelSensibility()) { TreeItem actualItem = Main.get().activeFolderTree.getActualItem(); Main.get().draggable.show(actualItem.getHTML(), OriginPanel.TREE_ROOT); Main.get().activeFolderTree.fileBrowserRefreshDone(); mouseDownX = 0; mouseDownY = 0; dragged = false; } } else if (DOM.eventGetType(event) == Event.ONMOUSEUP || DOM.eventGetType(event) == Event.ONCLICK || DOM.eventGetType(event) == Event.ONDBLCLICK) { mouseDownX = 0; mouseDownY = 0; dragged = false; // Always disabling the popup flag } // Prevent folder creation or renaming propagate actions to other tree nodes int action = Main.get().activeFolderTree.getFolderAction(); if (action != FolderTree.ACTION_CREATE && action != FolderTree.ACTION_RENAME) { super.onBrowserEvent(event); } }
Example 20
Source File: NavComponentConfigModalView.java From dashbuilder with Apache License 2.0 | 4 votes |
@SinkNative(Event.ONCLICK) @EventHandler("okButton") public void okClick(final Event event) { buttonPressed = ButtonPressed.OK; presenter.onOk(); }