public void setText ( Preview preview ) { Point p = this . scrollPaneTable . getViewport ( ) . getViewPosition ( ) ; previewTableModel . setPreview ( preview ) ; SwingUtilities . invokeLater ( new Runnable ( ) { boolean structureChanged = previewTableModel . structureChanged ( ) ; public void run ( ) { if ( ! scrollPaneTable . isVisible ( ) ) { topWrapper . remove ( scrollPaneText ) ; scrollPaneText . setVisible ( false ) ; topWrapper . add ( scrollPaneTable , BorderLayout . CENTER ) ; scrollPaneTable . setVisible ( true ) ; topWrapper . validate ( ) ; } if ( structureChanged ) { previewTableModel . fireTableStructureChanged ( ) ; rescaleTableColumns ( ) ; } else { previewTableModel . fireTableDataChanged ( ) ; } previewTable . repaint ( ) ; } } ) ; this . scrollPaneTable . getViewport ( ) . setViewPosition ( p ) ; this . exportButton . setEnabled ( preview != null ) ; }
Updates the preview table based on the information given by preview .