本文整理汇总了Java中com.google.gwt.cell.client.Cell类的典型用法代码示例。如果您正苦于以下问题:Java Cell类的具体用法?Java Cell怎么用?Java Cell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Cell类属于com.google.gwt.cell.client包,在下文中一共展示了Cell类的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: createAttributeNameColumn
import com.google.gwt.cell.client.Cell; //导入依赖的package包/类
protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeNameColumn(ColumnSortEvent.ListHandler<Entry<String, String>> sortHandler) {
// Attribute name.
final Cell<String> nameCell = canManageAttributes() ? new EditTextCell() : new TextCell();
final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> keyColumn = new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(
nameCell) {
@Override
public String getValue(final Entry<String, String> object) {
return object.getKey() != null ? object.getKey() : "";
}
};
keyColumn.setSortable(true);
sortHandler.setComparator(keyColumn,
new Comparator<Entry<String, String>>() {
@Override
public int compare(Entry<String, String> o1,
Entry<String, String> o2) {
return o1.getKey().compareTo(o2.getKey());
}
});
keyColumn.setFieldUpdater(canManageAttributes() ? keyModifiedEventHandler : null);
return keyColumn;
}
示例5: createAttributeValueColumn
import com.google.gwt.cell.client.Cell; //导入依赖的package包/类
protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeValueColumn(ColumnSortEvent.ListHandler<Entry<String, String>> sortHandler) {
// Attribute value.
final Cell<String> valueCell = canManageAttributes() ? new EditTextCell() : new TextCell();
final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> valueColumn = new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(
valueCell) {
@Override
public String getValue(final Entry<String, String> object) {
return object.getValue() != null ? object.getValue() : "";
}
};
valueColumn.setSortable(true);
sortHandler.setComparator(valueColumn,
new Comparator<Entry<String, String>>() {
@Override
public int compare(Entry<String, String> o1,
Entry<String, String> o2) {
return o1.getValue().compareTo(o2.getValue());
}
});
valueColumn.setFieldUpdater(canManageAttributes() ? valueModifiedEventHandler : null);
return valueColumn;
}
示例6: addColumn
import com.google.gwt.cell.client.Cell; //导入依赖的package包/类
/**
* Add a column with a header.
*
* @param <C> the cell type
* @param cell the cell used to render the column
* @param headerText the header string
* @param getter the value getter for the cell
*/
private <C> Column<UserBean, C> addColumn(Cell<C> cell,
String headerText,
final GetValue<C> getter,
FieldUpdater<UserBean, C> fieldUpdater) {
Column<UserBean, C> column = new Column<UserBean, C>(cell) {
@Override
public C getValue(UserBean object) {
return getter.getValue(object);
}
};
column.setFieldUpdater(fieldUpdater);
grid.addColumn(column,
headerText);
return column;
}
示例7: 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());
}
}
}
示例8: 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);
}
}
}
示例9: ListView
import com.google.gwt.cell.client.Cell; //导入依赖的package包/类
public ListView(final ListPresenter<LISTITEM> presenter, Cell<LISTITEM> itemDisplayCell) {
this.presenter = presenter;
this.cellList = new CellList<LISTITEM>(itemDisplayCell);
cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
// Add a selection model to handle user selection.
final SingleSelectionModel<LISTITEM> selectionModel = new SingleSelectionModel<LISTITEM>();
cellList.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
LISTITEM selected = selectionModel.getSelectedObject();
if (selected != null) {
presenter.onSelectionChanged(event, selectionModel);
}
}
});
this.pagerTop = new SimplePager();
this.pagerTop.setDisplay(this.cellList);
this.pagerBottom = new SimplePager();
this.pagerBottom.setDisplay(this.cellList);
initWidget((Widget)uiBinder.createAndBindUi(this));
}
示例10: decideReturnType
import com.google.gwt.cell.client.Cell; //导入依赖的package包/类
private JType decideReturnType(Class cellType)
{
String cellClassName = Cell.class.getName();
JClassType cellJType = findType(cellType);
for (JClassType superType : cellJType.getFlattenedSupertypeHierarchy())
{
if (cellClassName.equals(superType.getQualifiedSourceName()))
{
JParameterizedType parameterizedType = superType.isParameterized();
if (parameterizedType != null)
{
return parameterizedType.getTypeArgs()[0];
}
}
}
return null;
}
示例11: addColumn
import com.google.gwt.cell.client.Cell; //导入依赖的package包/类
/**
* Add a column with a header.
*
* @param <C> the cell type
* @param cell the cell used to render the column
* @param headerText the header string
* @param getter the value getter for the cell
*/
@ShowcaseSource
private <C> Column<ContactInfo, C> addColumn(Cell<C> cell, String headerText,
final GetValue<C> getter, FieldUpdater<ContactInfo, C> fieldUpdater) {
Column<ContactInfo, C> column = new Column<ContactInfo, C>(cell) {
@Override
public C getValue(ContactInfo object) {
return getter.getValue(object);
}
};
column.setFieldUpdater(fieldUpdater);
if (cell instanceof AbstractEditableCell<?, ?>) {
editableCells.add((AbstractEditableCell<?, ?>) cell);
}
contactList.addColumn(column, headerText);
return column;
}
示例12: 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 ) );
}
示例13: 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 ) );
}
示例14: 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 ) );
}
示例15: 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() );
}