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

The following examples show how to use com.google.gwt.user.client.Event#BUTTON_RIGHT . 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 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 2
Source File: EventWrapper.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * @return A string describing which mouse buttons were pressed,
 *        e.g., " left"
 */
private static String mouseButtons(Event event) {
  if (event.getButton() == -1) {
    return "";
  } else {
    return ((event.getButton() & Event.BUTTON_LEFT) != 0 ? " left" : "")
        + ((event.getButton() & Event.BUTTON_MIDDLE) != 0 ? " middle" : "")
        + ((event.getButton() & Event.BUTTON_RIGHT) != 0 ? " right" : "");
  }
}
 
Example 3
Source File: EventWrapper.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * @return A string describing which mouse buttons were pressed,
 *        e.g., " left"
 */
private static String mouseButtons(Event event) {
  if (event.getButton() == -1) {
    return "";
  } else {
    return ((event.getButton() & Event.BUTTON_LEFT) != 0 ? " left" : "")
        + ((event.getButton() & Event.BUTTON_MIDDLE) != 0 ? " middle" : "")
        + ((event.getButton() & Event.BUTTON_RIGHT) != 0 ? " right" : "");
  }
}
 
Example 4
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 5
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 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.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 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.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 8
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 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 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 10
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);
	}
}