/** Reset the columns to initial sizes (if set) */ public synchronized void reset() { if (desiredColSizes != null) { createDefaultColumnsFromModel(); TableFormat.resizeCols(this, desiredColSizes, fixedCols); } else { createDefaultColumnsFromModel(); } if (persistanceHandler != null) { persistanceHandler.restore(); persistanceHandler.set(); } }
/** * Sets the data model for this table to newModel and registers with it for listener notifications * from the new data model. Additionally takes care of the registered {@link * TableViewPersistenceHandler}. * * @param model */ @Override public void setModel(TableModel model) { synchronized (this) { super.setModel(model); Log.Debug(this, "done set model"); if (persistanceHandler != null) { persistanceHandler.restore(); persistanceHandler.set(); } } }
/** * Sets the data model for this table to newModel and registers with it for listener notifications * from the new data model. Additionally takes care of the registered {@link * TableViewPersistenceHandler}. * * @param model * @param fieldCount * @param fields */ public synchronized void setModel(List<DatabaseObject> model, int fieldCount, String fields) { Object[][] data = new Object[model.size()][]; for (int i = 0; i < model.size(); i++) { DatabaseObject databaseObject = model.get(i); data[i] = databaseObject.toResolvedArray(fieldCount, fields); } MPTableModel m = new MPTableModel(data); setModel(m); if (persistanceHandler != null) { persistanceHandler.restore(); persistanceHandler.set(); } }
/** @param persistanceHandler the persistanceHandler to set */ public void setPersistanceHandler(TableViewPersistenceHandler persistanceHandler) { this.persistanceHandler = persistanceHandler; if (persistanceHandler != null) { persistanceHandler.set(); } }