Skip to content

Instantly share code, notes, and snippets.

View fastnsilver's full-sized avatar

Chris Phillipson fastnsilver

View GitHub Profile
@fastnsilver
fastnsilver / AbstractValidatatableColumn
Created June 1, 2012 05:27
Custom GWT Column extension that offers JSR-303 client-side support for validating cell value within a column (incl. error message pop-up panel)
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import com.google.gwt.user.cellview.client.AbstractHasData;
import com.google.gwt.user.cellview.client.Column;
/**
@fastnsilver
fastnsilver / EnergyOffer.addPriceMwColumn
Created June 1, 2012 05:08
Revised method impl for EnergyOfferGrid that composes a number of AbstractValidatableColumns into a CompositeValidatableColumn
protected void addPriceMwColumn(final int colIndex, DisplayMode currentDisplayMode) {
// Construct a composite cell for energy offers that includes a pair of text inputs
final List<HasCell<EnergyOfferDTO, String>> columns = new ArrayList<
HasCell<EnergyOfferDTO, String>>();
// this DTO is passed along so that price and mw values for new entries are kept together
final OfferPriceMwPair newOfferPriceMwPair = new OfferPriceMwPair();
// Price
@fastnsilver
fastnsilver / WrapperCell
Created June 1, 2012 05:04
WrapperCell is a "knock-off" of GWT's CompositeCell. Provides access to inner cells. Used by CompositeValidatableColumn.
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.cell.client.FieldUpdater;
import com.google.gwt.cell.client.HasCell;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.dom.client.Element;
@fastnsilver
fastnsilver / CompositeValidatableColumn
Created June 1, 2012 05:02
Snippet of GWT client code attempting to "wrap" a number of ValidatableInputCell invoking onBrowserEvent for each
public class CompositeValidatableColumn<T> extends IdentityColumn<T> {
public CompositeValidatableColumn(WrapperCell<T> cell) {
super(cell);
}
@Override
public WrapperCell<T> getCell() {
return (WrapperCell<T>) super.getCell();
}