- Timestamp:
- 07/12/13 23:41:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/gui/table/ListPanel.java
r99 r100 3 3 4 4 import com.framsticks.gui.ModifiablePanel; 5 import com.framsticks.params.Access Interface;5 import com.framsticks.params.Access; 6 6 import com.framsticks.params.ListAccess; 7 import com.framsticks.params.PrimitiveParam; 7 import com.framsticks.params.Param; 8 import com.framsticks.util.FramsticksException; 8 9 import com.framsticks.util.lang.Casting; 9 import com.framsticks.util.lang.Containers;10 10 11 import org.apache.log4j.Logger; 11 import org.apache.logging.log4j.Logger; 12 import org.apache.logging.log4j.LogManager; 12 13 13 14 import javax.swing.*; … … 19 20 public class ListPanel extends ModifiablePanel { 20 21 21 private static final Logger log = Log ger.getLogger(ListPanel.class.getName());22 private static final Logger log = LogManager.getLogger(ListPanel.class.getName()); 22 23 23 24 protected final TableModel tableModel; … … 29 30 30 31 final ColumnsConfig config = provider.getColumnsConfigs().get(framsClass.getName()); 31 log.debug("creating ListPanel for " + parameters.framsClass + " using config " +config);32 log.debug("creating ListPanel for {} using config {}", parameters.framsClass, config); 32 33 33 tableModel = new TableModel( );34 tableModel = new TableModel(this); 34 35 if (config != null) { 35 36 for (String id : config.getColumnsNames()) { 36 tableModel.addColumn(framsClass.getParamEntry(id, PrimitiveParam.class)); 37 Param param = framsClass.getParam(id); 38 if (param == null) { 39 throw new FramsticksException().msg("requested param not found in frams class").arg("param", id).arg("frams class", framsClass); 40 } 41 if (!tableModel.addColumnIfSupported(param)) { 42 throw new FramsticksException().msg("param is not supported in table view").arg("param", param).arg("frams class", framsClass); 43 } 37 44 } 38 45 } else { 39 for (P rimitiveParam<?> param : Containers.filterInstanceof(framsClass.getParamEntries(), PrimitiveParam.class)) {46 for (Param param : framsClass.getParamEntries()) { 40 47 if (provider.getMaximumColumnNumber() != null && tableModel.getColumnCount() >= provider.getMaximumColumnNumber()) { 41 48 break; 42 49 } 43 tableModel.addColumn (param);50 tableModel.addColumnIfSupported(param); 44 51 } 45 52 } 46 53 47 54 table = new JTable(tableModel); 55 tableModel.setupTable(); 56 48 57 scrollPane = new JScrollPane(table); 49 58 setupContentComponent(scrollPane); … … 63 72 64 73 @Override 65 public void pullValuesFromLocalToUser(Access Interfaceaccess) {74 public void pullValuesFromLocalToUser(Access access) { 66 75 tableModel.attachSource(Casting.throwCast(ListAccess.class, access)); 67 76 } … … 71 80 return "List"; 72 81 } 82 83 /** 84 * @return the table 85 */ 86 public JTable getTable() { 87 return table; 88 } 73 89 }
Note: See TracChangeset
for help on using the changeset viewer.