use of org.gwtproject.cell.client.Cell.Context in project gwtproject by treblereel.
the class CellTreeNodeView method resetFocusOnCell.
/**
* Reset focus on this node.
*
* @return true of the cell takes focus, false if not
*/
boolean resetFocusOnCell() {
if (parentNodeInfo != null) {
Context context = new Context(getIndex(), 0, getValueKey());
Cell<T> cell = parentNodeInfo.getCell();
return cell.resetFocus(context, getCellParent(), value);
}
return false;
}
use of org.gwtproject.cell.client.Cell.Context in project gwtproject by treblereel.
the class CellTestBase method testRenderNegativeIndex.
/**
* Test rendering the cell with a negative index is handled.
*/
public void testRenderNegativeIndex() {
Cell<T> cell = createCell();
T value = createCellValue();
SafeHtmlBuilder sb = new SafeHtmlBuilder();
Context context = new Context(-1, -1, null);
cell.render(context, value, sb);
assertEquals(getExpectedInnerHtml(), sb.toSafeHtml().asString());
}
use of org.gwtproject.cell.client.Cell.Context in project gwtproject by treblereel.
the class CellTestBase method testRenderNull.
/**
* Test rendering the cell with a null value and no view data.
*/
public void testRenderNull() {
org.gwtproject.cell.client.Cell<T> cell = createCell();
SafeHtmlBuilder sb = new SafeHtmlBuilder();
Context context = new Context(0, 0, null);
cell.render(context, null, sb);
assertEquals(getExpectedInnerHtmlNull(), sb.toSafeHtml().asString());
}
use of org.gwtproject.cell.client.Cell.Context in project gwtproject by treblereel.
the class EditTextCellTest method testRenderUnsafeHtmlWhenEditing.
/**
* Test rendering the cell with a malicious value in edit mode.
*/
public void testRenderUnsafeHtmlWhenEditing() {
EditTextCell cell = createCell();
ViewData viewData = new ViewData("originalValue");
viewData.setText("<script>malicious</script>");
viewData.setEditing(true);
cell.setViewData(DEFAULT_KEY, viewData);
SafeHtmlBuilder sb = new SafeHtmlBuilder();
Context context = new Context(0, 0, DEFAULT_KEY);
cell.render(context, "<script>malicious</script>", sb);
assertEquals("<input type=\"text\" value=\"<script>malicious</script>\" " + "tabindex=\"-1\"></input>", sb.toSafeHtml().asString());
}
use of org.gwtproject.cell.client.Cell.Context in project gwtproject by treblereel.
the class IconCellDecoratorTest method testRenderNoImage.
public void testRenderNoImage() {
MockCell<String> innerCell = new MockCell<String>(true, "newValueFromInnerCell", "click");
IconCellDecorator<String> cell = new IconCellDecorator<String>(Resources.prettyPiccy(), innerCell) {
@Override
protected boolean isIconUsed(String value) {
return false;
}
};
// Render the cell.
SafeHtmlBuilder sb = new SafeHtmlBuilder();
Context context = new Context(0, 0, null);
cell.render(context, "helloworld", sb);
// Compare the expected render string.
String expected = "<div style=\"padding-left: 64px;position:relative;zoom:1;\">";
expected += cell.getImageHtml(Resources.prettyPiccy(), HasVerticalAlignment.ALIGN_MIDDLE, true).asString();
expected += "<div>helloworld</div>";
expected += "</div>";
assertEquals(expected, sb.toSafeHtml().asString());
}
Aggregations