PDA

View Full Version : Summary Row in GroupSummaryView looks like common row



kirikol
11 Mar 2011, 1:54 AM
Hi, everybody!

Summary Row in GroupSummaryView looks like common row (no bold font, no background). What am I doing wrong?



public Grid<BeanModel> buildGrid() {
GroupingStore<BeanModel> store = buildFakeStore();
store.groupBy("docName");
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

SummaryRenderer nameSamaryRenderer = new SummaryRenderer() {
@Override
public String render(Number value, Map<String, Number> data) {

String s = new String();
if (value.intValue() == 1) {
s = "(" + value.intValue() + " позиция)";
}
else if (value.intValue() < 5) {
s = "(" + value.intValue() + " позиции)";
}
else {
s = "(" + value.intValue() + " позиций)";
}
return s;
}
};

SummaryRenderer costSummaryRenderer = new SummaryRenderer() {
@Override
public String render(Number value, Map<String, Number> data) {
return NumberFormat.getFormat(Currency.FORMAT).format(value);
}
};

SummaryColumnConfig<Double> docName = new SummaryColumnConfig<Double>("docName", "Специалист", 120);
configs.add(docName);

SummaryColumnConfig<Double> num = new SummaryColumnConfig<Double>("num", "Код", 60);
num.setFixed(true);
num.setAlignment(HorizontalAlignment.RIGHT);
configs.add(num);

SummaryColumnConfig<Integer> name = new SummaryColumnConfig<Integer>();
name.setId("name");
name.setHeader("Наименование услуги");
name.setSummaryType(SummaryType.COUNT);
name.setSummaryRenderer(nameSamaryRenderer);
name.setAlignment(HorizontalAlignment.LEFT);
configs.add(name);

SummaryColumnConfig<Double> formula = new SummaryColumnConfig<Double>("formula", "Формула", 100);
formula.setFixed(true);
configs.add(formula);
formula.setAlignment(HorizontalAlignment.CENTER);

SummaryColumnConfig<Double> amount = new SummaryColumnConfig<Double>("amount", "Кол-во", 60);
amount.setFixed(true);
configs.add(amount);
amount.setAlignment(HorizontalAlignment.RIGHT);

SummaryColumnConfig<Double> rate = new SummaryColumnConfig<Double>("rate", "Цена", 80);
rate.setFixed(true);
rate.setNumberFormat(NumberFormat.getFormat(Currency.FORMAT));
rate.setAlignment(HorizontalAlignment.RIGHT);
configs.add(rate);

SummaryColumnConfig<Double> rateWithBonus = new SummaryColumnConfig<Double>("rateWithBonus", "Со скидкой", 80);
rateWithBonus.setFixed(true);
rateWithBonus.setNumberFormat(NumberFormat.getFormat(Currency.FORMAT));
configs.add(rateWithBonus);
rateWithBonus.setAlignment(HorizontalAlignment.RIGHT);

SummaryColumnConfig<Double> cost = new SummaryColumnConfig<Double>("cost", "К оплате", 80);
cost.setFixed(true);
cost.setSummaryType(SummaryType.SUM);
cost.setSummaryRenderer(costSummaryRenderer);
cost.setNumberFormat(NumberFormat.getFormat(Currency.FORMAT));
configs.add(cost);
cost.setAlignment(HorizontalAlignment.RIGHT);

ColumnModel cm = new ColumnModel(configs);

Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);

GroupSummaryView summary = new GroupSummaryView();
summary.setForceFit(true);
summary.setEnableGroupingMenu(false);
summary.setSortingEnabled(false);
summary.setShowGroupedColumn(false);
grid.setView(summary);
grid.getView().setShowDirtyCells(false);

return grid;
}

kirikol
22 Mar 2011, 4:22 AM
Can anyone help?