/** Initializes some GUI-related things. */ @Override protected void initGUI() { super.initGUI(); m_SortNewTableModel = initialSortNewTableModel(); m_Model.addMouseListenerToHeader(this); if (getSortNewTableModel()) sort(0); m_UseOptimalColumnWidths = initialUseOptimalColumnWidths(); if (getUseOptimalColumnWidths()) { setAutoResizeMode(AUTO_RESIZE_OFF); setOptimalColumnWidth(); } }
/** * Sets the model to display - only {@link #getTableModelClass()}. * * @param model the model to display */ @Override public synchronized void setModel(TableModel model) { Hashtable<String, Object> settings; if (!(getTableModelClass().isInstance(model))) model = createDefaultDataModel(); // backup current setup if (m_Model != null) { settings = backupModelSettings(m_Model); getTableHeader().removeMouseListener(m_Model.getHeaderMouseListener()); } else { settings = null; } m_Model = new SortableAndSearchableWrapperTableModel(model); super.setModel(m_Model); m_Model.addMouseListenerToHeader(this); // restore setup restoreModelSettings(m_Model, settings); }