List of usage examples for com.vaadin.shared MouseEventDetails deSerialize
public static MouseEventDetails deSerialize(String serializedString)
From source file:com.foc.web.unitTesting.FocUnitTestingCommand.java
License:Apache License
/** * MenuTree Double click action /* w ww . j av a 2 s . c o m*/ */ private void menuDoubleClickAction() throws Exception { boolean nodeOpened = !getLogger().openCommand("Menu Double Click"); FocXMLLayout navigationLayout = getCurrentCentralPanel(); FVTableWrapperLayout tableWrapper = (FVTableWrapperLayout) findComponent(navigationLayout, "MENU_TREE"); FVTreeTable treeTable = (FVTreeTable) tableWrapper.getTableOrTree(); String eventString = MouseEventDetails.MouseButton.LEFT + ",0,0,false,false,false,false,2,0,0"; MouseEventDetails details = MouseEventDetails.deSerialize(eventString); ItemClickEvent doubleClickEvent = new ItemClickEvent(treeTable, treeTable.getFocList().getItem(treeTable.getValue()), treeTable.getValue(), "TITLE", details); treeTable.getItemClickListener().itemClick(doubleClickEvent); if (nodeOpened) getLogger().closeNode(); }
From source file:com.foc.web.unitTesting.FocUnitTestingCommand.java
License:Apache License
/** * Simulates a navigation and a click on the "Launch Unit Test" button * effectively launching the test over and over again. Useful function to * crash the server for the lulz./*w ww. ja va2s.c o m*/ * */ public void launchUnitTest() throws Exception { button_ClickAdmin(); FocXMLLayout navigationLayout = getCurrentCentralPanel(); FVTableWrapperLayout tableWrapper = (FVTableWrapperLayout) findComponent(navigationLayout, "MENU_TREE"); FVTreeTable treeTable = (FVTreeTable) tableWrapper.getTableOrTree(); TableTreeDelegate delegate = treeTable.getTableTreeDelegate(); delegate.selectByFocProperty("CODE", "UNIT_TEST"); Object objectID = treeTable.getParent(treeTable.getValue()); while (objectID != null) { treeTable.setCollapsed(objectID, false); objectID = treeTable.getParent(objectID); } String eventString = MouseEventDetails.MouseButton.LEFT + ",0,0,false,false,false,false,2,0,0"; MouseEventDetails details = MouseEventDetails.deSerialize(eventString); ItemClickEvent doubleClickEvent = new ItemClickEvent(treeTable, treeTable.getFocList().getItem(treeTable.getValue()), treeTable.getValue(), "TITLE", details); treeTable.getItemClickListener().itemClick(doubleClickEvent); }
From source file:com.haulmont.cuba.web.widgets.addons.dragdroplayouts.details.AbsoluteLayoutTargetDetails.java
License:Apache License
/** * Some details about the mouse event/*from w ww .j a v a 2s . com*/ * * @return details about the actual event that caused the event details. * Practically mouse move or mouse up. */ public MouseEventDetails getMouseEvent() { return MouseEventDetails.deSerialize((String) getData(Constants.DROP_DETAIL_MOUSE_EVENT)); }
From source file:com.haulmont.cuba.web.widgets.addons.dragdroplayouts.details.AccordionTargetDetails.java
License:Apache License
/** * Some details about the mouse event/*from w w w. ja va 2 s .c o m*/ * * @return details about the actual event that caused the event details. * Practically mouse move or mouse up. */ public MouseEventDetails getMouseEvent() { return MouseEventDetails.deSerialize((String) getData("mouseEvent")); }
From source file:com.haulmont.cuba.web.widgets.addons.dragdroplayouts.drophandlers.AbstractDefaultLayoutDropHandler.java
License:Apache License
/** * Handles a drop by a component which has an absolute layout as parent. In * this case the component is moved.//from w w w . j a v a 2s. c om * * @param event * The drag and drop event */ protected void handleDropFromAbsoluteParentLayout(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); TargetDetails details = event.getTargetDetails(); MouseEventDetails mouseDown = transferable.getMouseDownEvent(); MouseEventDetails mouseUp = MouseEventDetails .deSerialize((String) details.getData(Constants.DROP_DETAIL_MOUSE_EVENT)); int movex = mouseUp.getClientX() - mouseDown.getClientX(); int movey = mouseUp.getClientY() - mouseDown.getClientY(); Component comp = transferable.getComponent(); DDAbsoluteLayout parent = (DDAbsoluteLayout) comp.getParent(); ComponentPosition position = parent.getPosition(comp); if (position.getLeftValue() != null) { float x = position.getLeftValue() + movex; position.setLeft(x, Sizeable.UNITS_PIXELS); } if (position.getRightValue() != null) { float x = position.getRightValue() - movex; position.setRight(x, Sizeable.UNITS_PIXELS); } if (position.getTopValue() != null) { float y = position.getTopValue() + movey; position.setTop(y, Sizeable.UNITS_PIXELS); } if (position.getBottomValue() != null) { float y = position.getBottomValue() - movey; position.setBottom(y, Sizeable.UNITS_PIXELS); } }
From source file:com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable.java
License:Apache License
/** * @return the mouse down event that started the drag and drop operation *///from w w w . j a v a 2s . c o m public MouseEventDetails getMouseDownEvent() { return MouseEventDetails.deSerialize((String) getData(Constants.TRANSFERABLE_DETAIL_MOUSEDOWN)); }
From source file:org.peergreen.vaadin.diagram.DiagramDropHandler.java
License:Apache License
@Override public void drop(final DragAndDropEvent event) { TargetDetails targetDetails = event.getTargetDetails(); Transferable transferable = event.getTransferable(); MouseEventDetails mouseEventDetails = MouseEventDetails .deSerialize((String) targetDetails.getData("mouseEvent")); Integer absoluteLeft = (Integer) targetDetails.getData("absoluteLeft"); Integer absoluteTop = (Integer) targetDetails.getData("absoluteTop"); diagram.drop(mouseEventDetails.getClientX() - absoluteLeft, mouseEventDetails.getClientY() - absoluteTop, (String) transferable.getData("component-type")); }