Example usage for com.google.gwt.user.cellview.client Column Column

List of usage examples for com.google.gwt.user.cellview.client Column Column

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client Column Column.

Prototype

public Column(Cell<C> cell) 

Source Link

Document

Construct a new Column with a given Cell .

Usage

From source file:net.cbtltd.client.form.ProductForm.java

private ScrollPanel createAudit() {
    ScrollPanel panel = new ScrollPanel();

    //-----------------------------------------------
    // Selection model
    //-----------------------------------------------
    final NoSelectionModel<Audit> selectionModel = new NoSelectionModel<Audit>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            AuditPopup.getInstance().show(selectionModel.getLastSelectedObject(), auditTable);
        }/*from w ww.  j a v a2 s  .c om*/
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    auditTable = new TableField<Audit>(this, null, new AuditTable(), selectionModel, AUDIT_ROWS, tab++);

    auditTable.setEmptyValue(audittableEmpty());
    //TODO:auditTable.setOrderby(Audit.DATE + HasTable.ORDER_BY_DESC);

    auditTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return productField.noValue();
        }
    });

    auditTable.setTableExecutor(new TableExecutor<AuditTable>() {
        @Override
        public void execute(AuditTable action) {
            action.setProductid(productField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    final Column<Audit, Audit> changeButton = new Column<Audit, Audit>(
            new ActionCell<Audit>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Audit>() {
                        public void execute(Audit audit) {
                            AuditPopup.getInstance().show(audit, auditTable);
                        }
                    })) {
        public Audit getValue(Audit audit) {
            return audit;
        }
    };

    //-----------------------------------------------
    // Create button
    //-----------------------------------------------
    final ActionHeader<Audit> createButton = new ActionHeader<Audit>(
            new ActionCell<Audit>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Audit>() {
                        public void execute(Audit audit) {
                            if (productField.noValue()) {
                                AbstractField.addMessage(Level.TERSE, CONSTANTS.productError(), productField);
                            } else {
                                AuditPopup.getInstance().show(productField.getValue(), auditTable);
                            }
                        }
                    })) {
        public Audit getValue(Audit audit) {
            return audit;
        }
    };

    auditTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // Audit Date column
    //-----------------------------------------------
    Column<Audit, Date> eventdate = new Column<Audit, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Audit price) {
            return Time.getDateClient(price.getDate());
        }
    };
    auditTable.addDateColumn(eventdate, CONSTANTS.audittableHeaders()[col++], Audit.DATE);

    //-----------------------------------------------
    // Audit Name column
    //-----------------------------------------------
    Column<Audit, String> name = new Column<Audit, String>(new TextCell()) {
        @Override
        public String getValue(Audit audit) {
            return audit.getName();
        }
    };
    auditTable.addStringColumn(name, CONSTANTS.audittableHeaders()[col++], Audit.NAME);

    //-----------------------------------------------
    // Value column
    //-----------------------------------------------
    Column<Audit, Integer> rating = new Column<Audit, Integer>(
            new ImageCell<Integer>(AbstractField.STARS, CSS.ratingStyle())) {
        @Override
        public Integer getValue(Audit audit) {
            return audit.getRating() + 1;
        }
    };
    auditTable.addColumn(rating, CONSTANTS.audittableHeaders()[col++], Audit.RATING);

    //-----------------------------------------------
    // Notes column
    //-----------------------------------------------
    Column<Audit, String> description = new Column<Audit, String>(new TextCell()) {
        @Override
        public String getValue(Audit audit) {
            return audit.getNotes(100);
        }
    };
    auditTable.addStringColumn(description, CONSTANTS.audittableHeaders()[col++], Audit.NOTES);

    panel.add(auditTable);
    return panel;
}

From source file:net.cbtltd.client.form.ProductForm.java

private TableField<Product> createProduct() {
    //-----------------------------------------------
    // Selection model
    //-----------------------------------------------
    final NoSelectionModel<Product> selectionModel = new NoSelectionModel<Product>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            //TODO: load component into product form PricePopup.getInstance().show(selectionModel.getLastSelectedObject(), priceTable);
        }/*from  w ww  . j  a  v a2 s. com*/
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Product table
    //-----------------------------------------------
    productTable = new TableField<Product>(this, null, new ProductTable(), PRODUCT_ROWS, tab++);

    productTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (productField.noValue() || AbstractRoot.noOrganizationid());
        }
    });

    productTable.setTableExecutor(new TableExecutor<ProductTable>() {
        public void execute(ProductTable action) {
            action.setOrganizationid(AbstractRoot.getOrganizationid());
            action.setId(productField.getValue());
        }
    });

    productTable.setFieldStyle(CSS.productTable());

    int col = 0;

    //-----------------------------------------------
    // Name column
    //-----------------------------------------------
    Column<Product, String> name = new Column<Product, String>(new TextCell()) {
        @Override
        public String getValue(Product product) {
            return product.getName();
        }
    };
    productTable.addStringColumn(name, CONSTANTS.producttableHeaders()[col++]);

    //-----------------------------------------------
    // Type column
    //-----------------------------------------------
    Column<Product, String> category = new Column<Product, String>(new TextCell()) {
        @Override
        public String getValue(Product product) {
            return product.getCode();
        }
    };
    productTable.addStringColumn(category, CONSTANTS.producttableHeaders()[col++]);

    //-----------------------------------------------
    // State column
    //-----------------------------------------------
    Column<Product, String> state = new Column<Product, String>(new TextCell()) {
        @Override
        public String getValue(Product product) {
            return product.getState();
        }
    };
    productTable.addStringColumn(state, CONSTANTS.producttableHeaders()[col++]);

    //-----------------------------------------------
    // Bedroom column
    //-----------------------------------------------
    Column<Product, Number> room = new Column<Product, Number>(new NumberCell(AbstractField.QF)) {
        @Override
        public Integer getValue(Product product) {
            return product.getRoom();
        }
    };
    productTable.addNumberColumn(room, CONSTANTS.producttableHeaders()[col++]);

    //-----------------------------------------------
    // Person column
    //-----------------------------------------------
    Column<Product, Number> person = new Column<Product, Number>(new NumberCell(AbstractField.QF)) {
        @Override
        public Integer getValue(Product product) {
            return product.getPerson();
        }
    };
    productTable.addNumberColumn(person, CONSTANTS.producttableHeaders()[col++]);

    return productTable;
}

From source file:net.cbtltd.client.form.ProductForm.java

private ScrollPanel createPrice() {
    ScrollPanel panel = new ScrollPanel();
    //-----------------------------------------------
    // Selection model
    //-----------------------------------------------
    final NoSelectionModel<Price> selectionModel = new NoSelectionModel<Price>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            PricePopup.getInstance().show(selectionModel.getLastSelectedObject(), priceTable);
        }/*from w w  w . j  a v a2  s.  com*/
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Price table
    //-----------------------------------------------
    priceTable = new TableField<Price>(this, null, new PriceTable(), PRICE_ROWS, tab++);

    priceTable.setEmptyValue(pricetableEmpty());
    priceTable.setOrderby(Price.DATE);

    priceTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (productField.noValue() || AbstractRoot.noOrganizationid());
        }
    });

    priceTable.setTableExecutor(new TableExecutor<PriceTable>() {
        public void execute(PriceTable action) {
            action.setPartyid(AbstractRoot.getOrganizationid());
            action.setEntitytype(NameId.Type.Product.name());
            action.setEntityid(productField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    final Column<Price, Price> changeButton = new Column<Price, Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            PricePopup.getInstance().show(price, priceTable);
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    //-----------------------------------------------
    // Create button
    //-----------------------------------------------
    final ActionHeader<Price> createButton = new ActionHeader<Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            if (productField.noValue()) {
                                AbstractField.addMessage(Level.TERSE, CONSTANTS.productError(), productField);
                            } else {
                                PricePopup.getInstance().show(productField.getValue(), quantityField.getValue(),
                                        priceTable);
                            }
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    priceTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // From Date column
    //-----------------------------------------------
    Column<Price, Date> date = new Column<Price, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Price price) {
            return Time.getDateClient(price.getDate());
        }
    };
    priceTable.addDateColumn(date, CONSTANTS.pricetableHeaders()[col++], Price.DATE);

    //-----------------------------------------------
    // To Date column
    //-----------------------------------------------
    Column<Price, Date> todate = new Column<Price, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Price price) {
            return Time.getDateClient(price.getTodate());
        }
    };
    priceTable.addDateColumn(todate, CONSTANTS.pricetableHeaders()[col++], Price.TODATE);

    //-----------------------------------------------
    // Description column
    //-----------------------------------------------
    Column<Price, String> name = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getName();
        }
    };
    priceTable.addStringColumn(name, CONSTANTS.pricetableHeaders()[col++]);

    //-----------------------------------------------
    // Available column
    //-----------------------------------------------
    Column<Price, Number> available = new Column<Price, Number>(new NumberCell(AbstractField.IF)) {
        @Override
        public Integer getValue(Price price) {
            return price.getAvailable();
        }
    };
    priceTable.addNumberColumn(available, CONSTANTS.pricetableHeaders()[col++], Price.AVAILABLE);

    //      //-----------------------------------------------
    //      // Quantity column
    //      //-----------------------------------------------
    //      Column<Price, Number> quantity = new Column<Price, Number>(new NumberCell(AbstractField.IF)) {
    //         @Override
    //         public Double getValue( Price price ) {return price.getQuantity();}
    //      };
    //      priceTable.addNumberColumn( quantity, CONSTANTS.pricetableHeaders()[col++], Price.QUANTITY);
    //
    //      //-----------------------------------------------
    //      // Unit column
    //      //-----------------------------------------------
    //      Column<Price, String> unit = new Column<Price, String>(new TextCell()) {
    //         @Override
    //         public String getValue( Price price ) {return getUnitName(price.getUnit());}
    //      };
    //      priceTable.addStringColumn(unit, CONSTANTS.pricetableHeaders()[col++]);

    //-----------------------------------------------
    // Price column
    //-----------------------------------------------
    Column<Price, Number> price = new Column<Price, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Price price) {
            return price.getValue();
        }
    };
    priceTable.addNumberColumn(price, CONSTANTS.pricetableHeaders()[col++], Price.VALUE);

    //-----------------------------------------------
    // Minimum Price column
    //-----------------------------------------------
    Column<Price, Number> minimum = new Column<Price, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Price price) {
            return price.getMinimum();
        }
    };
    priceTable.addNumberColumn(minimum, CONSTANTS.pricetableHeaders()[col++], Price.VALUE);

    //-----------------------------------------------
    // Currency column
    //-----------------------------------------------
    Column<Price, String> currency = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getCurrency();
        }
    };
    priceTable.addStringColumn(currency, CONSTANTS.pricetableHeaders()[col++]);

    //-----------------------------------------------
    // Rule column
    //-----------------------------------------------
    Column<Price, String> rule = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return getRuleName(price.getRule());
        }
    };
    priceTable.addStringColumn(rule, CONSTANTS.pricetableHeaders()[col++]);

    panel.add(priceTable);
    return panel;
}

From source file:net.cbtltd.client.form.ProductForm.java

private ScrollPanel createTax() {
    final ScrollPanel panel = new ScrollPanel();
    //-----------------------------------------------
    // Selection model
    //-----------------------------------------------
    final NoSelectionModel<Tax> selectionModel = new NoSelectionModel<Tax>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            TaxPopup.getInstance().show(NameId.Type.Product.name(), productField.getValue(),
                    selectionModel.getLastSelectedObject(), taxTable);
        }/*from ww w.j ava2  s. com*/
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Tax table
    //-----------------------------------------------
    taxTable = new TableField<Tax>(this, null, new TaxTable(), TAX_ROWS, tab++);

    taxTable.setEmptyValue(taxtableEmpty());
    taxTable.setOrderby(Tax.DATE);

    taxTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (productField.noValue());
        }
    });

    taxTable.setTableExecutor(new TableExecutor<TaxTable>() {
        public void execute(TaxTable action) {
            action.setEntitytype(NameId.Type.Product.name());
            action.setEntityid(productField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    final Column<Tax, Tax> changeButton = new Column<Tax, Tax>(
            new ActionCell<Tax>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Tax>() {
                        public void execute(Tax tax) {
                            TaxPopup.getInstance().show(NameId.Type.Product.name(), productField.getValue(),
                                    tax, taxTable);
                        }
                    })) {
        public Tax getValue(Tax tax) {
            return tax;
        }
    };

    //-----------------------------------------------
    // Create button
    //-----------------------------------------------
    final ActionHeader<Tax> createButton = new ActionHeader<Tax>(
            new ActionCell<Tax>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Tax>() {
                        public void execute(Tax price) {
                            if (productField.noValue()) {
                                AbstractField.addMessage(Level.TERSE, CONSTANTS.productError(), productField);
                            } else {
                                TaxPopup.getInstance().show(NameId.Type.Product.name(), productField.getValue(),
                                        taxTable);
                            }
                        }
                    })) {
        public Tax getValue(Tax tax) {
            return tax;
        }
    };

    taxTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // Jurisdiction column
    //-----------------------------------------------
    Column<Tax, String> party = new Column<Tax, String>(new TextCell()) {
        @Override
        public String getValue(Tax tax) {
            return tax.getPartyname();
        }
    };
    taxTable.addStringColumn(party, CONSTANTS.taxtableHeaders()[col++]);

    //-----------------------------------------------
    // Name column
    //-----------------------------------------------
    Column<Tax, String> name = new Column<Tax, String>(new TextCell()) {
        @Override
        public String getValue(Tax tax) {
            return tax.getName();
        }
    };
    taxTable.addStringColumn(name, CONSTANTS.taxtableHeaders()[col++]);

    //-----------------------------------------------
    // Type column
    //-----------------------------------------------
    Column<Tax, String> type = new Column<Tax, String>(new TextCell()) {
        @Override
        public String getValue(Tax tax) {
            return tax.getType();
        }
    };
    taxTable.addStringColumn(type, CONSTANTS.taxtableHeaders()[col++]);

    //-----------------------------------------------
    // From Date column
    //-----------------------------------------------
    Column<Tax, Date> date = new Column<Tax, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Tax tax) {
            return Time.getDateClient(tax.getDate());
        }
    };
    taxTable.addDateColumn(date, CONSTANTS.taxtableHeaders()[col++], Tax.DATE);

    //-----------------------------------------------
    // Amount column
    //-----------------------------------------------
    Column<Tax, Number> amount = new Column<Tax, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Tax tax) {
            return tax.getAmount();
        }
    };
    taxTable.addNumberColumn(amount, CONSTANTS.taxtableHeaders()[col++], Tax.AMOUNT);

    //-----------------------------------------------
    // Threshold column
    //-----------------------------------------------
    //      Column<Tax, Number> threshold = new Column<Tax, Number>(new NumberCell(AbstractField.AF)) {
    //         @Override
    //         public Integer getValue( Tax tax ) {return tax.getThreshold();}
    //      };
    //      taxTable.addNumberColumn( threshold, CONSTANTS.taxtableHeaders()[col++], Tax.THRESHOLD);

    //-----------------------------------------------
    // Notes column
    //-----------------------------------------------
    Column<Tax, String> notes = new Column<Tax, String>(new TextCell()) {
        @Override
        public String getValue(Tax tax) {
            return tax.getNotes();
        }
    };
    taxTable.addStringColumn(notes, CONSTANTS.taxtableHeaders()[col++]);

    panel.add(taxTable);
    return panel;
}

From source file:net.cbtltd.client.form.ProductForm.java

private ScrollPanel createYield() {
    ScrollPanel panel = new ScrollPanel();
    //-----------------------------------------------
    // Yield Selection model
    //-----------------------------------------------
    final NoSelectionModel<Yield> selectionModel = new NoSelectionModel<Yield>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            YieldPopup.getInstance().show(selectionModel.getLastSelectedObject(), yieldTable);
        }/*w w w .ja  v  a 2  s . co m*/
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Yield table
    //-----------------------------------------------
    yieldTable = new TableField<Yield>(this, null, new YieldTable(), YIELD_ROWS, tab++);

    yieldTable.setEmptyValue(yieldtableEmpty());
    yieldTable.setOrderby(Yield.NAME);

    yieldTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (productField.noValue() || AbstractRoot.noOrganizationid());
        }
    });

    yieldTable.setTableExecutor(new TableExecutor<YieldTable>() {
        public void execute(YieldTable action) {
            action.setEntitytype(NameId.Type.Product.name());
            action.setEntityid(productField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Edit Yield button
    //-----------------------------------------------
    Column<Yield, Yield> changeButton = new Column<Yield, Yield>(
            new ActionCell<Yield>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Yield>() {
                        public void execute(Yield yield) {
                            YieldPopup.getInstance().show(yield, yieldTable);
                        }
                    })) {
        public Yield getValue(Yield yield) {
            return yield;
        }
    };

    ActionHeader<Yield> createButtton = new ActionHeader<Yield>(
            new ActionCell<Yield>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Yield>() {
                        public void execute(Yield yield) {
                            if (productField.noValue()) {
                                AbstractField.addMessage(Level.TERSE, CONSTANTS.productError(), productField);
                            } else {
                                YieldPopup.getInstance().show(productField.getValue(), yieldTable);
                            }
                        }
                    })) {
        public Yield getValue(Yield price) {
            return price;
        }
    };

    yieldTable.addColumn(changeButton, createButtton);

    //-----------------------------------------------
    // Rule column
    //-----------------------------------------------
    Column<Yield, String> rule = new Column<Yield, String>(new TextCell()) {
        @Override
        public String getValue(Yield yield) {
            return getRule(yield);
        }
    };
    yieldTable.addStringColumn(rule, CONSTANTS.yieldtableHeaders()[col++], Yield.NAME);

    //-----------------------------------------------
    // Modifier column
    //-----------------------------------------------
    Column<Yield, String> modifier = new Column<Yield, String>(new TextCell()) {
        @Override
        public String getValue(Yield yield) {
            return yield.getModifier();
        }
    };
    yieldTable.addStringColumn(modifier, CONSTANTS.yieldtableHeaders()[col++], Yield.MODIFIER);

    //-----------------------------------------------
    // Amount column
    //-----------------------------------------------
    Column<Yield, Number> amount = new Column<Yield, Number>(new NumberCell(AbstractField.QF)) {
        @Override
        public Double getValue(Yield yield) {
            return yield.getAmount();
        }
    };
    yieldTable.addNumberColumn(amount, CONSTANTS.yieldtableHeaders()[col++], Yield.AMOUNT);

    //-----------------------------------------------
    // From Date column
    //-----------------------------------------------
    Column<Yield, Date> fromdate = new Column<Yield, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Yield yield) {
            return Time.getDateClient(yield.getFromdate());
        }
    };
    yieldTable.addDateColumn(fromdate, CONSTANTS.yieldtableHeaders()[col++], Yield.FROMDATE);

    //-----------------------------------------------
    // To Date column
    //-----------------------------------------------
    Column<Yield, Date> todate = new Column<Yield, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Yield yield) {
            return Time.getDateClient(yield.getTodate());
        }
    };
    yieldTable.addDateColumn(todate, CONSTANTS.yieldtableHeaders()[col++], Yield.TODATE);

    panel.add(yieldTable);
    return panel;
}

From source file:net.cbtltd.client.form.ProductForm.java

private ScrollPanel createFeature() {
    final ScrollPanel panel = new ScrollPanel();

    featureTable = new TableField<Price>(this, null, new ProductFeatureTable(), FEATURE_ROWS, tab++);

    featureTable.setEmptyValue(featuretableEmpty());
    featureTable.setOrderby(Price.DATE);
    //featurepriceTable.addStyleName(CSS.actorStyle());

    featureTable.setTableError(new TableError() {
        @Override// w w w. ja  v  a 2s  .  co m
        public boolean error() {
            return productField.noValue();
        }
    });

    featureTable.setTableExecutor(new TableExecutor<ProductFeatureTable>() {
        @Override
        public void execute(ProductFeatureTable action) {
            action.setEntityid(productField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    final Column<Price, Price> changeButton = new Column<Price, Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            FeaturePopup.getInstance().show(price, featureTable);
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    //-----------------------------------------------
    // Create button
    //-----------------------------------------------
    final ActionHeader<Price> createButton = new ActionHeader<Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            if (productField.noValue()) {
                                AbstractField.addMessage(Level.TERSE, CONSTANTS.productError(), productField);
                            } else {
                                FeaturePopup.getInstance().show(productField.getValue(), featureTable);
                            }
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    featureTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // Feature Name column
    //-----------------------------------------------
    Column<Price, String> name = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getName();
        }
    };
    featureTable.addStringColumn(name, CONSTANTS.featuretableHeaders()[col++], Price.ENTITYNAME);

    //-----------------------------------------------
    // Feature Type column
    //-----------------------------------------------
    Column<Price, String> type = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getType();
        }
    };
    featureTable.addStringColumn(type, CONSTANTS.featuretableHeaders()[col++], Price.ENTITYNAME);

    //-----------------------------------------------
    // From Date column
    //-----------------------------------------------
    Column<Price, Date> date = new Column<Price, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Price price) {
            return Time.getDateClient(price.getDate());
        }
    };
    featureTable.addDateColumn(date, CONSTANTS.featuretableHeaders()[col++], Price.DATE);

    //-----------------------------------------------
    // To Date column
    //-----------------------------------------------
    Column<Price, Date> todate = new Column<Price, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Price price) {
            return Time.getDateClient(price.getTodate());
        }
    };
    featureTable.addDateColumn(todate, CONSTANTS.featuretableHeaders()[col++], Price.TODATE);

    //-----------------------------------------------
    // Price column
    //-----------------------------------------------
    Column<Price, Number> price = new Column<Price, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Price price) {
            return price.getValue();
        }
    };
    featureTable.addNumberColumn(price, CONSTANTS.featuretableHeaders()[col++], Price.VALUE);

    //-----------------------------------------------
    // Cost column
    //-----------------------------------------------
    //      Column<Price, Number> cost = new Column<Price, Number>(new NumberCell(AbstractField.AF)) {
    //         @Override
    //         public Double getValue( Price price ) {return price.getCost();}
    //      };
    //      featureTable.addNumberColumn( cost, CONSTANTS.featuretableHeaders()[col++], Price.COST);

    //-----------------------------------------------
    // Currency column
    //-----------------------------------------------
    Column<Price, String> currency = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getCurrency();
        }
    };
    featureTable.addStringColumn(currency, CONSTANTS.featuretableHeaders()[col++]);

    //-----------------------------------------------
    // Entity Type column
    //-----------------------------------------------
    Column<Price, String> mandatory = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getEntitytype();
        }
    };
    featureTable.addStringColumn(mandatory, CONSTANTS.featuretableHeaders()[col++]);

    panel.add(featureTable);
    return panel;
}

From source file:net.cbtltd.client.form.ProductForm.java

private TableField<Price> createServiceprice() {
    //-----------------------------------------------
    // Selection model
    //-----------------------------------------------
    final NoSelectionModel<Price> selectionModel = new NoSelectionModel<Price>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            ServicepricePopup.getInstance().show(selectionModel.getLastSelectedObject(), servicepriceTable);
        }/*from  ww w. j  a  va 2 s .c  om*/
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Service Price table
    //-----------------------------------------------
    servicepriceTable = new TableField<Price>(this, null, new ServicePriceTable(),
            CONSTANTS.servicepriceLabel(), SERVICEPRICE_ROWS, tab++);

    servicepriceTable.setEmptyStyle(CSS.servicepriceEmpty());
    servicepriceTable.setEmptyValue(servicepricetableEmpty());
    servicepriceTable.setOrderby(Price.DATE);
    servicepriceTable.setLabelStyle(CSS.servicepriceLabel());

    servicepriceTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (productField.noValue());
        }
    });

    servicepriceTable.setTableExecutor(new TableExecutor<ServicePriceTable>() {
        public void execute(ServicePriceTable action) {
            action.setEntitytype(NameId.Type.Product.name());
            action.setEntityid(productField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change Service Price button
    //-----------------------------------------------
    Column<Price, Price> changeButton = new Column<Price, Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            ServicepricePopup.getInstance().show(price, servicepriceTable);
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    //-----------------------------------------------
    // Create Service Price button
    //-----------------------------------------------
    ActionHeader<Price> createButton = new ActionHeader<Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            if (productField.noValue()) {
                                AbstractField.addMessage(Level.TERSE, CONSTANTS.productError(), productField);
                            } else {
                                ServicepricePopup.getInstance().show(productField.getValue(),
                                        servicepriceTable);
                            }
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    servicepriceTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // Procedure Name column
    //-----------------------------------------------
    Column<Price, String> name = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getName();
        }
    };
    servicepriceTable.addStringColumn(name, CONSTANTS.servicepricetableHeaders()[col++]);

    //-----------------------------------------------
    // From Date column
    //-----------------------------------------------
    Column<Price, Date> date = new Column<Price, Date>(new DateCell(AbstractRoot.getSDF())) {
        @Override
        public Date getValue(Price price) {
            return Time.getDateClient(price.getDate());
        }
    };
    servicepriceTable.addDateColumn(date, CONSTANTS.servicepricetableHeaders()[col++], Price.DATE);

    //-----------------------------------------------
    // To Date column
    //-----------------------------------------------
    Column<Price, Date> todate = new Column<Price, Date>(new DateCell(AbstractRoot.getSDF())) {
        @Override
        public Date getValue(Price price) {
            return Time.getDateClient(price.getTodate());
        }
    };
    servicepriceTable.addDateColumn(todate, CONSTANTS.servicepricetableHeaders()[col++], Price.TODATE);

    //-----------------------------------------------
    // Price column
    //-----------------------------------------------
    Column<Price, Number> price = new Column<Price, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Price price) {
            return price.getValue();
        }
    };
    servicepriceTable.addNumberColumn(price, CONSTANTS.servicepricetableHeaders()[col++], Price.VALUE);

    //-----------------------------------------------
    // Supplier column
    //-----------------------------------------------
    Column<Price, String> partyname = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getPartyname();
        }
    };
    servicepriceTable.addStringColumn(partyname, CONSTANTS.servicepricetableHeaders()[col++]);

    return servicepriceTable;
}

From source file:net.cbtltd.client.form.ReservationForm.java

private TableField<Price> createFeature() {

    featureTable = new TableField<Price>(this, null, null, //new QuoteDetailTable(),
            FEATURE_ROWS, tab++);/*  w  ww. j ava 2  s.c  om*/

    featureTable.setEmptyValue(featuretableEmpty());
    featureTable.setOrderby(Price.NAME);
    //featurepriceTable.addStyleName(CSS.actorStyle());

    featureTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return reservationField.noValue();
        }
    });

    //      featureTable.setTableExecutor(new TableExecutor<QuoteDetailTable>() {
    //         @Override
    //         public void execute(QuoteDetailTable action) {action.setEntityid(reservationField.getValue());}
    //      });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    final Column<Price, Price> changeButton = new Column<Price, Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            //AbstractField.addMessage(Level.ERROR, CONSTANTS.optionalError(), reservationField);
                            if (reservationField.noValue()) {
                                AbstractField.addMessage(Level.ERROR, CONSTANTS.reservationError(),
                                        reservationField);
                            } else {
                                QuotePopup.getInstance().show(price, quoteField, featureTable);
                            }
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    //-----------------------------------------------
    // Create button
    //-----------------------------------------------
    final ActionHeader<Price> createButton = new ActionHeader<Price>(
            new ActionCell<Price>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Price>() {
                        public void execute(Price price) {
                            if (reservationField.noValue()) {
                                AbstractField.addMessage(Level.ERROR, CONSTANTS.reservationError(),
                                        reservationField);
                            } else {
                                QuotePopup.getInstance().show(reservationField.getValue(),
                                        productField.getValue(), quoteField, featureTable);
                            }
                        }
                    })) {
        public Price getValue(Price price) {
            return price;
        }
    };

    featureTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // Feature Name column
    //-----------------------------------------------
    Column<Price, String> name = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getName();
        }
    };
    featureTable.addStringColumn(name, CONSTANTS.featuretableHeaders()[col++], Price.ENTITYNAME);

    //-----------------------------------------------
    // Feature Type column
    //-----------------------------------------------
    Column<Price, String> state = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getType();
        }
    };
    featureTable.addStringColumn(state, CONSTANTS.featuretableHeaders()[col++], Price.STATE);

    //-----------------------------------------------
    // Quantity column
    //-----------------------------------------------
    Column<Price, Number> quantity = new Column<Price, Number>(new NumberCell(AbstractField.IF)) {
        @Override
        public Double getValue(Price price) {
            return price.getQuantity();
        }
    };
    featureTable.addNumberColumn(quantity, CONSTANTS.featuretableHeaders()[col++], Price.QUANTITY);

    //-----------------------------------------------
    // Unit column
    //-----------------------------------------------
    Column<Price, String> unit = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getUnit();
        }
    };
    featureTable.addStringColumn(unit, CONSTANTS.featuretableHeaders()[col++], Price.UNIT);

    //-----------------------------------------------
    // Total Price column
    //-----------------------------------------------
    Column<Price, Number> price = new Column<Price, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Price price) {
            return price.getTotalvalue();
        }
    };
    featureTable.addNumberColumn(price, CONSTANTS.featuretableHeaders()[col++], Price.VALUE);

    //-----------------------------------------------
    // Currency column
    //-----------------------------------------------
    Column<Price, String> currency = new Column<Price, String>(new TextCell()) {
        @Override
        public String getValue(Price price) {
            return price.getCurrency();
        }
    };
    featureTable.addStringColumn(currency, CONSTANTS.featuretableHeaders()[col++]);

    //-----------------------------------------------
    // Supplier Name column
    //-----------------------------------------------
    //      Column<Price, String> bankname = new Column<Price, String>( new TextCell()) {
    //         @Override
    //         public String getValue( Price price ) {return price.getPartyname();}
    //      };
    //      featureTable.addStringColumn(bankname, CONSTANTS.featuretableHeaders()[col++]);

    return featureTable;
}

From source file:net.cbtltd.client.form.ReservationForm.java

private TableField<Task> createMaintenance() {

    //-----------------------------------------------
    // Maintenance selection handler
    //-----------------------------------------------
    final NoSelectionModel<Task> selectionModel = new NoSelectionModel<Task>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            TaskPopup.getInstance().show(selectionModel.getLastSelectedObject(), maintenanceTable);
        }//from   w  ww .j a  v a2  s  .  co m
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Maintenance table
    //-----------------------------------------------
    maintenanceTable = new TableField<Task>(this, null, new MaintenanceTaskTable(), selectionModel,
            MAINTENANCE_ROWS, tab++);

    maintenanceTable.setEmptyValue(maintenancetableEmpty());
    maintenanceTable.setOrderby(Task.DUEDATE);

    maintenanceTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (reservationField.noValue());
        }
    });

    maintenanceTable.setTableExecutor(new TableExecutor<MaintenanceTaskTable>() {
        public void execute(MaintenanceTaskTable action) {
            action.setId(reservationField.getValue());
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    final Column<Task, Task> changeButton = new Column<Task, Task>(
            new ActionCell<Task>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<Task>() {
                        public void execute(Task task) {
                            TaskPopup.getInstance().show(task, maintenanceTable);
                        }
                    })) {
        public Task getValue(Task task) {
            return task;
        }//TODO: selectForm(row); 
    };

    //-----------------------------------------------
    // Create button
    //-----------------------------------------------
    final ActionHeader<Task> createButton = new ActionHeader<Task>(
            new ActionCell<Task>(AbstractField.CONSTANTS.allCreate(),
                    AbstractField.CSS.cbtTableFieldCreateButton(), new Delegate<Task>() {
                        public void execute(Task task) {
                            if (reservationField.noValue()) {
                                AbstractField.addMessage(Level.ERROR, CONSTANTS.reservationError(),
                                        reservationField);
                            } else {
                                TaskPopup.getInstance().show(Task.Type.Maintenance, reservationentities,
                                        maintenanceTable);
                            }
                        }
                    })) {
        public Task getValue(Task task) {
            return task;
        }
    };

    maintenanceTable.addColumn(changeButton, createButton);

    //-----------------------------------------------
    // Due Date column
    //-----------------------------------------------
    Column<Task, Date> date = new Column<Task, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(Task task) {
            return Time.getDateClient(task.getDuedate());
        }
    };
    maintenanceTable.addDateColumn(date, CONSTANTS.maintenanceHeaders()[col++], Task.DUEDATE);

    //-----------------------------------------------
    // Name column
    //-----------------------------------------------
    Column<Task, String> name = new Column<Task, String>(new TextCell()) {
        @Override
        public String getValue(Task task) {
            return task.getName();
        }
    };
    maintenanceTable.addStringColumn(name, CONSTANTS.maintenanceHeaders()[col++], Task.NAME);

    //-----------------------------------------------
    // Actor column
    //-----------------------------------------------
    Column<Task, String> actorname = new Column<Task, String>(new TextCell()) {
        @Override
        public String getValue(Task task) {
            return task.getActorname();
        }
    };
    maintenanceTable.addStringColumn(actorname, CONSTANTS.maintenanceHeaders()[col++], Task.ACTORNAME);

    //-----------------------------------------------
    // State column
    //-----------------------------------------------
    Column<Task, String> state = new Column<Task, String>(new TextCell()) {
        @Override
        public String getValue(Task task) {
            return task.getState();
        }
    };
    maintenanceTable.addStringColumn(state, CONSTANTS.maintenanceHeaders()[col++], Task.STATE);

    //-----------------------------------------------
    // Amount column
    //-----------------------------------------------
    Column<Task, Number> amount = new Column<Task, Number>(new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(Task task) {
            return task.getAmount();
        }
    };
    maintenanceTable.addNumberColumn(amount, CONSTANTS.maintenanceHeaders()[col++], Task.AMOUNT);

    //-----------------------------------------------
    // Currency column
    //-----------------------------------------------
    Column<Task, String> currency = new Column<Task, String>(new TextCell()) {
        @Override
        public String getValue(Task task) {
            return task.getCurrency();
        }
    };
    maintenanceTable.addStringColumn(currency, CONSTANTS.maintenanceHeaders()[col++]);

    //-----------------------------------------------
    // Notes column
    //-----------------------------------------------
    Column<Task, String> notes = new Column<Task, String>(new TextCell()) {
        @Override
        public String getValue(Task task) {
            return task.getNotes();
        }
    };
    maintenanceTable.addStringColumn(notes, CONSTANTS.maintenanceHeaders()[col++], Task.NOTES);

    return maintenanceTable;
}

From source file:net.cbtltd.client.form.ReservationForm.java

private FlowPanel createFinancial() {

    final FlowPanel panel = new FlowPanel();
    panel.add(createFinancialcommands());

    //-----------------------------------------------
    // Financial Transaction selection handler
    //-----------------------------------------------
    final NoSelectionModel<EventJournal> selectionModel = new NoSelectionModel<EventJournal>();
    SelectionChangeEvent.Handler selectionHandler = new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            JournalPopup.getInstance().show(selectionModel.getLastSelectedObject(), reservationentities,
                    eventjournalTable);/*from  w w  w . j a v  a 2  s .com*/
        }
    };
    selectionModel.addSelectionChangeHandler(selectionHandler);

    //-----------------------------------------------
    // Financial Transaction table
    //-----------------------------------------------
    eventjournalTable = new TableField<EventJournal>(this, null, new ReservationEventJournalTable(),
            selectionModel, EVENTJOURNAL_ROWS, tab++);

    eventjournalTable.setEmptyValue(eventactiontableEmpty());

    eventjournalTable.setTableError(new TableError() {
        @Override
        public boolean error() {
            return (reservationField.noValue());
        }
    });

    eventjournalTable.setTableExecutor(new TableExecutor<ReservationEventJournalTable>() {
        public void execute(ReservationEventJournalTable action) {
            action.setId(reservationField.getValue());
            reservationBalance.execute(true);
        }
    });

    int col = 0;

    //-----------------------------------------------
    // Change button
    //-----------------------------------------------
    Column<EventJournal, EventJournal> changeButton = new Column<EventJournal, EventJournal>(
            new ActionCell<EventJournal>(AbstractField.CONSTANTS.allChange(),
                    AbstractField.CSS.cbtTableFieldChangeButton(), new Delegate<EventJournal>() {
                        public void execute(EventJournal eventaction) {
                            JournalPopup.getInstance().show(eventaction, reservationentities,
                                    eventjournalTable);
                        }
                    })) {
        public EventJournal getValue(EventJournal eventjournal) {
            return eventjournal;
        }//TODO: selectForm(row); 
    };

    eventjournalTable.addColumn(changeButton);

    //-----------------------------------------------
    // Process column
    //-----------------------------------------------
    Column<EventJournal, String> process = new Column<EventJournal, String>(new TextCell()) {
        @Override
        public String getValue(EventJournal eventjournal) {
            return eventjournal.getProcess();
        }
    };
    eventjournalTable.addStringColumn(process, CONSTANTS.eventjournalHeaders()[col++], EventJournal.PROCESS);

    //-----------------------------------------------
    // Entity column
    //-----------------------------------------------
    Column<EventJournal, String> entity = new Column<EventJournal, String>(new TextCell()) {
        @Override
        public String getValue(EventJournal eventjournal) {
            return eventjournal.getEntityname(15);
        }
    };
    eventjournalTable.addStringColumn(entity, CONSTANTS.eventjournalHeaders()[col++], EventJournal.STATE);

    //-----------------------------------------------
    // Name column
    //-----------------------------------------------
    Column<EventJournal, String> name = new Column<EventJournal, String>(new TextCell()) {
        @Override
        public String getValue(EventJournal eventjournal) {
            return eventjournal.getName();
        }
    };
    eventjournalTable.addStringColumn(name, CONSTANTS.eventjournalHeaders()[col++], EventJournal.NAME);

    //-----------------------------------------------
    // Date column
    //-----------------------------------------------
    Column<EventJournal, Date> date = new Column<EventJournal, Date>(new DateCell(AbstractRoot.getDF())) {
        @Override
        public Date getValue(EventJournal eventjournal) {
            return Time.getDateClient(eventjournal.getDate());
        }
    };
    eventjournalTable.addDateColumn(date, CONSTANTS.eventjournalHeaders()[col++], EventJournal.DATE);

    //-----------------------------------------------
    // Debit Amount column
    //-----------------------------------------------
    Column<EventJournal, Number> debitAmount = new Column<EventJournal, Number>(
            new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(EventJournal eventjournal) {
            return eventjournal.getDebitamount();
        }
    };
    eventjournalTable.addNumberColumn(debitAmount, CONSTANTS.eventjournalHeaders()[col++],
            EventJournal.DEBITAMOUNT);

    //-----------------------------------------------
    // Credit Amount column
    //-----------------------------------------------
    Column<EventJournal, Number> creditAmount = new Column<EventJournal, Number>(
            new NumberCell(AbstractField.AF)) {
        @Override
        public Double getValue(EventJournal eventjournal) {
            return eventjournal.getCreditamount();
        }
    };
    eventjournalTable.addNumberColumn(creditAmount, CONSTANTS.eventjournalHeaders()[col++],
            EventJournal.CREDITAMOUNT);

    //-----------------------------------------------
    // Currency column
    //-----------------------------------------------
    Column<EventJournal, String> currency = new Column<EventJournal, String>(new TextCell()) {
        @Override
        public String getValue(EventJournal eventjournal) {
            return eventjournal.getCurrency();
        }
    };
    eventjournalTable.addStringColumn(currency, CONSTANTS.eventjournalHeaders()[col++], EventJournal.UNIT);

    //-----------------------------------------------
    // Description column
    //-----------------------------------------------
    Column<EventJournal, String> description = new Column<EventJournal, String>(new TextCell()) {
        @Override
        public String getValue(EventJournal eventjournal) {
            return eventjournal.getDescription();
        }
    };
    eventjournalTable.addStringColumn(description, CONSTANTS.eventjournalHeaders()[col++],
            EventJournal.DESCRIPTION);
    eventjournalTable.addStyleName(CSS.eventactionStyle());

    final ScrollPanel scroll = new ScrollPanel();
    scroll.addStyleName(CSS.scrollStyle());
    scroll.add(eventjournalTable); //TODO:
    panel.add(scroll);
    return panel;
}