TableMapper Fixes (again)

thobaben_diagram
Harald Wolff 2016-12-07 09:01:55 +01:00
parent 0cfca19953
commit 6258fe062d
2 changed files with 16 additions and 7 deletions

View File

@ -0,0 +1,9 @@
package org.hwo.models.TableMapper;
public enum ColumnResizePolicy {
FILL_LINEAR, // totalwidth < viewport : w = w * (totalwidth / viewport.width)
FILL_LAST_COLUMN, // totalwidth < viewport : last volumns width is expanded
}

View File

@ -396,11 +396,14 @@ public class TableMapper extends AbstractTableModel
} }
}; };
jTable.addMouseListener(mouseAdapter);
if (InteractiveObjectHelper.isInteractiveObject(editorObjectClass)) if (InteractiveObjectHelper.isInteractiveObject(editorObjectClass))
setEditorEnabled(true); setEditorEnabled(true);
if (ObjectEditorUIHelper.isEditable(editorObjectClass)) if (ObjectEditorUIHelper.isEditable(editorObjectClass))
setEditorEnabled(true); setEditorEnabled(true);
initializeJTable();
} }
private void initializeMapper() private void initializeMapper()
@ -437,7 +440,6 @@ public class TableMapper extends AbstractTableModel
this.jTable.setRowSorter(new TableRowSorter<TableMapper>(this)); this.jTable.setRowSorter(new TableRowSorter<TableMapper>(this));
} else { } else {
this.jTable.setRowSorter(null); this.jTable.setRowSorter(null);
} }
} }
@ -543,7 +545,10 @@ public class TableMapper extends AbstractTableModel
public void openEditor() public void openEditor()
{ {
System.err.println("TableMapper.openEditor()"); if (!isEditorEnabled())
return;
log(DEBUG,"TableMapper.openEditor()");
for (TableMapperListener listener: this.tableMapperListeners){ for (TableMapperListener listener: this.tableMapperListeners){
if (listener.editorRequest(this, getSelectedRow())){ if (listener.editorRequest(this, getSelectedRow())){
fireTableRowsUpdated(jTable.getSelectedRow(), jTable.getSelectedRow()); fireTableRowsUpdated(jTable.getSelectedRow(), jTable.getSelectedRow());
@ -772,11 +777,6 @@ public class TableMapper extends AbstractTableModel
int ind = this.p_rows.indexOf(before); int ind = this.p_rows.indexOf(before);
this.p_rows.add(ind, row); this.p_rows.add(ind, row);
if (TableMapperValue.class.isInstance(row)){
TableMapperValue tmv = (TableMapperValue)row;
tmv.unassignTableMapper(this);
}
fireTableRowsInserted(ind, ind); fireTableRowsInserted(ind, ind);
} else { } else {
this.p_rows.add(row); this.p_rows.add(row);