Skip to content

Commit

Permalink
Fixed error in Interactor: Messages were not updated when they changed
Browse files Browse the repository at this point in the history
  • Loading branch information
dominique-unruh committed Aug 10, 2016
1 parent a8a718a commit efebee7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/misc/Log.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package misc
import java.io.File

object Log {
private val pfxlen = 12
private val pfxlen = 13
private def mkPfx(line:sourcecode.Line, file:sourcecode.File) : String = {
val filebase = new File(file.value).getName.stripSuffix(".scala")
val linestr = line.value.toString
Expand Down
11 changes: 6 additions & 5 deletions src/ui/Interactor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ class Interactor[T]() extends layout.VBox {
}

def setQuestion[U<:AnyRef](q : Question[U]): Unit = {
if (question == null || q.questionType!=question.questionType) {
Log.debug("Cell.setQuestion",idx,q)
if (question == null || question!=q) {
if (edit != null) getChildren.remove(edit)
edit = null
question = null
val edit0: Interactor.Editor[U] = editorFactory.create(q)
edit0.setQuestion(q)
// edit0.setQuestion(q)
question = q
edit = edit0
edit0.valueProperty.addListener(new ChangeListener[U] {
Expand All @@ -83,12 +84,12 @@ class Interactor[T]() extends layout.VBox {
if (edit0.valueProperty.getValue!=null)
setAnswer(idx, edit0.valueProperty.getValue, fromEditor=true)
this.getChildren.add(edit0)
} else {
} /*else {
if (question!=q) {
assert(edit.questionType==q.questionType)
edit.asInstanceOf[Editor[U]].setQuestion(q)
}
}
}*/
}
getChildren.addAll(label)
}
Expand Down Expand Up @@ -161,7 +162,7 @@ object Interactor {
val valueProperty : Property[T]
val editedType : TypeTag[T]
val questionType : TypeTag[_ <: Question[T]]
def setQuestion(question : Question[T]) : Unit = {}
// def setQuestion(question : Question[T]) : Unit = {}
def setValue(v:T) : Unit = {
// assert(editedType.isInstance(v),
// "v: "+v+", editedType: "+editedType)
Expand Down

0 comments on commit efebee7

Please sign in to comment.