com.vaadin.shared.MouseEventDetails Java Examples
The following examples show how to use
com.vaadin.shared.MouseEventDetails.
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: AbstractButtonValueConnector.java From vaadin-grid-util with MIT License | 6 votes |
/** * dirty hack because of the convertion within {@link ClickableRenderer} of {@link ClickEvent} to {@link NativeEvent} were the * RelativeElement get lost... before rpc-call is fired ask Widget of it's last relativeX value that should be this current onClickEvent */ @Override protected void init() { this.clickRegistration = addClickHandler(new RendererClickHandler<JsonObject>() { @Override public void onClick(final RendererClickEvent<JsonObject> event) { MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getNativeEvent()); // get relativeX from Widget itself details.setRelativeX(getRenderer().getClickedBITM()); getRpcProxy(RendererClickRpc.class).click(getRowKey(event.getCell() .getRow()), getColumnId(event.getCell() .getColumn()), details); } }); }
Example #2
Source File: CubaFoldersPane.java From cuba with Apache License 2.0 | 6 votes |
@Override public void itemClick(Tree.ItemClick<T> event) { if (event.getMouseEventDetails().getButton() == MouseEventDetails.MouseButton.LEFT) { T folder = event.getItem(); if (getItemClickable(folder)) { openFolder(folder); } else if (isItemExpandable(folder)) { //noinspection unchecked Tree<AbstractSearchFolder> tree = (Tree<AbstractSearchFolder>) event.getSource(); if (tree.isExpanded(folder)) { tree.collapse(folder); } else { tree.expand(folder); } } } }
Example #3
Source File: VDDPanel.java From cuba with Apache License 2.0 | 6 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param event * The drag event */ protected void updateDragDetails(VDragEvent event) { Element over = event.getElementOver(); Widget content = WidgetUtil.findWidget(over, null); if (content != null && content != this) { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, content.getClass().getName()); } else { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, this.getClass().getName()); } // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #4
Source File: CubaButton.java From cuba with Apache License 2.0 | 6 votes |
@Override protected void fireClick(MouseEventDetails details) { // check if it cannot be clicked at all due to modal dialogs CubaUI ui = (CubaUI) getUI(); if (ui.isAccessibleForUser(this)) { try { if (clickHandler != null) { clickHandler.accept(details); } else { super.fireClick(details); } } finally { if (getState(false).useResponsePending) { getRpcProxy(CubaButtonClientRpc.class).onClickHandled(); } } } else { LoggerFactory.getLogger(CubaButton.class) .debug("Ignore click because button is inaccessible for user"); } }
Example #5
Source File: VDDAccordion.java From cuba with Apache License 2.0 | 6 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param event * The drag event */ protected void updateDragDetails(VDragEvent event) { if (event.getElementOver() == null) { return; } StackItem tab = WidgetUtil.findWidget(event.getElementOver(), StackItem.class); if (tab != null && getElement().isOrHasChild(tab.getElement())) { Map<String, Object> dropDetails = event.getDropDetails(); int index = getTabPosition(tab); dropDetails.put(Constants.DROP_DETAIL_TO, index); VerticalDropLocation location = getDropLocation(tab, event); dropDetails.put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, location); MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); dropDetails.put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); } }
Example #6
Source File: ConfirmButton.java From viritin with Apache License 2.0 | 5 votes |
@Override protected void fireClick(final MouseEventDetails details) { ConfirmDialog dialog = ConfirmDialog.show(getUI(), getConfirmWindowCaption(), getConfirmationText(), getOkCaption(), getCancelCaption(), new Runnable() { @Override public void run() { doFireClickListener(details); } }); dialog.getOkButton().addStyleName(confirmWindowOkButtonStyle); }
Example #7
Source File: VDDVerticalLayout.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param widget * The container which we are hovering over * @param event * The drag event */ protected void updateDragDetails(Widget widget, VDragEvent event) { if (widget == null) { return; } /* * The horizontal position within the cell{ */ event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, getVerticalDropLocation(widget, event)); /* * The index over which the drag is. Can be used by a client side * criteria to verify that a drag is over a certain index. */ int index = -1; if (widget instanceof Slot) { WidgetCollection captionsAndSlots = getChildren(); index = VDragDropUtil.findSlotIndex(captionsAndSlots, (Slot) widget); } event.getDropDetails().put(Constants.DROP_DETAIL_TO, index); // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #8
Source File: VDDHorizontalLayout.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param widget * The container which we are hovering over * @param event * The drag event */ protected void updateDragDetails(Widget widget, VDragEvent event) { if (widget == null) { return; } /* * The horizontal position within the cell{ */ event.getDropDetails().put( Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, getHorizontalDropLocation(widget, event)); /* * The index over which the drag is. Can be used by a client side * criteria to verify that a drag is over a certain index. */ int index = -1; if (widget instanceof Slot) { WidgetCollection captionsAndSlots = getChildren(); index = VDragDropUtil.findSlotIndex(captionsAndSlots, (Slot) widget); } event.getDropDetails().put(Constants.DROP_DETAIL_TO, index); // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #9
Source File: WebButton.java From cuba with Apache License 2.0 | 5 votes |
protected void buttonClicked(@SuppressWarnings("unused") MouseEventDetails mouseEventDetails) { beforeActionPerformed(); if (action != null) { action.actionPerform(getActionEventTarget()); } if (hasSubscriptions(ClickEvent.class)) { publish(ClickEvent.class, new ClickEvent(this)); } afterActionPerformed(); }
Example #10
Source File: CubaSourceCodeEditorConnector.java From cuba with Apache License 2.0 | 5 votes |
@Override public void contextHelpIconClick(NativeEvent event) { MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event, getWidget().getElement()); getRpcProxy(HasContextHelpServerRpc.class).iconClick(details); }
Example #11
Source File: VDDHorizontalLayout.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param widget * The container which we are hovering over * @param event * The drag event */ protected void updateDragDetails(Widget widget, VDragEvent event) { if (widget == null) { return; } /* * The horizontal position within the cell{ */ event.getDropDetails().put( Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, getHorizontalDropLocation(widget, event)); /* * The index over which the drag is. Can be used by a client side * criteria to verify that a drag is over a certain index. */ int index = -1; if (widget instanceof Slot) { WidgetCollection captionsAndSlots = getChildren(); index = VDragDropUtil.findSlotIndex(captionsAndSlots, (Slot) widget); } event.getDropDetails().put(Constants.DROP_DETAIL_TO, index); // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #12
Source File: VDDVerticalLayout.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param widget * The container which we are hovering over * @param event * The drag event */ protected void updateDragDetails(Widget widget, VDragEvent event) { if (widget == null) { return; } /* * The horizontal position within the cell{ */ event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, getVerticalDropLocation(widget, event)); /* * The index over which the drag is. Can be used by a client side * criteria to verify that a drag is over a certain index. */ int index = -1; if (widget instanceof Slot) { WidgetCollection captionsAndSlots = getChildren(); index = VDragDropUtil.findSlotIndex(captionsAndSlots, (Slot) widget); } event.getDropDetails().put(Constants.DROP_DETAIL_TO, index); // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #13
Source File: VDDVerticalSplitPanel.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param event * The drag event */ protected void updateDragDetails(VDragEvent event) { Element over = event.getElementOver(); // Resolve where the drop was made VerticalDropLocation location = null; Widget content = null; if (firstContainer.isOrHasChild(over)) { location = VerticalDropLocation.TOP; content = Util.findWidget(firstContainer, null); } else if (splitter.isOrHasChild(over)) { location = VerticalDropLocation.MIDDLE; content = this; } else if (secondContainer.isOrHasChild(over)) { location = VerticalDropLocation.BOTTOM; content = Util.findWidget(secondContainer, null); } event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, location); if (content != null) { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, content.getClass().getName()); } else { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, this.getClass().getName()); } // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #14
Source File: VDDHorizontalSplitPanel.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param event * The drag event */ protected void updateDragDetails(VDragEvent event) { Element over = event.getElementOver(); if (over == null) { return; } // Resolve where the drop was made HorizontalDropLocation location = null; Widget content = null; if (firstContainer.isOrHasChild(over)) { location = HorizontalDropLocation.LEFT; content = Util.findWidget(firstContainer, null); } else if (splitter.isOrHasChild(over)) { location = HorizontalDropLocation.CENTER; content = this; } else if (secondContainer.isOrHasChild(over)) { location = HorizontalDropLocation.RIGHT; content = Util.findWidget(secondContainer, null); } event.getDropDetails() .put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, location); if (content != null) { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, content.getClass().getName()); } else { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, this.getClass().getName()); } // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #15
Source File: VDDFormLayout.java From cuba with Apache License 2.0 | 5 votes |
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * * @param widget * The container which we are hovering over * @param event * The drag event */ protected void updateDragDetails(Widget widget, VDragEvent event) { /* * The horizontal position within the cell */ event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, getVerticalDropLocation(VDDFormLayout.getRowFromChildElement( widget.getElement(), VDDFormLayout.this.getElement()), event)); /* * The index over which the drag is. Can be used by a client side * criteria to verify that a drag is over a certain index. */ event.getDropDetails().put(Constants.DROP_DETAIL_TO, "-1"); for (int i = 0; i < table.getRowCount(); i++) { Widget w = table.getWidget(i, COLUMN_WIDGET); if (widget.equals(w)) { event.getDropDetails().put(Constants.DROP_DETAIL_TO, i); } } /* * Add Classname of component over the drag. This can be used by a a * client side criteria to verify that a drag is over a specific class * of component. */ String className = widget.getClass().getName(); event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, className); // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder .buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
Example #16
Source File: WindowBreadCrumbs.java From cuba with Apache License 2.0 | 5 votes |
protected void onCloseWindowButtonClick(@SuppressWarnings("unused") MouseEventDetails meDetails) { Window window = getCurrentWindow(); if (!window.isCloseable()) { return; } if (!isCloseWithCloseButtonPrevented(window)) { window.getFrameOwner() .close(FrameOwner.WINDOW_CLOSE_ACTION); } }
Example #17
Source File: Gantt.java From gantt with Apache License 2.0 | 5 votes |
public ResizeEvent(Gantt source, AbstractStep step, long startDate, long endDate, long previousStartDate, long previousEndDate, MouseEventDetails details) { super(source); this.step = step; this.startDate = startDate; this.endDate = endDate; this.previousStartDate = previousStartDate; this.previousEndDate = previousEndDate; this.details = details; }
Example #18
Source File: Gantt.java From gantt with Apache License 2.0 | 5 votes |
public MoveEvent(Gantt source, AbstractStep step, long startDate, long endDate, int stepIndex, long previousStartDate, long previousEndDate, int previousStepIndex, MouseEventDetails details) { super(source); this.step = step; this.startDate = startDate; this.endDate = endDate; this.stepIndex = stepIndex; this.previousStartDate = previousStartDate; this.previousEndDate = previousEndDate; this.previousStepIndex = previousStepIndex; this.details = details; }
Example #19
Source File: Gantt.java From gantt with Apache License 2.0 | 5 votes |
protected void fireResizeEvent(String stepUid, long startDate, long endDate, MouseEventDetails details) { AbstractStep step = getStep(stepUid); long previousStartDate = step.getStartDate(); long previousEndDate = step.getEndDate(); step.setStartDate(startDate); step.setEndDate(endDate); resizeDatesByOwnerStep(step, previousStartDate, previousEndDate); adjustDatesByAbstractStep(step); fireEvent(new ResizeEvent(this, step, step.getStartDate(), step.getEndDate(), previousStartDate, previousEndDate, details)); }
Example #20
Source File: Gantt.java From gantt with Apache License 2.0 | 5 votes |
protected void fireMoveEvent(String stepUid, String newStepUid, long startDate, long endDate, MouseEventDetails details) { AbstractStep step = getStep(stepUid); AbstractStep newStep = getStep(newStepUid); int previousStepIndex = (step instanceof Step) ? getStepIndex((Step) step) : getStepIndex(((SubStep) step).getOwner()); long previousStartDate = step.getStartDate(); long previousEndDate = step.getEndDate(); step.setStartDate(startDate); step.setEndDate(endDate); int newStepIndex; if (isMovableStepsBetweenRows() && newStep instanceof Step) { newStepIndex = getStepIndex((Step) newStep); if (step instanceof Step) { // move to new row moveStep(newStepIndex, (Step) step); } else { // move sub-step to new owner moveSubStep((SubStep) step, (Step) newStep); } } else { newStepIndex = previousStepIndex; } moveDatesByOwnerStep(step, previousStartDate, previousEndDate); adjustDatesByAbstractStep(step); fireEvent(new MoveEvent(this, step, step.getStartDate(), step.getEndDate(), newStepIndex, previousStartDate, previousEndDate, previousStepIndex, details)); }
Example #21
Source File: DemoUI.java From gantt with Apache License 2.0 | 5 votes |
private void showNotificationWithMousedetails(String msg, MouseEventDetails details) { String detailsTxt = ""; if (details.isCtrlKey()) { detailsTxt = "(Ctrl down) "; } Notification.show(detailsTxt + msg, Type.TRAY_NOTIFICATION); }
Example #22
Source File: ConfirmButton.java From viritin with Apache License 2.0 | 5 votes |
protected void doFireClickListener(final MouseEventDetails details) { ConfirmButton.super.fireClick(details); if (mClickListeners != null) { final MButton.MClickListener[] array = mClickListeners.toArray( new MButton.MClickListener[mClickListeners.size()]); for (MButton.MClickListener l : array) { l.onClick(); } } }
Example #23
Source File: TableContextMenu.java From context-menu with Apache License 2.0 | 5 votes |
private void useTableSpecificContextClickListener(final Table table) { table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.getButton() == MouseButton.RIGHT) { MouseEventDetails mouseEventDetails = new MouseEventDetails(); mouseEventDetails.setAltKey(event.isAltKey()); mouseEventDetails.setButton(event.getButton()); mouseEventDetails.setClientX(event.getClientX()); mouseEventDetails.setClientY(event.getClientY()); mouseEventDetails.setCtrlKey(event.isCtrlKey()); mouseEventDetails.setMetaKey(event.isMetaKey()); mouseEventDetails.setRelativeX(event.getRelativeX()); mouseEventDetails.setRelativeY(event.getRelativeY()); mouseEventDetails.setShiftKey(event.isShiftKey()); if (event.isDoubleClick()) { mouseEventDetails.setType(0x00002); } else { mouseEventDetails.setType(0x00001); } getContextClickListener().contextClick( new ContextClickEvent(table, mouseEventDetails)); } } }); }
Example #24
Source File: MButton.java From viritin with Apache License 2.0 | 5 votes |
@Override protected void fireClick(MouseEventDetails details) { super.fireClick(details); if (mClickListeners != null) { final MClickListener[] array = mClickListeners.toArray( new MClickListener[mClickListeners.size()]); for (MClickListener l : array) { l.onClick(); } } }
Example #25
Source File: TableContextMenu.java From cuba with Apache License 2.0 | 5 votes |
private void useTableSpecificContextClickListener(final Table table) { table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.getButton() == MouseButton.RIGHT) { MouseEventDetails mouseEventDetails = new MouseEventDetails(); mouseEventDetails.setAltKey(event.isAltKey()); mouseEventDetails.setButton(event.getButton()); mouseEventDetails.setClientX(event.getClientX()); mouseEventDetails.setClientY(event.getClientY()); mouseEventDetails.setCtrlKey(event.isCtrlKey()); mouseEventDetails.setMetaKey(event.isMetaKey()); mouseEventDetails.setRelativeX(event.getRelativeX()); mouseEventDetails.setRelativeY(event.getRelativeY()); mouseEventDetails.setShiftKey(event.isShiftKey()); if (event.isDoubleClick()) { mouseEventDetails.setType(0x00002); } else { mouseEventDetails.setType(0x00001); } getContextClickListener().contextClick( new ContextClickEvent(table, mouseEventDetails)); } } }); }
Example #26
Source File: Gantt.java From gantt with Apache License 2.0 | 4 votes |
@Override public void onMove(String stepUid, String newStepUid, long startDate, long endDate, MouseEventDetails details) { fireMoveEvent(stepUid, newStepUid, startDate, endDate, details); }
Example #27
Source File: Gantt.java From gantt with Apache License 2.0 | 4 votes |
@Override public void stepClicked(String stepUid, MouseEventDetails details) { fireClickEvent(stepUid, details); }
Example #28
Source File: GanttConnector.java From gantt with Apache License 2.0 | 4 votes |
@Override public void onMove(String stepUid, String newStepUid, long startDate, long endDate, NativeEvent event, Element relativeToElement) { MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event, relativeToElement); rpc.onMove(stepUid, newStepUid, startDate, endDate, details); }
Example #29
Source File: MTable.java From viritin with Apache License 2.0 | 4 votes |
@Override public MouseEventDetails.MouseButton getButton() { return orig.getButton(); }
Example #30
Source File: FluentItemClickEvent.java From viritin with Apache License 2.0 | 4 votes |
public FluentItemClickEvent(Component source, Item item, Object itemId, Object propertyId, MouseEventDetails details) { super(source, item, itemId, propertyId, details); }