I'm using a custom TableModel
that has a companion custom ColumnModel
. Below is the code for the panel that it is on.
The table works great and I can add and remove columns without any trouble but the headers are never displayed. How would I fix that?
val panel = new BorderPanel() {
var sourceLabel = new Label("No file chosen")
layout(sourceLabel) = North
var tableModel = new LogRecordTableModel
var dataTable = new Table {
model = tableModel
peer.setColumnModel(tableModel.columnModel)
}
val scrollPane = new ScrollPane(dataTable)
layout(scrollPane) = Center
layout(controlStrip) = South
openAction.setParent(this)
listenTo(openAction)
reactions += {
case f:FileChosen =>
tableModel.setSource(f.file)
updateFile(f.file)
}
listenTo(previousAction)
reactions += {
case PREVIOUS =>
tableModel.previous()
updateButtons()
}
listenTo(nextAction)
reactions += {
case NEXT =>
tableModel.next()
updateButtons()
}
def updateFile(file: File) {
sourceLabel = new Label(file.getName)
layout(sourceLabel) = North
Thread.sleep(100)
updateButtons()
revalidate()
main.repaint()
}
def updateButtons() {
nextButton.enabled = tableModel.hasNext
previousButton.enabled = tableModel.hasPrevious
}
def updateTypeControl() {
println("[$lessanonymous$greater.updateTypeControl] enter.")
typeControl.selection.item(tableModel, typeValues.selection.item)
}
}