public void restoreState(PreferencesExt store) {
    if (store == null)
      return;

    int ncols = table.getColumnCount();

    // stored column order
    int[] modelIndex = (int[]) store.getBean("ColumnOrder", null);

    if ((modelIndex != null) && (modelIndex.length == ncols)) { // what about invisible ??

      // make invisible any not stored
      boolean[] visible = new boolean[ncols];
      for (int aModelIndex : modelIndex)
        if (aModelIndex < ncols)
          visible[aModelIndex] = true;

      // modify popup menu
      for (int i = 0; i < ncols; i++)
        if (!visible[i]) {
          //System.out.println( colName[i]+" hide "+i);
          acts[i].hideColumn();
          acts[i].putValue(BAMutil.STATE, new Boolean(false));
        }

      // now set the header order
      TableColumnModel tcm = table.getColumnModel();
      int n = Math.min(modelIndex.length, table.getColumnCount());
      for (int i = 0; i < n; i++) {
        TableColumn tc = tcm.getColumn(i);
        tc.setModelIndex(modelIndex[i]);
        String name = model.getColumnName(modelIndex[i]);
        tc.setHeaderValue(name);
        tc.setIdentifier(name);
        if (useThreads && (modelIndex[i] == threadCol)) {
          threadHeaderRenderer = new ThreadHeaderRenderer(threadCol);
          tc.setHeaderRenderer(threadHeaderRenderer);
        } else
          tc.setHeaderRenderer(new SortedHeaderRenderer(name, modelIndex[i]));
      }
    }

    // set the column widths
    Object colWidths = store.getBean("ColumnWidths", null);
    if (colWidths == null)
      return;
    int[] size = (int[]) colWidths;
    setColumnWidths(size);

    if (debug) {
      System.out.println(" read widths = ");
      for (int aSize : size)
        System.out.print(" " + aSize);
      System.out.println();
    }

    boolean isThreadsOn = store.getBoolean("isThreadsOn", false);
    if (useThreads) {
      model.setThreadsOn(isThreadsOn);
      threadHeaderRenderer.setOn(isThreadsOn);
    }

    int colNo = store.getInt("SortOnCol", 0);
    boolean reverse = store.getBoolean("SortReverse", false);
    model.setSortCol(colNo);
    model.setReverse(reverse);
    setSortCol(colNo, reverse);

    model.sort();
    table.fireDataChanged();
  }

  private void setColumnWidths(int[] sizes) {
    TableColumnModel tcm = table.getColumnModel();
    for (int i = 0; i < table.getColumnCount(); i++) {
      TableColumn tc = tcm.getColumn(i);
      int maxw = ((sizes == null) || (i >= sizes.length)) ? 10 : sizes[i];
      //     model.getPreferredWidthForColumn(tc) : sizes[i];
      tc.setPreferredWidth(maxw);
    }
    //table.sizeColumnsToFit(0);     //  must be called due to a JTable bug
  }

  public void setColOn(int colno, boolean state, int pos) {
    // System.out.println("setColOn "+colno+" "+state+" "+pos);
    acts[colno].putValue(BAMutil.STATE, new Boolean(state));
    if (state)
      acts[colno].addAtPos(pos);
    else
      acts[colno].hideColumn();
  }
public void restoreState(PreferencesExt store) {
    if (store == null)
      return;

    int ncols = table.getColumnCount();

    
    int[] modelIndex = (int[]) store.getBean("ColumnOrder", null);

    if ((modelIndex != null) && (modelIndex.length == ncols)) { 

      
      boolean[] visible = new boolean[ncols];
      for (int aModelIndex : modelIndex)
        if (aModelIndex < ncols)
          visible[aModelIndex] = true;

      
      for (int i = 0; i < ncols; i++)
        if (!visible[i]) {
          
          acts[i].hideColumn();
          acts[i].putValue(BAMutil.STATE, new Boolean(false));
        }

      
      TableColumnModel tcm = table.getColumnModel();
      int n = Math.min(modelIndex.length, table.getColumnCount());
      for (int i = 0; i < n; i++) {
        TableColumn tc = tcm.getColumn(i);
        tc.setModelIndex(modelIndex[i]);
        String name = model.getColumnName(modelIndex[i]);
        tc.setHeaderValue(name);
        tc.setIdentifier(name);
        if (useThreads && (modelIndex[i] == threadCol)) {
          threadHeaderRenderer = new ThreadHeaderRenderer(threadCol);
          tc.setHeaderRenderer(threadHeaderRenderer);
        } else
          tc.setHeaderRenderer(new SortedHeaderRenderer(name, modelIndex[i]));
      }
    }

    
    Object colWidths = store.getBean("ColumnWidths", null);
    if (colWidths == null)
      return;
    int[] size = (int[]) colWidths;
    setColumnWidths(size);

    if (debug) {
      System.out.println(" read widths = ");
      for (int aSize : size)
        System.out.print(" " + aSize);
      System.out.println();
    }

    boolean isThreadsOn = store.getBoolean("isThreadsOn", false);
    if (useThreads) {
      model.setThreadsOn(isThreadsOn);
      threadHeaderRenderer.setOn(isThreadsOn);
    }

    int colNo = store.getInt("SortOnCol", 0);
    boolean reverse = store.getBoolean("SortReverse", false);
    model.setSortCol(colNo);
    model.setReverse(reverse);
    setSortCol(colNo, reverse);

    model.sort();
    table.fireDataChanged();
  }

  private void setColumnWidths(int[] sizes) {
    TableColumnModel tcm = table.getColumnModel();
    for (int i = 0; i < table.getColumnCount(); i++) {
      TableColumn tc = tcm.getColumn(i);
      int maxw = ((sizes == null) || (i >= sizes.length)) ? 10 : sizes[i];
      
      tc.setPreferredWidth(maxw);
    }
    
  }

  public void setColOn(int colno, boolean state, int pos) {
    
    acts[colno].putValue(BAMutil.STATE, new Boolean(state));
    if (state)
      acts[colno].addAtPos(pos);
    else
      acts[colno].hideColumn();
  }
public void restoreState ( PreferencesExt store ) { if ( store == null ) return ; int ncols = table . getColumnCount ( ) ; // stored column order int [ ] modelIndex = ( int [ ] ) store . getBean ( "ColumnOrder" , null ) ; if ( ( modelIndex != null ) && ( modelIndex . length == ncols ) ) { // what about invisible ?? // make invisible any not stored boolean [ ] visible = new boolean [ ncols ] ; for ( int aModelIndex : modelIndex ) if ( aModelIndex < ncols ) visible [ aModelIndex ] = true ; // modify popup menu for ( int i = 0 ; i < ncols ; i ++ ) if ( ! visible [ i ] ) { //System.out.println( colName[i]+" hide "+i); acts [ i ] . hideColumn ( ) ; acts [ i ] . putValue ( BAMutil . STATE , new Boolean ( false ) ) ; } // now set the header order TableColumnModel tcm = table . getColumnModel ( ) ; int n = Math . min ( modelIndex . length , table . getColumnCount ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { TableColumn tc = tcm . getColumn ( i ) ; tc . setModelIndex ( modelIndex [ i ] ) ; String name = model . getColumnName ( modelIndex [ i ] ) ; tc . setHeaderValue ( name ) ; tc . setIdentifier ( name ) ; if ( useThreads && ( modelIndex [ i ] == threadCol ) ) { threadHeaderRenderer = new ThreadHeaderRenderer ( threadCol ) ; tc . setHeaderRenderer ( threadHeaderRenderer ) ; } else tc . setHeaderRenderer ( new SortedHeaderRenderer ( name , modelIndex [ i ] ) ) ; } } // set the column widths Object colWidths = store . getBean ( "ColumnWidths" , null ) ; if ( colWidths == null ) return ; int [ ] size = ( int [ ] ) colWidths ; setColumnWidths ( size ) ; if ( debug ) { System . out . println ( " read widths = " ) ; for ( int aSize : size ) System . out . print ( " " + aSize ) ; System . out . println ( ) ; } boolean isThreadsOn = store . getBoolean ( "isThreadsOn" , false ) ; if ( useThreads ) { model . setThreadsOn ( isThreadsOn ) ; threadHeaderRenderer . setOn ( isThreadsOn ) ; } int colNo = store . getInt ( "SortOnCol" , 0 ) ; boolean reverse = store . getBoolean ( "SortReverse" , false ) ; model . setSortCol ( colNo ) ; model . setReverse ( reverse ) ; setSortCol ( colNo , reverse ) ; model . sort ( ) ; table . fireDataChanged ( ) ; } private void setColumnWidths ( int [ ] sizes ) { TableColumnModel tcm = table . getColumnModel ( ) ; for ( int i = 0 ; i < table . getColumnCount ( ) ; i ++ ) { TableColumn tc = tcm . getColumn ( i ) ; int maxw = ( ( sizes == null ) || ( i >= sizes . length ) ) ? 10 : sizes [ i ] ; //     model.getPreferredWidthForColumn(tc) : sizes[i]; tc . setPreferredWidth ( maxw ) ; } //table.sizeColumnsToFit(0);     //  must be called due to a JTable bug } public void setColOn ( int colno , boolean state , int pos ) { // System.out.println("setColOn "+colno+" "+state+" "+pos); acts [ colno ] . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; if ( state ) acts [ colno ] . addAtPos ( pos ) ; else acts [ colno ] . hideColumn ( ) ; }
Set the state from the last saved in the PreferencesExt.

@param store ok if null or empty
Set the state from the last saved in the PreferencesExt .