当前位置: 首页>>代码示例>>Java>>正文


Java BrowserEvents类代码示例

本文整理汇总了Java中com.google.gwt.dom.client.BrowserEvents的典型用法代码示例。如果您正苦于以下问题:Java BrowserEvents类的具体用法?Java BrowserEvents怎么用?Java BrowserEvents使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BrowserEvents类属于com.google.gwt.dom.client包,在下文中一共展示了BrowserEvents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: NotesTable

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public NotesTable() {
        selectionModel = new MultiSelectionModel<Note>();
        table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Note> createDefaultManager());
        info.setCellStyleNames(AppStyles.NOTE_TEXT);
        list.setCellStyleNames(AppStyles.NOTE_LIST_NAME);
        table.addColumn(info, "Note");
//        table.addColumn(list, "List");
        initWidget(table);
        dataProvider = new ListDataProvider<Note>();
        dataProvider.addDataDisplay(table);

        table.addCellPreviewHandler(new CellPreviewEvent.Handler() {
            @Override
            public void onCellPreview(CellPreviewEvent event) {
                if (BrowserEvents.CLICK.equalsIgnoreCase(event.getNativeEvent().getType())) {
                    selectedColumn = event.getColumn();
                    selectedRow = event.getIndex();
                    //used to prepare double click info
                }
            }
        });
    }
 
开发者ID:turbomanage,项目名称:listmaker,代码行数:23,代码来源:NotesTable.java

示例2: onNonCellBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
protected void onNonCellBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) {
	if (treeProvider != null) {
		if (BrowserEvents.MOUSEDOWN.equals(event.getType())) {
			T toBeToggled = treeProvider.getList().get(context.getIndex());
			treeProvider.getList().set(context.getIndex(), toBeToggled);
			if (isExpanded(context)) {
				treeProvider.collapse(toBeToggled);
			} else {
				treeProvider.expand(toBeToggled);
			}
		} else if (cell.getConsumedEvents().contains(event.getType())) {
			cell.onBrowserEvent(context, getCellParent(parent), value, event, valueUpdater);
		}
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:17,代码来源:TreeExpandableCell.java

示例3: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element targetCell, NativeEvent event) {
	if (BrowserEvents.DRAGSTART.equals(event.getType())) {
		event.stopPropagation();
		EventTarget et = event.getEventTarget();
		if (Element.is(et)) {
			DraggedColumn<?> col = new DraggedColumn<>(column, this, table, targetCell, Element.as(et));
			if ((col.isMove() && moveable) || (col.isResize() && resizable)) {
				event.getDataTransfer().<XDataTransfer> cast().setEffectAllowed("move");
				DraggedColumn.instance = col;
				event.getDataTransfer().setData(
				        "Text",
				        (table != null ? "grid-section-" + table.hashCode() : "not leaf") + "; column-" + (DraggedColumn.instance.isMove() ? "moved" : "resized")
				                + (table != null ? ":" + table.getColumnIndex(column) : ""));
			} else {
				event.getDataTransfer().<XDataTransfer> cast().setEffectAllowed("none");
			}
		}
	}
	super.onBrowserEvent(context, targetCell, event);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:22,代码来源:DraggableHeader.java

示例4: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void onBrowserEvent(Context context, Element parent, T value,
        NativeEvent event, ValueUpdater<T> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    String type = event.getType();
    if (BrowserEvents.CHANGE.equals(type)) {
        Object key = context.getKey();
        SelectElement select = parent.getFirstChild().cast();
        T newValue = getValueAtIndex((K) key, select.getSelectedIndex());
        setViewData(key, newValue);
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }
    }
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:18,代码来源:AbstractSelectionCell.java

示例5: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element parent, T value,
    NativeEvent event, ValueUpdater<T> valueUpdater) {
  super.onBrowserEvent(context, parent, value, event, valueUpdater);
  String type = event.getType();
  if (BrowserEvents.CHANGE.equals(type)) {
    Object key = context.getKey();
    SelectElement select = parent.getFirstChild().cast();
    T newValue = options.get(select.getSelectedIndex());
    //setViewData(key, newValue);
    finishEditing(parent, newValue, key, valueUpdater);
    if (valueUpdater != null) {
      valueUpdater.update(newValue);
    }
  }
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:17,代码来源:ValueSelectionCell.java

示例6: onBrowserEvent2

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
protected void onBrowserEvent2(Event event) {
  super.onBrowserEvent2(event);

  // Handle keyboard navigation between lists.
  String eventType = event.getType();
  if (BrowserEvents.KEYDOWN.equals(eventType) && !isKeyboardNavigationSuppressed()) {
    int keyCode = event.getKeyCode();
    boolean isRtl = LocaleInfo.getCurrentLocale().isRTL();
    keyCode = KeyCodes.maybeSwapArrowKeysForRtl(keyCode, isRtl);
    switch (keyCode) {
      case KeyCodes.KEY_LEFT:
        keyboardNavigateShallow();
        return;
      case KeyCodes.KEY_RIGHT:
        keyboardNavigateDeep();
        return;
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:CellBrowser.java

示例7: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element parent, String value,
                           NativeEvent event, ValueUpdater<String> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    String type = event.getType();
    if (BrowserEvents.CHANGE.equals(type)) {
        Object key = context.getKey();
        SelectElement select = parent.getFirstChild().cast();
        String newValue = options.get(select.getSelectedIndex());
        setViewData(key, newValue);
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }
    }
}
 
开发者ID:kiegroup,项目名称:jbpm-data-modeler,代码行数:17,代码来源:DynamicSelectionCell.java

示例8: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
    CellBasedWidgetImpl.get().onBrowserEvent(this, event);

    // Ignore spurious events (such as onblur) while we refresh the table.
    if (refreshing) {
        return;
    }

    // Verify that the target is still a child of this widget. IE fires focus
    // events even after the element has been removed from the DOM.
    EventTarget eventTarget = event.getEventTarget();
    if (!Element.is(eventTarget)) {
        return;
    }
    Element target = Element.as(eventTarget);
    if (!getElement().isOrHasChild(Element.as(eventTarget))) {
        return;
    }
    super.onBrowserEvent(event);

    String eventType = event.getType();
    if (BrowserEvents.FOCUS.equals(eventType)) {
        // Remember the focus state.
        focused = true;
        onFocus();
    } else if (BrowserEvents.BLUR.equals(eventType)) {
        // Remember the blur state.
        focused = false;
        onBlur();
    } else if (BrowserEvents.KEYDOWN.equals(eventType)) {
        // A key event indicates that we already have focus.
        focused = true;
    } else if (BrowserEvents.MOUSEDOWN.equals(eventType)
            && CellBasedWidgetImpl.get().isFocusable(Element.as(target))) {
        // If a natively focusable element was just clicked, then we must have
        // focus.
        focused = true;
    }
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material-table,代码行数:41,代码来源:AbstractDataTable.java

示例9: PopupCell

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public PopupCell(PopupPanel popupPanel, Cell<T> contentCell) {
	this.contentCell = contentCell;
	this.popupPanel = popupPanel;

	consumedEvents = new HashSet<String>();
	if (contentCell.getConsumedEvents() != null) {
		consumedEvents.addAll(contentCell.getConsumedEvents());
	}
	consumedEvents.add(BrowserEvents.CLICK);

}
 
开发者ID:wte4j,项目名称:wte4j,代码行数:12,代码来源:PopupCell.java

示例10: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
@Override
public void onBrowserEvent(Cell.Context context, Element parent, T value,
		NativeEvent event, ValueUpdater<T> valueUpdater) {
	contentCell.onBrowserEvent(context, parent, value, event, valueUpdater);
	EventTarget eventTarget = event.getEventTarget();
	if (!BrowserEvents.CLICK.equals(event.getType())) {
		return;
	}
	final Element domElement = Element.as(eventTarget);
	popupPanel.setPopupPositionAndShow(new PositionCallback() {
		@Override
		public void setPosition(int offsetWidth, int offsetHeight) {

			int positionLeft = domElement.getAbsoluteLeft();
			int outerleft = domElement.getAbsoluteLeft() + popupPanel.getOffsetWidth();
			if (outerleft > Window.getClientWidth()) {
				positionLeft = domElement.getAbsoluteLeft() - popupPanel.getOffsetWidth() + domElement.getOffsetWidth();
			}

			int positionTop = domElement.getAbsoluteTop();
			int outerTop = domElement.getAbsoluteTop() + popupPanel.getOffsetWidth();
			if (outerTop > Window.getClientHeight()) {
				positionTop = domElement.getAbsoluteTop() - popupPanel.getOffsetHeight() + domElement.getOffsetHeight();
			}
			popupPanel.setPopupPosition(positionLeft, positionTop);
		}
	});
}
 
开发者ID:wte4j,项目名称:wte4j,代码行数:29,代码来源:PopupCell.java

示例11: fireGestureStartEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public void fireGestureStartEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.GESTURESTART, false, false), widget);
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:4,代码来源:MaterialWidgetTestCase.java

示例12: fireGestureChangeEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public void fireGestureChangeEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.GESTURECHANGE, false, false), widget);
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:4,代码来源:MaterialWidgetTestCase.java

示例13: fireGestureEndEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public void fireGestureEndEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.GESTUREEND, false, false), widget);
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:4,代码来源:MaterialWidgetTestCase.java

示例14: fireTouchCancelEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public void fireTouchCancelEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.TOUCHCANCEL, false, false), widget);
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:4,代码来源:MaterialWidgetTestCase.java

示例15: onBrowserEvent

import com.google.gwt.dom.client.BrowserEvents; //导入依赖的package包/类
public void onBrowserEvent(Cell.Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater) {
	if (readonly == null || !readonly.isReadonly()) {
		if (!isEditing(context, parent, value)) {
			String type = event.getType();
			int keyCode = event.getKeyCode();
			boolean editToggleKeys = BrowserEvents.KEYDOWN.equals(type) && (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_F2);
			if (BrowserEvents.DBLCLICK.equals(type) || editToggleKeys) {
				// Switch to edit mode.
				ViewData<T> viewData = new ViewData<>(Document.get().createUniqueId(), valueUpdater);
				setViewData(context.getKey(), viewData);
				setValue(new RenderedCellContext(context.getIndex(), context.getColumn(), context.getKey()), parent, value);
			}
		}
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:16,代码来源:RenderedEditorCell.java


注:本文中的com.google.gwt.dom.client.BrowserEvents类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。