本文整理汇总了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
}
}
});
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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;
}
}
示例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);
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
}