本文整理汇总了Java中com.google.gwt.cell.client.Cell.Context方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.Context方法的具体用法?Java Cell.Context怎么用?Java Cell.Context使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.cell.client.Cell
的用法示例。
在下文中一共展示了Cell.Context方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void render(Cell.Context context, TraceRecordInfo tr, SafeHtmlBuilder sb) {
if ((tr.getAttributes() != null && tr.getAttributes().size() > 0)||tr.getExceptionInfo() != null) {
sb.appendHtmlConstant("<span style=\"cursor: pointer;\">");
sb.appendHtmlConstant(expandedDetails.contains(tr.getPath()) ? EXPANDER_COLLAPSE : EXPANDER_EXPAND);
sb.appendHtmlConstant("</span>");
}
}
示例2: render
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
/**
* This method provides style for your wrap data
*
*/
public void render(Cell.Context context, WrapString value, SafeHtmlBuilder sb) {
String longString = value.getLongString();
@SuppressWarnings("unused")
String row1Content = longString;
@SuppressWarnings("unused")
String row2Content = null;
int LINE_SIZE = 60;
sb.appendHtmlConstant("<div><table width='100%'>");
while (longString != null && !longString.isEmpty()) {
if (longString.length() <= LINE_SIZE) {
sb.appendHtmlConstant("<tr><td><div>"+longString+"</div></td></tr>");
break;
} else {
sb.appendHtmlConstant("<tr><td><div>"+longString.subSequence(0, LINE_SIZE)+"</div></td></tr>");
longString = longString.substring(LINE_SIZE);
}
}
sb.appendHtmlConstant("</table></div>");
}
示例3: RemoveActionHasCell
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
public RemoveActionHasCell(String text,
ActionCell.Delegate<DataGridFilterSummary> delegate) {
cell = new ActionCell<DataGridFilterSummary>(text,
delegate) {
@Override
public void render(Cell.Context context,
final DataGridFilterSummary value,
SafeHtmlBuilder sb) {
AbstractImagePrototype imageProto = AbstractImagePrototype.create(images.close());
SafeHtmlBuilder mysb = new SafeHtmlBuilder();
mysb.appendHtmlConstant("<span title='" + CommonConstants.INSTANCE.RemoveFilter() + " " + value.getFilterName() + "' style='margin-right:5px;'>");
mysb.append(imageProto.getSafeHtml());
mysb.appendHtmlConstant("</span>");
sb.append(mysb.toSafeHtml());
}
};
}
示例4: render
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void render(Cell.Context context, Object aValue, SafeHtmlBuilder sb) {
Boolean value = (Boolean) aValue;
// Get the view data.
Object key = context.getKey();
Boolean viewData = getViewData(key);
if (viewData != null && viewData.equals(value)) {
clearViewData(key);
viewData = null;
}
if (groupName != null) {
if (value != null && (viewData != null ? viewData : value)) {
sb.append(radioTemplate.checked(groupName));
} else {
sb.append(radioTemplate.unchecked(groupName));
}
} else {
if (value != null && (viewData != null ? viewData : value)) {
sb.append(checkTemplate.checked());
} else {
sb.append(checkTemplate.unchecked());
}
}
}
示例5: onNonCellBrowserEvent
import com.google.gwt.cell.client.Cell; //导入方法依赖的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);
}
}
}
示例6: testOnBrowserEventEnabled
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Test
public void testOnBrowserEventEnabled() {
context = new Cell.Context( 0,
0,
new EnumRow( "Fact",
"field",
"['a', 'b']" ) );
cell.onBrowserEvent( context,
parent,
"Fact",
event,
valueUpdater );
verify( cell,
times( 1 ) ).doOnBrowserEvent( eq( context ),
eq( parent ),
eq( "Fact" ),
eq( event ),
eq( valueUpdater ) );
}
示例7: testOnBrowserEventDisabled
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Test
public void testOnBrowserEventDisabled() {
context = new Cell.Context( 0,
0,
new EnumRow( "A raw value" ) );
cell.onBrowserEvent( context,
parent,
"Fact",
event,
valueUpdater );
verify( cell,
never() ).doOnBrowserEvent( eq( context ),
eq( parent ),
eq( "Fact" ),
eq( event ),
eq( valueUpdater ) );
}
示例8: testRenderEnabled
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Test
public void testRenderEnabled() {
context = new Cell.Context( 0,
0,
new EnumRow( "Fact",
"field",
"['a', 'b']" ) );
final SafeHtmlBuilder sb = mock( SafeHtmlBuilder.class );
cell.render( context,
"Fact",
sb );
verify( cell,
times( 1 ) ).doRender( eq( context ),
eq( "Fact" ),
eq( sb ) );
}
示例9: testRenderDisabled
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Test
public void testRenderDisabled() {
context = new Cell.Context( 0,
0,
new EnumRow( "A raw value" ) );
final SafeHtmlBuilder safeHtmlBuilder = mock( SafeHtmlBuilder.class );
cell.render( context,
"Fact",
safeHtmlBuilder );
verify( cell,
never() ).doRender( eq( context ),
eq( "Fact" ),
eq( safeHtmlBuilder ) );
verify( safeHtmlBuilder,
times( 1 ) ).append( safeHtmlArgumentCaptor.capture() );
final SafeHtml safeHtml = safeHtmlArgumentCaptor.getValue();
assertEquals( "cellContent(disabled, invalidDefinitionDisabled, Fact)",
safeHtml.asString() );
}
示例10: startEditing
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void startEditing(final Cell.Context context,
final Element parent,
final Date value) {
Date date = value;
if (value == null) {
Date d = new Date();
int year = d.getYear();
int month = d.getMonth();
int dom = d.getDate();
date = new Date(year,
month,
dom);
}
datePicker.setValue(date);
}
示例11: startEditing
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void startEditing(final Cell.Context context,
final Element parent,
final C value) {
// Select the appropriate item
boolean emptyValue = (value == null);
if (emptyValue) {
listBox.setSelectedIndex(0);
} else {
final String convertedValue = convertToString(value);
if (listBox.isMultipleSelect()) {
final List<String> convertedValues = Arrays.asList(convertedValue.split(","));
for (int i = 0; i < listBox.getItemCount(); i++) {
listBox.setItemSelected(i,
convertedValues.contains(listBox.getValue(i)));
}
} else {
for (int i = 0; i < listBox.getItemCount(); i++) {
if (listBox.getValue(i).equals(convertedValue)) {
listBox.setSelectedIndex(i);
break;
}
}
}
}
}
示例12: onBrowserEvent
import com.google.gwt.cell.client.Cell; //导入方法依赖的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);
}
});
}
示例13: onBrowserEvent
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Cell.Context context, final Element parent, ImageResource value, NativeEvent event,
ValueUpdater<ImageResource> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
if (event.getType().equals("click")) {
if(valueUpdater != null) {
valueUpdater.update(value);
}
}
}
示例14: render
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void render(Cell.Context context,
SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div style='position: relative; cursor: pointer; padding: 0px;'>");
sb.appendHtmlConstant("<span style='padding-right: 10px'>");
sb.appendEscaped(text);
sb.appendHtmlConstant("</span>");
// sb.appendHtmlConstant("<div style='position:absolute;right:0px;top:0px;'></div>");
switch (sortDirection) {
case NONE:
// nothing
break;
case ASCENDING:
sb.appendHtmlConstant(sortIndex == 0 ? UP_ARROW : SMALL_UP_ARROW);
break;
case DESCENDING:
sb.appendHtmlConstant(sortIndex == 0 ? DOWN_ARROW : SMALL_DOWN_ARROW);
break;
default:
throw new IllegalArgumentException("Unknown sortDirection ("
+ sortDirection
+ ").");
}
sb.appendHtmlConstant("</div>");
// sb.appendHtmlConstant("<div>");
// sb.appendHtmlConstant("</div></div>");
}
示例15: onBrowserEvent
import com.google.gwt.cell.client.Cell; //导入方法依赖的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);
}
}
}
}