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

📄 exampledata.java~61~

📁 封装了SQL、Socket、WAP、MIME等功能的通用组件
💻 JAVA~61~
字号:
package org.lazybug.skit.example;

import org.lazybug.skit.table.KTableModel;
import org.lazybug.skit.menu.KMenu;
import org.lazybug.skit.menu.KMenuItem;
import org.lazybug.skit.Toolkit;

/**
 * <p>Title: Geniux</p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author David Lau
 * @version 1.0
 */
public class ExampleData extends KTableModel
{
    public static String HEADERS[] = { "", "列1", "列2", "列3" , "列4" };
    /*数据*/
    private Object data[][];
    /*弹出菜单*/
    private KMenu popMenu;

    public ExampleData(Object data[][])
    {
        super(data.length);
        this.data = data;
        popMenu = new KMenu();
        popMenu.addComponent(new KMenuItem("查看", "view"));
        popMenu.addComponent(new KMenuItem("删除", "delete"));
        popMenu.addComponent(new KMenuItem("修改", "modify"));
    }
    /**
     * Returns the number of columns in the model.
     *
     * @return the number of columns in the model
     * @todo Implement this org.lazybug.skit.table.KTableModel method
     */
    public int getColumnCount()
    {
        return HEADERS.length;
    }

    /**
     * Returns the name of the column at <code>col</code>.
     *
     * @param col the index of the column
     * @return the name of the column
     * @todo Implement this org.lazybug.skit.table.KTableModel method
     */
    public String getColumnName(int col)
    {
        return HEADERS[col];
    }

    /**
     * Returns the number of rows in the model.
     *
     * @return the number of rows in the model
     * @todo Implement this org.lazybug.skit.table.KTableModel method
     */
    public int getRowCount()
    {
        if( data != null )
        {
            return data.length;
        }
        return 0;
    }

    /**
     * Returns the value for the cell at <code>col</code> and
     * <code>row</code>.
     *
     * @param row the row whose value is to be queried
     * @param col the column whose value is to be queried
     * @return the value Object at the specified cell
     * @todo Implement this org.lazybug.skit.table.KTableModel method
     */
    public Object getValueAt(int row, int col)
    {
        Object o;
        switch( col )
        {
        case 0:
            o = Toolkit.insertButtonPicked(popMenu);
            break;
        case 1:
            o = Toolkit.insertCellInput(
                data[row][col], this.getColStyle(col), this.getColWidth(col));
        case 2:
            o = Toolkit.insertCellLink("#", data[row][col].toString(), this.getColStyle(col));
            break;
        case 3:
            o = Toolkit.insertCellInput(
                data[row][col], this.getColStyle(col), this.getColWidth(col));
            break;
        case 4:
            o = Toolkit.insertButtonPicked("abc");
            break;
        default:
            o = null;
            break;
        }
        return o;
    }

    /**
     * Returns the java script tag.
     * @return String
     */
    public String getScriptTag()
    {
        StringBuffer sb = new StringBuffer();
        for(int i = 0; i < this.popMenu.getComponentCount(); i++ )
        {
            sb.append(this.popMenu.getComponent(i).getScriptTag());
        }
        sb.append(Toolkit.insertJsFunction("abc"));
        return sb.toString();
    }

    public static void main(String args[])
    {
    }
}

⌨️ 快捷键说明

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