Java Code Examples for com.google.gwt.user.client.Event#ONDBLCLICK

The following examples show how to use com.google.gwt.user.client.Event#ONDBLCLICK . 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: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
		if (selectedRow >= 0) {
			markSelectedRow(selectedRow);
			Main.get().onlineUsersPopup.enableAcceptButton();
			DOM.eventCancelBubble(event, true);
			Main.get().onlineUsersPopup.executeAction();
		}
	}

	super.onBrowserEvent(event);
}
 
Example 2
Source File: VSliderPanel.java    From vaadin-sliderpanel with MIT License 6 votes vote down vote up
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
    if (autoCollapseSlider && event != null && !event.isCanceled() && expand) {
        Event nativeEvent = Event.as(event.getNativeEvent());

        switch (nativeEvent.getTypeInt()) {
            case Event.ONMOUSEDOWN:
            case Event.ONTOUCHSTART:
            case Event.ONDBLCLICK:

                if (eventTargetsPopup(nativeEvent)) {
                    return;
                }
                if (eventTargetsInnerElementsPopover(nativeEvent)) {
                    return;
                }
                setExpand(false, true);
        }
    }
}
 
Example 3
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
	}

	// Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action
	if (selectedRow >= 0) {

		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);

		// On double click not sends event to onCellClicked across super.onBrowserEvent();
		if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
			// Disables the event propagation the sequence is:
			// Two time entry onCellClicked before entry on onBrowserEvent and disbles the
			// Tree onCellClicked that produces inconsistence error refreshing
			DOM.eventCancelBubble(event, true);
			Main.get().mainPanel.search.historySearch.searchSaved.getSearch();

		} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
			switch (DOM.eventGetButton(event)) {
				case Event.BUTTON_RIGHT:
					markSelectedRow(selectedRow);
					Main.get().mainPanel.search.historySearch.searchSaved.showMenu();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
					break;
				default:
					break;
			}
		}
	}
	super.onBrowserEvent(event);
}
 
Example 4
Source File: EventWrapper.java    From swellrt with Apache License 2.0 5 votes vote down vote up
public static String asString(Event event) {
  // Start with the event type string
  String string = DOM.eventGetTypeString(event);
  // Next type-specific fields
  switch (event.getTypeInt()) {
  case Event.ONKEYPRESS:
  case Event.ONKEYUP:
  case Event.ONKEYDOWN:
    string += key(event) + modifiers(event);
    break;
  case Event.ONCLICK:
  case Event.ONDBLCLICK:
  case Event.ONMOUSEMOVE:
    string += mousePoint(event) + modifiers(event);
    break;
  case Event.ONMOUSEDOWN:
  case Event.ONMOUSEUP:
    string += mousePoint(event) + mouseButtons(event) + modifiers(event);
    break;
  case Event.ONMOUSEOUT:
    string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event);
    break;
  case Event.ONMOUSEOVER:
    string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event);
    break;
  case Event.ONMOUSEWHEEL:
    string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event);
    break;
  case Event.ONFOCUS:
  case Event.ONBLUR:
  case Event.ONCHANGE:
  case Event.ONERROR:
  case Event.ONLOAD:
  case Event.ONLOSECAPTURE:
  case Event.ONSCROLL:
    break;
  }
  return string;
}
 
Example 5
Source File: EventWrapper.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
public static String asString(Event event) {
  // Start with the event type string
  String string = DOM.eventGetTypeString(event);
  // Next type-specific fields
  switch (event.getTypeInt()) {
  case Event.ONKEYPRESS:
  case Event.ONKEYUP:
  case Event.ONKEYDOWN:
    string += key(event) + modifiers(event);
    break;
  case Event.ONCLICK:
  case Event.ONDBLCLICK:
  case Event.ONMOUSEMOVE:
    string += mousePoint(event) + modifiers(event);
    break;
  case Event.ONMOUSEDOWN:
  case Event.ONMOUSEUP:
    string += mousePoint(event) + mouseButtons(event) + modifiers(event);
    break;
  case Event.ONMOUSEOUT:
    string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event);
    break;
  case Event.ONMOUSEOVER:
    string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event);
    break;
  case Event.ONMOUSEWHEEL:
    string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event);
    break;
  case Event.ONFOCUS:
  case Event.ONBLUR:
  case Event.ONCHANGE:
  case Event.ONERROR:
  case Event.ONLOAD:
  case Event.ONLOSECAPTURE:
  case Event.ONSCROLL:
    break;
  }
  return string;
}
 
Example 6
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
	}

	// Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action
	if (selectedRow >= 0) {

		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);

		// On double click not sends event to onCellClicked across super.onBrowserEvent();
		if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
			// Disables the event propagation the sequence is:
			// Two time entry onCellClicked before entry on onBrowserEvent and disables the
			// Tree onCellClicked that produces inconsistence error refreshing
			DOM.eventCancelBubble(event, true);
			MessagingToolBarBox.get().messageDashboard.messageStack.messageReceived.refreshMessagesReceived();

		} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
			switch (DOM.eventGetButton(event)) {
				case Event.BUTTON_RIGHT:
					markSelectedRow(selectedRow);
					MessagingToolBarBox.get().messageDashboard.messageStack.messageReceived.menuPopup.setPopupPosition(mouseX, mouseY);
					MessagingToolBarBox.get().messageDashboard.messageStack.messageReceived.menuPopup.show();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
					break;
				default:
					break;
			}
		}
	}
	super.onBrowserEvent(event);
}
 
Example 7
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
	}

	// Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action
	if (selectedRow >= 0) {

		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);

		// On double click not sends event to onCellClicked across super.onBrowserEvent();
		if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
			// Disables the event propagation the sequence is:
			// Two time entry onCellClicked before entry on onBrowserEvent and disables the
			// Tree onCellClicked that produces inconsistence error refreshing
			DOM.eventCancelBubble(event, true);
			MessagingToolBarBox.get().messageDashboard.messageStack.messageSent.refreshMessagesSent();

		} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
			switch (DOM.eventGetButton(event)) {
				case Event.BUTTON_RIGHT:
					markSelectedRow(selectedRow);
					MessagingToolBarBox.get().messageDashboard.messageStack.messageSent.menuPopup.setPopupPosition(mouseX, mouseY);
					MessagingToolBarBox.get().messageDashboard.messageStack.messageSent.menuPopup.show();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
					break;
				default:
					break;
			}
		}
	}
	super.onBrowserEvent(event);
}
 
Example 8
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
	}

	// Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action
	if (selectedRow >= 0) {

		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);

		// On double click not sends event to onCellClicked across super.onBrowserEvent();
		if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
			// Disables the event propagation the sequence is:
			// Two time entry onCellClicked before entry on onBrowserEvent and disables the
			// Tree onCellClicked that produces inconsistence error refreshing
			DOM.eventCancelBubble(event, true);
			MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.refreshProposedQueries();

		} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
			switch (DOM.eventGetButton(event)) {
				case Event.BUTTON_RIGHT:
					markSelectedRow(selectedRow);
					MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.menuPopup.setPopupPosition(mouseX, mouseY);
					MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.menuPopup.show();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
					break;
				default:
					break;
			}
		}
	}
	super.onBrowserEvent(event);
}
 
Example 9
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
	}

	// Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action
	if (selectedRow >= 0) {

		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);

		// On double click not sends event to onCellClicked across super.onBrowserEvent();
		if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
			// Disables the event propagation the sequence is:
			// Two time entry onCellClicked before entry on onBrowserEvent and disables the
			// Tree onCellClicked that produces inconsistence error refreshing
			DOM.eventCancelBubble(event, true);
			MessagingToolBarBox.get().messageDashboard.messageStack.proposedSubscriptionReceived.refreshProposedSubscriptions();

		} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
			switch (DOM.eventGetButton(event)) {
				case Event.BUTTON_RIGHT:
					markSelectedRow(selectedRow);
					MessagingToolBarBox.get().messageDashboard.messageStack.proposedSubscriptionReceived.menuPopup.setPopupPosition(mouseX, mouseY);
					MessagingToolBarBox.get().messageDashboard.messageStack.proposedSubscriptionReceived.menuPopup.show();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
					break;
				default:
					break;
			}
		}
	}
	super.onBrowserEvent(event);
}
 
Example 10
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public void onBrowserEvent(Event event) {
	boolean headerFired = false; // Controls when event is fired by header

	// Case targe event is header must disable drag & drop
	if (headerTable.getEventTargetCell(event) != null) {
		headerFired = true;
	}

	// Selects the panel
	setSelectedPanel(true);

	// When de button mouse is released
	mouseX = DOM.eventGetClientX(event);
	mouseY = DOM.eventGetClientY(event);

	// On double click not sends event to onCellClicked across super.onBrowserEvent();
	if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
		// Disables the event propagation the sequence is:
		// Two time entry onCellClicked before entry on onBrowserEvent and disbles the
		// Tree onCellClicked that produces inconsistence error refreshing
		DOM.eventCancelBubble(event, true);
		if ((isDocumentSelected() || isAttachmentSelected()) && Main.get().workspaceUserProperties.getWorkspace().getAvailableOption().isDownloadOption()) {
			Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.downloadDocument();
		}

	} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		switch (DOM.eventGetButton(event)) {
			case Event.BUTTON_RIGHT:
				if (!headerFired) {
					if (isDocumentSelected() || isAttachmentSelected()) {
						Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.checkMenuOptionPermissions(getDocument());
					} else if (isFolderSelected()) {
						Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.checkMenuOptionPermissions(getFolder());
					} else if (isMailSelected()) {
						Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.checkMenuOptionPermissions(getMail());
					}
					Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.evaluateMenuOptions();
					Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.showMenu();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
				}
				break;
			default:
				break;
		}
	}

	super.onBrowserEvent(event);
}
 
Example 11
Source File: ExtendedFlexTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public void onBrowserEvent(Event event) {
	int selectedRow = 0;

	if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		Element td = getMouseEventTargetCell(event);
		if (td == null) return;
		Element tr = DOM.getParent(td);
		Element body = DOM.getParent(tr);
		selectedRow = DOM.getChildIndex(body, tr);
	}

	// Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action
	if (selectedRow >= 0) {

		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);


		// On double click not sends event to onCellClicked across super.onBrowserEvent();
		if (DOM.eventGetType(event) == Event.ONDBLCLICK) {
			// Disables the event propagation the sequence is:
			// Two time entry onCellClicked before entry on onBrowserEvent and disbles the
			// Tree onCellClicked that produces inconsistence error refreshing
			DOM.eventCancelBubble(event, true);
			Main.get().mainPanel.search.historySearch.userNews.getSearch();

		} else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
			switch (DOM.eventGetButton(event)) {
				case Event.BUTTON_RIGHT:
					markSelectedRow(selectedRow);
					Main.get().mainPanel.search.historySearch.userNews.showMenu();
					DOM.eventPreventDefault(event); // Prevent to fire event to browser
					break;
				default:
					break;
			}
		}
	}
	super.onBrowserEvent(event);
}
 
Example 12
Source File: ExtendedTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@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 13
Source File: CubaFileUploadProgressWindow.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void onBrowserEvent(final Event event) {
    boolean bubble = true;

    final int type = event.getTypeInt();

    final Element target = DOM.eventGetTarget(event);

    if (resizing || resizeBox == target) {
        onResizeEvent(event);
        bubble = false;
    } else if (isClosable() && target == closeBox) {
        if (type == Event.ONCLICK) {
            closeWindow();
        }
        bubble = false;
    } else if (header.isOrHasChild(target) && !dragging) {
        // dblclick handled in connector
        if (type != Event.ONDBLCLICK && draggable) {
            if (type == Event.ONMOUSEDOWN) {
                /*
                 * Prevents accidental selection of window caption or
                 * content. (#12726)
                 */
                event.preventDefault();

                headerDragPending = event;
            } else if (type == Event.ONMOUSEMOVE
                    && headerDragPending != null) {
                // ie won't work unless this is set here
                dragging = true;
                onDragEvent(headerDragPending);
                onDragEvent(event);
                headerDragPending = null;
            } else {
                headerDragPending = null;
            }
            bubble = false;
        }
    } else if (dragging || !contents.isOrHasChild(target)) {
        onDragEvent(event);
        bubble = false;
    }
    /*
     * If clicking on other than the content, move focus to the window.
     * After that this windows e.g. gets all keyboard shortcuts.
     */
    if (type == Event.ONMOUSEDOWN
            && !contentPanel.getElement().isOrHasChild(target)
            && target != closeBox) {
        contentPanel.focus();
    }

    if (!bubble) {
        event.stopPropagation();
    } else {
        // Super.onBrowserEvent takes care of Handlers added by the
        // ClickEventHandler
        super.onBrowserEvent(event);
    }
}