⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 totalwrappertemplate.java

📁 一个完整的表格展示数据查询的工具,可以直接在eclipse中编辑使用.
💻 JAVA
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-6-14 13:30:36
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   TotalWrapperTemplate.java

package org.displaytag.sample.decorators;

import java.util.List;
import org.apache.commons.lang.ObjectUtils;
import org.displaytag.decorator.TableDecorator;
import org.displaytag.sample.ReportableListObject;

public abstract class TotalWrapperTemplate extends TableDecorator
{

    public TotalWrapperTemplate()
    {
    }

    public final String finishRow()
    {
        int listindex = ((List)getDecoratedObject()).indexOf(getCurrentRowObject());
        ReportableListObject reportableObject = (ReportableListObject)getCurrentRowObject();
        String nextCity = null;
        cityTotal += reportableObject.getAmount();
        grandTotal += reportableObject.getAmount();
        if(listindex != ((List)getDecoratedObject()).size() - 1)
            nextCity = ((ReportableListObject)((List)getDecoratedObject()).get(listindex + 1)).getCity();
        buffer = new StringBuffer(1000);
        if(!ObjectUtils.equals(nextCity, reportableObject.getCity()))
        {
            writeCityTotal(reportableObject.getCity(), cityTotal);
            cityTotal = 0.0D;
        }
        if(getViewIndex() == ((List)getDecoratedObject()).size() - 1)
            writeGrandTotal(grandTotal);
        return buffer.toString();
    }

    protected abstract void writeCityTotal(String s, double d);

    protected abstract void writeGrandTotal(double d);

    protected StringBuffer getStringBuffer()
    {
        return buffer;
    }

    private double grandTotal;
    private double cityTotal;
    private StringBuffer buffer;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -