Skip to content

Commit

Permalink
fix identification of last tab in order (close #116)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaspayette committed Nov 18, 2014
1 parent 00c6d1a commit 633cf6b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/scala/uk/ac/surrey/xw/state/Writer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ class Writer(
(widgetKey, properties) widgetMap.toSeq
kindName properties.get(kindPropertyKey)
if kindName == tabKindName
order properties.get(orderPropertyKey)
.collect { case order: java.lang.Double order }
} yield (widgetKey, order))
order = properties
.get(orderPropertyKey)
.collect { case order: java.lang.Double order.doubleValue }
.getOrElse(0.0)
} yield (order, widgetKey))
.sorted
.lastOption
.map(_._1)
.map(_._2)
.getOrElse(throw new XWException("No widget tab has been created yet."))

def remove(widgetKey: WidgetKey): Unit = {
Expand Down

0 comments on commit 633cf6b

Please sign in to comment.