Fixed remove/clear/update issues in BufferWrapper and layout map.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@19374 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
imaier 2009-11-02 16:32:01 +00:00
parent f4b937c0b8
commit 44b5142d4d
2 changed files with 4 additions and 4 deletions

View File

@ -18,9 +18,9 @@ import scala.collection.IndexedSeq
* Default partial implementation for buffer adapters.
*/
protected[swing] abstract class BufferWrapper[A] extends Buffer[A] { outer =>
def clear() { for (i <- 0 until length) remove(i) }
def clear() { for (i <- 0 until length) remove(0) }
def update(n: Int, a: A) {
remove(0)
remove(n)
insertAt(n, a)
}
def insertAll(n: Int, elems: scala.collection.Traversable[A]) {

View File

@ -67,8 +67,8 @@ trait LayoutContainer extends Container.Wrapper {
def get(c: Component) = Swing.toOption(constraintsFor(c))
override def size = peer.getComponentCount
def iterator: Iterator[(Component, Constraints)] =
Iterator.range(0,size).map { c =>
val comp = UIElement.cachedWrapper[Component](peer.getComponent(c).asInstanceOf[JComponent])
peer.getComponents.iterator.map { c =>
val comp = UIElement.cachedWrapper[Component](c.asInstanceOf[JComponent])
(comp, constraintsFor(comp))
}
}