本文整理汇总了Java中com.google.gwt.cell.client.ValueUpdater类的典型用法代码示例。如果您正苦于以下问题:Java ValueUpdater类的具体用法?Java ValueUpdater怎么用?Java ValueUpdater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueUpdater类属于com.google.gwt.cell.client包,在下文中一共展示了ValueUpdater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void onBrowserEvent(Context context,
Element parent, InlineHyperlink value, NativeEvent nativeEvent,
ValueUpdater<InlineHyperlink> valueUpdater) {
super.onBrowserEvent(context, parent, value, nativeEvent, valueUpdater);
Event event = Event.as(nativeEvent);
if(DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
Element target = Element.as(event.getEventTarget());
Element child = parent.getFirstChildElement();
if(child.isOrHasChild(target)) {
History.newItem(value.getTargetHistoryToken());
DOM.eventPreventDefault(event);
}
}
}
示例2: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void onBrowserEvent(Context context, Element parent, C value,
NativeEvent nativeEvent, ValueUpdater<C> valueUpdater) {
Event event = Event.as(nativeEvent);
if(DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
Element target = Element.as(event.getEventTarget());
// first child is outer div (see IconCellDecorator)
Element child = parent.getFirstChildElement();
if(child != null) {
// next child is div containing icon image
child = child.getFirstChildElement();
if(child != null && child.isOrHasChild(target)) {
delegate.execute(value);
DOM.eventPreventDefault(event);
} else {
super.onBrowserEvent(context, parent, value, nativeEvent, valueUpdater);
}
}
}
}
示例3: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
/**
* Called when an event occurs in a rendered instance of this Cell. The
* parent element refers to the element that contains the rendered cell, NOT
* to the outermost element that the Cell rendered.
*/
@Override
public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context,
Element parent, String value, NativeEvent event,
com.google.gwt.cell.client.ValueUpdater<String> valueUpdater) {
// Let AbstractCell handle the keydown event.
super.onBrowserEvent(context, parent, value, event, valueUpdater);
// Handle the click event.
if ("click".equals(event.getType())) {
// Ignore clicks that occur outside of the outermost element.
EventTarget eventTarget = event.getEventTarget();
if (parent.isOrHasChild(Element.as(eventTarget))) {
Element el = Element.as(eventTarget);
if (el.getNodeName().equalsIgnoreCase("IMG")) {
doAction(el.getParentElement().getAttribute("name"),
valueUpdater);
}
}
}
}
示例4: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
public void onBrowserEvent(final Context context,
final Element parent,
final HyperLink value,
final NativeEvent event,
final ValueUpdater<HyperLink> valueUpdater) {
super.onBrowserEvent(context,
parent,
value,
event,
valueUpdater);
if (CLICK.equals(event.getType())) {
onEnterKeyDown(context,
parent,
value,
event,
valueUpdater);
}
}
示例5: onEnterKeyDown
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
protected void onEnterKeyDown(final Context context,
final Element parent,
final HyperLink value,
final NativeEvent event,
final ValueUpdater<HyperLink> valueUpdater) {
final Element element = event.getEventTarget().cast();
if (!parent.getFirstChildElement().equals(element)) {
return;
}
event.preventDefault();
event.stopPropagation();
if (valueUpdater != null) {
valueUpdater.update(value);
}
}
示例6: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
public void onBrowserEvent(final Context context,
final Element parent,
final String value,
final NativeEvent event,
final ValueUpdater<String> valueUpdater) {
super.onBrowserEvent(context,
parent,
value,
event,
valueUpdater);
if (CLICK.equals(event.getType())) {
EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
return;
}
if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
// Ignore clicks that occur outside of the main element.
onEnterKeyDown(context,
parent,
value,
event,
valueUpdater);
}
}
}
示例7: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context,
Element parent,
String value,
NativeEvent event,
ValueUpdater<String> valueUpdater) {
if (selectable) {
String eventType = event.getType();
switch (eventType) {
case MOUSEOVER:
parent.getStyle().setCursor(Style.Cursor.POINTER);
break;
case CLICK:
int rowIndexInPage = context.getIndex() - table.getPageStart();
getPresenter().selectCell(columnId, rowIndexInPage);
break;
}
}
}
示例8: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) {
if (Element.is(event.getEventTarget()) && getCellParent(parent).isOrHasChild(Element.as(event.getEventTarget()))) {
if (cell.getConsumedEvents().contains(event.getType())) {
cell.onBrowserEvent(context, getCellParent(parent), value, event, valueUpdater);
}
} else {
onNonCellBrowserEvent(context, parent, value, event, valueUpdater);
}
}
示例9: onNonCellBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的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);
}
}
}
示例10: onEnterKeyDown
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
protected void onEnterKeyDown(Context context, final Element parent, Date value,
NativeEvent event, ValueUpdater<Date> valueUpdater) {
this.lastKey = context.getKey();
this.lastParent = parent;
this.lastValue = value;
this.valueUpdater = valueUpdater;
Date viewData = getViewData(context.getKey());
Date date = (viewData == null) ? value : viewData;
datePicker.setCurrentMonth(date);
datePicker.setValue(date);
panel.setPopupPositionAndShow(new PositionCallback() {
public void setPosition(int offsetWidth, int offsetHeight) {
panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX,
parent.getAbsoluteTop() + offsetY);
}
});
}
示例11: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element parent, String value,
NativeEvent event, ValueUpdater<String> valueUpdater) {
ViewData viewData = getViewData(context.getKey());
if (viewData != null && viewData.isEditing()) {
// Handle the edit event.
editEvent(context, parent, viewData, event, valueUpdater);
} else {
String type = event.getType();
int keyCode = event.getKeyCode();
boolean enterPressed = "keyup".equals(type)
&& keyCode == KeyCodes.KEY_ENTER;
if ("click".equals(type) || enterPressed) {
// Go into edit mode.
if (viewData == null) {
viewData = new ViewData(value);
setViewData(context.getKey(), viewData);
} else {
viewData.setEditing(true);
}
edit(context, parent, value);
}
}
}
示例12: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element parent, T value,
NativeEvent event, ValueUpdater<T> valueUpdater) {
int x = event.getClientX();
int y = event.getClientY();
Element child = parent.getFirstChildElement();
if (x >= child.getAbsoluteLeft() && x <= child.getAbsoluteRight() &&
y >= child.getAbsoluteTop() && y <= child.getAbsoluteBottom()) {
String type = event.getType();
int keyCode = event.getKeyCode();
boolean enterPressed = KEYUP.equals(type)
&& keyCode == KeyCodes.KEY_ENTER;
if ((CLICK.equals(type) || enterPressed) && validator.canPerformAction(value)) {
setValue(context, parent, value);
itemClicked(value);
}
}
}
示例13: finishEditing
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的package包/类
@Override
protected void finishEditing(Element parent, String value, Object key,
ValueUpdater<String> valueUpdater) {
String newValue = getInputElement(parent).getValue();
ViewData vd = getViewData(key);
if (vd == null) {
vd = new ViewData(value);
setViewData(key, vd);
}
vd.setCurrentValue(newValue);
if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) {
vd.setLastValue(newValue);
valueUpdater.update(newValue);
}
super.finishEditing(parent, newValue, key, valueUpdater);
}
示例14: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的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);
}
}
}
示例15: onBrowserEvent
import com.google.gwt.cell.client.ValueUpdater; //导入依赖的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);
}
}
}