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

📄 datatablemodel.java.svn-base

📁 通讯采集软件
💻 SVN-BASE
字号:
package collector.gui.model;

import java.util.*;

import javax.swing.table.*;

import collector.gui.method.*;

public class DataTableModel
    extends DefaultTableModel {

  public DataTableModel() {
    super(
        new Object[][] {}
        ,
        new String[] {"所属采集单元", "所属电表", "数据类型", "采集类型", "采样时间",
        "数据原始值", "数据原始值状态", "数据值", "数据状态", "需量发生时间", "时段名称"});
  }

  public boolean isCellEditable(int rowIndex, int columnIndex) {
    return false;
  }

  public void setValueAt(Object aValue, int row, int column) {
    super.setValueAt(aValue, row, column);
    return;
  }

  public void clearValueAt(int m_pRow) {
    Object[] m_Object = new Object[this.getColumnCount()];
    for (int i = 0; i < this.getColumnCount(); i++) {
      m_Object[i] = "";
      super.setValueAt(m_Object[i], m_pRow, i);
    }
  }

  public void addRow(Object[] rowData) {
    super.addRow(rowData);
  }

  /*
       public void addRow(Object[] rowData) {
      stayCollection.add(rowData);
      if (!refreshTag) {
          return;
      }
       if (dataCollection.size() + stayCollection.size() >= this.maxElementCount) {
          int removeCount = dataCollection.size() + stayCollection.size() -
          maxElementCount;
          if (removeCount > dataCollection.size()) {
              removeCount = dataCollection.size();
          }
          Object[] dcs = dataCollection.toArray();
          int k = 0;
          for (k = removeCount - 1; k >= 0; k--) {
              dataCollection.remove(dcs[k]);
              this.removeRow(k);
          }
      }
      Object[] os = stayCollection.toArray();
      int i = 0;
      for (i = 0; i < os.length; i++) {
          this.addRow((Object[])os[i]);
      }
      dataCollection.add(stayCollection);
      stayCollection.clear();
      dataChanged = true;
       }
   */

  private void writeDataIntoModel(Object dataObject) {

    Object[] rowData = (Object[]) dataObject;
    try {
      this.addRow(rowData);
    }
    catch (Exception e) {
      FrontGuiDefine.SystemPrintln("WriteDataIntoModel Exceptoion:" + e);
    }
  }

  public void clear() {
    dataCollection.clear();
    this.setRowCount(0);
  }

  public boolean getRefreshTag() {
    return refreshTag;
  }

  public void setRefreshTag(boolean refreshTag) {
    this.refreshTag = refreshTag;
  }

  public boolean getDataChanged() {
    return dataChanged;
  }

  public void setDataChanged(boolean dataChanged) {
    this.dataChanged = dataChanged;
  }

  private Collection dataCollection = new ArrayList(10);
  private Collection stayCollection = new ArrayList();
  public static final int maxElementCount = 1000;
  private boolean refreshTag = true;
  private boolean dataChanged = false;
}

⌨️ 快捷键说明

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