wrapper.java

来自「一个完整的表格展示数据查询的工具,可以直接在eclipse中编辑使用.」· Java 代码 · 共 53 行

JAVA
53
字号
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-6-14 13:30:40
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Wrapper.java

package org.displaytag.sample.decorators;

import java.text.DecimalFormat;
import org.apache.commons.lang.time.FastDateFormat;
import org.displaytag.decorator.TableDecorator;
import org.displaytag.sample.ListObject;

public class Wrapper extends TableDecorator
{

    public Wrapper()
    {
        dateFormat = FastDateFormat.getInstance("MM/dd/yy");
        moneyFormat = new DecimalFormat("$ #,###,###.00");
    }

    public String getNullValue()
    {
        return null;
    }

    public String getDate()
    {
        return dateFormat.format(((ListObject)getCurrentRowObject()).getDate());
    }

    public String getMoney()
    {
        return moneyFormat.format(((ListObject)getCurrentRowObject()).getMoney());
    }

    public String getLink1()
    {
        ListObject object = (ListObject)getCurrentRowObject();
        int index = getListIndex();
        return "<a href=\"details.jsp?index=" + index + "\">" + object.getId() + "</a>";
    }

    public String getLink2()
    {
        ListObject object = (ListObject)getCurrentRowObject();
        int id = object.getId();
        return "<a href=\"details.jsp?id=" + id + "&amp;action=view\">View</a> | " + "<a href=\"details.jsp?id=" + id + "&amp;action=edit\">Edit</a> | " + "<a href=\"details.jsp?id=" + id + "&amp;action=delete\">Delete</a>";
    }

    private FastDateFormat dateFormat;
    private DecimalFormat moneyFormat;
}

⌨️ 快捷键说明

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