diff --git a/api/src/main/scala/uk/ac/surrey/xw/api/ExtraWidget.scala b/api/src/main/scala/uk/ac/surrey/xw/api/ExtraWidget.scala index f617f6a..55cfd9b 100644 --- a/api/src/main/scala/uk/ac/surrey/xw/api/ExtraWidget.scala +++ b/api/src/main/scala/uk/ac/surrey/xw/api/ExtraWidget.scala @@ -16,8 +16,11 @@ trait ExtraWidget extends Component { val kind: WidgetKind[this.type] def init(propertyMap: PropertyMap): Unit = - for ((propertyKey, value) ← propertyMap) - setProperty(propertyKey, value) + propertyMap.toSeq + // make sure the default property gets set last + // (see https://github.com/CRESS-Surrey/eXtraWidgets/issues/162) + .sortBy { case (k, v) ⇒ kind.defaultProperty.map(_.key).contains(k) } + .foreach { case (k, v) ⇒ setProperty(k, v) } def setProperty( propertyKey: PropertyKey,