/** * Render the object into the cell. * * @param context the cell context * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
/** * Handle a browser event that took place within the column. * * @param context the cell context * @param elem the parent Element * @param object the base object to be updated * @param event the native browser event */ public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) { final int index = context.getIndex(); ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : new ValueUpdater<C>() { @Override public void update(C value) { fieldUpdater.update(index, object, value); } }; cell.onBrowserEvent(context, elem, getValue(object), event, valueUpdater); }
int count = 0; for(Column column : columns){ if(column != null && column.getValue() != null){ count++; } }
/** * Render the object into the cell. * * @param context the cell context * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
/** * Render the object into the cell. * * @param context the cell context * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
public int compare(T leftRow, T rightRow) { for (SortableHeader<T, ?> sortableHeader : sortOrderList) { Comparable leftColumnValue = sortableHeader.getColumn().getValue(leftRow); Comparable rightColumnValue = sortableHeader.getColumn().getValue(rightRow); int comparison = (leftColumnValue == rightColumnValue) ? 0 : (leftColumnValue == null) ? -1 : (rightColumnValue == null) ? 1 : leftColumnValue.compareTo(rightColumnValue); if (comparison != 0) { switch (sortableHeader.getSortDirection()) { case ASCENDING: break; case DESCENDING: comparison = -comparison; break; default: throw new IllegalStateException("Sorting can only be enabled for ASCENDING or" + " DESCENDING, not sortDirection (" + sortableHeader.getSortDirection() + ") ."); } return comparison; } } return leftRow.compareTo(rightRow); } });
public int compare(T leftRow, T rightRow) { for (SortableHeader<T, ?> sortableHeader : sortOrderList) { Comparable leftColumnValue = sortableHeader.getColumn().getValue(leftRow); Comparable rightColumnValue = sortableHeader.getColumn().getValue(rightRow); int comparison = (leftColumnValue == rightColumnValue) ? 0 : (leftColumnValue == null) ? -1 : (rightColumnValue == null) ? 1 : leftColumnValue.compareTo(rightColumnValue); if (comparison != 0) { switch (sortableHeader.getSortDirection()) { case ASCENDING: break; case DESCENDING: comparison = -comparison; break; default: throw new IllegalStateException("Sorting can only be enabled for ASCENDING or" + " DESCENDING, not sortDirection (" + sortableHeader.getSortDirection() + ") ."); } return comparison; } } return leftRow.compareTo(rightRow); } });
/** * Handle a browser event that took place within the column. * * @param context the cell context * @param elem the parent Element * @param object the base object to be updated * @param event the native browser event */ public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) { final int index = context.getIndex(); ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : new ValueUpdater<C>() { @Override public void update(C value) { fieldUpdater.update(index, object, value); } }; cell.onBrowserEvent(context, elem, getValue(object), event, valueUpdater); }
public int compare(T leftRow, T rightRow) { for (SortableHeader<T, ?> sortableHeader : sortOrderList) { Comparable leftColumnValue = sortableHeader.getColumn().getValue(leftRow); Comparable rightColumnValue = sortableHeader.getColumn().getValue(rightRow); int comparison = (leftColumnValue == rightColumnValue) ? 0 : (leftColumnValue == null) ? -1 : (rightColumnValue == null) ? 1 : leftColumnValue.compareTo(rightColumnValue); if (comparison != 0) { switch (sortableHeader.getSortDirection()) { case ASCENDING: break; case DESCENDING: comparison = -comparison; break; default: throw new IllegalStateException("Sorting can only be enabled for ASCENDING or" + " DESCENDING, not sortDirection (" + sortableHeader.getSortDirection() + ") ."); } return comparison; } } return leftRow.compareTo(rightRow); } });
/** * Handle a browser event that took place within the column. * * @param context the cell context * @param elem the parent Element * @param object the base object to be updated * @param event the native browser event */ public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) { final int index = context.getIndex(); ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : new ValueUpdater<C>() { @Override public void update(C value) { fieldUpdater.update(index, object, value); } }; cell.onBrowserEvent(context, elem, getValue(object), event, valueUpdater); }
@Test public void variableNewValueComparatorTest() { ProcessVariableSummary processVariableSummary1 = new ProcessVariableSummary(); ProcessVariableSummary processVariableSummary2 = new ProcessVariableSummary(); ProcessVariableSummary processVariableSummary3 = new ProcessVariableSummary(); processVariableSummary1.setNewValue("A"); processVariableSummary2.setNewValue("B"); processVariableSummary3.setNewValue("A"); Comparator varNewValueComparator = variableHistoryPopup.getSortHandler().getComparator(testDataGrid.getColumn(COLUMN_NEW_VALUE_POSITION)); assertEquals(-1, varNewValueComparator.compare(processVariableSummary1, processVariableSummary2)); assertEquals(1, varNewValueComparator.compare(processVariableSummary2, processVariableSummary1)); assertEquals(0, varNewValueComparator.compare(processVariableSummary1, processVariableSummary3)); processVariableSummary1.setNewValue(null); processVariableSummary2.setNewValue("B"); assertEquals(-1, varNewValueComparator.compare(processVariableSummary1, processVariableSummary2)); assertEquals(1, varNewValueComparator.compare(processVariableSummary2, processVariableSummary1)); processVariableSummary3.setNewValue(null); assertEquals(0, varNewValueComparator.compare(processVariableSummary1, processVariableSummary3)); assertEquals("", testDataGrid.getColumn(COLUMN_NEW_VALUE_POSITION).getValue(processVariableSummary3)); assertEquals("B", testDataGrid.getColumn(COLUMN_NEW_VALUE_POSITION).getValue(processVariableSummary2)); }
@Test public void variableOldValueComparatorTest() { ProcessVariableSummary processVariableSummary1 = new ProcessVariableSummary(); ProcessVariableSummary processVariableSummary2 = new ProcessVariableSummary(); ProcessVariableSummary processVariableSummary3 = new ProcessVariableSummary(); processVariableSummary1.setOldValue("A"); processVariableSummary2.setOldValue("B"); processVariableSummary3.setOldValue("A"); Comparator varOldValueComparator = variableHistoryPopup.getSortHandler().getComparator(testDataGrid.getColumn(COLUMN_OLD_VALUE_POSITION)); assertEquals(-1, varOldValueComparator.compare(processVariableSummary1, processVariableSummary2)); assertEquals(1, varOldValueComparator.compare(processVariableSummary2, processVariableSummary1)); assertEquals(0, varOldValueComparator.compare(processVariableSummary1, processVariableSummary3)); processVariableSummary1.setOldValue(null); processVariableSummary2.setOldValue("B"); assertEquals(-1, varOldValueComparator.compare(processVariableSummary1, processVariableSummary2)); assertEquals(1, varOldValueComparator.compare(processVariableSummary2, processVariableSummary1)); processVariableSummary3.setOldValue(null); assertEquals(0, varOldValueComparator.compare(processVariableSummary1, processVariableSummary3)); assertEquals("", testDataGrid.getColumn(COLUMN_OLD_VALUE_POSITION).getValue(processVariableSummary3)); assertEquals("B", testDataGrid.getColumn(COLUMN_OLD_VALUE_POSITION).getValue(processVariableSummary2)); }