List of usage examples for com.google.gwt.event.dom.client HasDoubleClickHandlers addDoubleClickHandler
HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler);
From source file:com.qualogy.qafe.gwt.client.ui.renderer.RendererHelper.java
License:Apache License
public static void processEvents(ComponentGVO vo, UIObject ui, EventListenerGVO event, List<com.qualogy.qafe.gwt.client.vo.ui.event.InputVariableGVO> inputVariables, String appId) { if (ui != null) { String nonHandledEventName = null; String nonHandledEventMessage = null; if (event instanceof OnEnterEventListenerGVO) { if (ui instanceof HasAllKeyHandlers) { HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui; hasAllKeyHandlers.addKeyDownHandler(EventFactory.createOnEnterListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONENTER; }/* w ww . j a v a2s. c o m*/ } if (event instanceof OnFocusEventListenerGVO) { if (ui instanceof HasFocusHandlers) { HasFocusHandlers hasFocusHandlers = (HasFocusHandlers) ui; hasFocusHandlers.addFocusHandler(EventFactory.createFocusListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONFOCUS; } } if (event instanceof OnExitEventListenerGVO) { if (ui instanceof HasBlurHandlers) { HasBlurHandlers hasBlurHandlers = (HasBlurHandlers) ui; hasBlurHandlers.addBlurHandler(EventFactory.createOnExitListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONEXIT; } } if (event instanceof ClickEventListenerGVO) { if (ui instanceof HasClickHandlers) { ui.addStyleName("qafe_hand"); HasClickHandlers hasClickHandlers = (HasClickHandlers) ui; hasClickHandlers.addClickHandler(EventFactory.createClickListener(event, inputVariables)); } else if (ui instanceof MenuItem) { MenuItem menuItem = (MenuItem) ui; menuItem.setCommand(EventFactory.createCommandListener(menuItem, event, inputVariables)); ui.addStyleName("qafe_hand"); } else if (ui instanceof AreaWidget) { AreaWidget area = (AreaWidget) ui; area.setCommand(EventFactory.createCommandListener(area, event, inputVariables)); ui.addStyleName("qafe_hand"); } else if (ui instanceof TabPanel) { TabPanel tabPanel = (TabPanel) ui; String eventComponentId = event.getEventComponentId(); String[] components = eventComponentId.split("\\."); if (components.length == 1) { tabPanel.addSelectionHandler( EventFactory.createTabPanelListener(tabPanel, event, inputVariables)); ui.addStyleName("qafe_hand"); } } else { nonHandledEventName = QAMLConstants.EVENT_ONCLICK; } } if (event instanceof DoubleClickEventListenerGVO) { if (ui instanceof HasDoubleClickHandlers) { //ui.addStyleName("qafe_hand"); HasDoubleClickHandlers hasDoubleClickHandlers = (HasDoubleClickHandlers) ui; hasDoubleClickHandlers .addDoubleClickHandler(EventFactory.createDoubleClickListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONDBLCLICK; } } if (event instanceof OnChangeEventListenerGVO) { if (ui instanceof QSuggestBox) { QSuggestBox suggestionBox = (QSuggestBox) ui; suggestionBox.addKeyUpHandler( EventFactory.createSuggestionOnKeyUpHandler(suggestionBox, event, inputVariables)); } else if (ui instanceof QDatePicker && ui instanceof HasValueChangeHandlers) { HasValueChangeHandlers hasValueChangeHandlers = (HasValueChangeHandlers) ui; hasValueChangeHandlers.addValueChangeHandler( (EventFactory.createOnValueChangeHandler(event, inputVariables))); } else if (ui instanceof HasDataChangeHandlers) { HasDataChangeHandlers hasDataChangeHandlers = (HasDataChangeHandlers) ui; hasDataChangeHandlers .addDataChangeHandler((EventFactory.createOnDataChangeHandler(event, inputVariables))); } else if (ui instanceof HasChangeHandlers) { HasChangeHandlers hasChangeHandlers = (HasChangeHandlers) ui; hasChangeHandlers .addChangeHandler((EventFactory.createOnChangeListener(event, inputVariables))); } else if (ui instanceof SourcesChangeEvents) { SourcesChangeEvents sourcesChangeEvents = (SourcesChangeEvents) ui; sourcesChangeEvents .addChangeListener(EventFactory.createLegacyOnChangeListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONCHANGE; } } if (event instanceof OnMouseEnterEventListenerGVO) { if (ui instanceof HasAllMouseHandlers) { HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui; hasAllMouseHandlers .addMouseOverHandler(EventFactory.createOnMouseEnterListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_ENTER; } } if (event instanceof OnMouseExitEventListenerGVO) { if (ui instanceof HasAllMouseHandlers) { HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui; hasAllMouseHandlers .addMouseOutHandler(EventFactory.createOnMouseExitListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_EXIT; } } if (event instanceof OnMouseMoveEventListenerGVO) { if (ui instanceof HasAllMouseHandlers) { HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui; hasAllMouseHandlers .addMouseMoveHandler(EventFactory.createOnMouseMoveListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_MOVE; } } if (event instanceof OnMouseUpEventListenerGVO) { if (ui instanceof HasAllMouseHandlers) { HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui; hasAllMouseHandlers .addMouseUpHandler(EventFactory.createOnMouseUpListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_UP; } } if (event instanceof OnMouseDownEventListenerGVO) { if (ui instanceof HasAllMouseHandlers) { HasAllMouseHandlers hasAllMouseHandlers = (HasAllMouseHandlers) ui; hasAllMouseHandlers .addMouseDownHandler(EventFactory.createOnMouseDownListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONMOUSE_DOWN; } } if (event instanceof OnKeyPressEventListenerGVO) { if (ui instanceof HasAllKeyHandlers) { HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui; hasAllKeyHandlers .addKeyPressHandler(EventFactory.createOnKeyPressListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONKEYPRESS; } } if (event instanceof OnKeyDownEventListenerGVO) { if (ui instanceof HasAllKeyHandlers) { HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui; hasAllKeyHandlers .addKeyDownHandler(EventFactory.createOnKeyDownListener(event, inputVariables)); } else if (ui instanceof HasNativeKeyHandlers) { HasNativeKeyHandlers hasNativeKeyHandlers = (HasNativeKeyHandlers) ui; hasNativeKeyHandlers.addNativeKeyDownHandler( EventFactory.createOnNativeKeyDownListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONKEYDOWN; } } if (event instanceof OnKeyUpEventListenerGVO) { if (ui instanceof HasAllKeyHandlers) { HasAllKeyHandlers hasAllKeyHandlers = (HasAllKeyHandlers) ui; hasAllKeyHandlers.addKeyUpHandler(EventFactory.createOnKeyUpListener(event, inputVariables)); } else if (ui instanceof HasNativeKeyHandlers) { HasNativeKeyHandlers hasNativeKeyHandlers = (HasNativeKeyHandlers) ui; hasNativeKeyHandlers .addNativeKeyUpHandler(EventFactory.createOnNativeKeyUpListener(event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONKEYUP; } } if (event instanceof OnLoadEventListenerGVO) { if (!(vo instanceof WindowGVO)) { nonHandledEventName = QAMLConstants.EVENT_ONLOAD; nonHandledEventMessage = "Support on Window only."; } } if (event instanceof OnUnLoadEventListenerGVO) { if (!(vo instanceof WindowGVO)) { nonHandledEventName = QAMLConstants.EVENT_ONUNLOAD; nonHandledEventMessage = "Support on Window only."; } } if (event instanceof OnFinishEventListenerGVO) { if (ui instanceof FormPanel) { FormPanel formPanel = (FormPanel) ui; formPanel.addSubmitCompleteHandler( EventFactory.createSubmitCompleteHandler(ui, event, inputVariables)); } else { nonHandledEventName = QAMLConstants.EVENT_ONFINISH; } } if (event instanceof OnTimerEventListenerGVO) { //check a timer is already scheduled for this event- this happens when there are multiple component reference mentioned in that event if (!ClientApplicationContext.getInstance().isTimerScheduledForEvent(appId, vo.getWindow(), event.getEventId())) { OnTimerHandler timerHandler = new OnTimerHandler(); timerHandler.processOnTimer(ui, vo, appId, event, inputVariables); } else { nonHandledEventName = QAMLConstants.EVENT_ONTIMER; nonHandledEventMessage = "Timer is already scheduled."; } } if (nonHandledEventName != null) { if (nonHandledEventMessage == null) { nonHandledEventMessage = ""; } ClientApplicationContext.getInstance() .log("The component [" + DOM.getElementAttribute(ui.getElement(), "id") + "] for event [" + event.getEventId() + "] does not support " + nonHandledEventName + " listener. " + nonHandledEventMessage, null); } } }
From source file:com.vaadin.client.debug.internal.HierarchyPanel.java
License:Apache License
private Widget buildConnectorTree(final ServerConnector connector, FastStringSet openNodes) { String connectorString = Util.getConnectorString(connector); List<ServerConnector> children = connector.getChildren(); Widget widget;//from w w w . j ava 2s.c o m if (children == null || children.isEmpty()) { // Leaf node, just add a label Label label = new Label(connectorString); label.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Highlight.showOnly(connector); showServerDebugInfo(connector); } }); widget = label; } else { SimpleTree tree = new SimpleTree(connectorString) { @Override protected void select(ClickEvent event) { super.select(event); Highlight.showOnly(connector); showServerDebugInfo(connector); } }; for (ServerConnector child : children) { tree.add(buildConnectorTree(child, openNodes)); } if (openNodes.contains(connectorString)) { tree.open(false); } widget = tree; } if (widget instanceof HasDoubleClickHandlers) { HasDoubleClickHandlers has = (HasDoubleClickHandlers) widget; has.addDoubleClickHandler(new DoubleClickHandler() { @Override public void onDoubleClick(DoubleClickEvent event) { fireSelectEvent(connector); } }); } return widget; }