You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
237 lines
11 KiB
237 lines
11 KiB
--- scala-2.10.2-orig/build.xml 2013-05-31 00:44:27.000000000 +1000
|
|
+++ scala-2.10.2/build.xml 2013-08-20 20:41:23.335756000 +1000
|
|
@@ -343,6 +343,8 @@
|
|
<echo level="warning"> You are using JDK7 for this build.
|
|
While this will be able to build most of Scala, it will not build the Swing project.
|
|
You will be unable to create a distribution.
|
|
+ ^ The above is a message from the scala 2.10.2 release, the Gentoo
|
|
+ ebuild applies patches for jdk 1.7 swing.
|
|
</echo>
|
|
</then></if>
|
|
|
|
@@ -1153,7 +1155,7 @@
|
|
<target name="quick.partest" depends="quick.scalap, quick.comp, asm.done">
|
|
<staged-build with="locker" stage="quick" project="partest" version="partest"/> </target>
|
|
|
|
- <target name="quick.swing" depends="quick.actors, quick.lib" if="has.java6">
|
|
+ <target name="quick.swing" depends="quick.actors, quick.lib">
|
|
<staged-build with="locker" stage="quick" project="swing"/> </target>
|
|
|
|
<target name="quick.plugins" depends="quick.comp">
|
|
@@ -1204,7 +1206,7 @@
|
|
<staged-pack project="library"/></target>
|
|
|
|
<target name="pack.actors" depends="quick.lib"> <staged-pack project="actors"/> </target>
|
|
- <target name="pack.swing" if="has.java6" depends="quick.swing"> <staged-pack project="swing"/> </target>
|
|
+ <target name="pack.swing" depends="quick.swing"> <staged-pack project="swing"/> </target>
|
|
<target name="pack.reflect" depends="quick.reflect"> <staged-pack project="reflect"/> </target>
|
|
|
|
<target name="pack.comp" depends="quick.comp, asm.done">
|
|
@@ -1351,9 +1353,7 @@
|
|
<make-plugin-bundle name="continuations" version="${osgi.version.number}" />
|
|
<touch file="${build-osgi.dir}/bundles.complete" verbose="no"/>
|
|
|
|
- <if><isset property="has.java6"/><then>
|
|
- <make-bundle name="scala-swing" version="${osgi.version.number}"/></then>
|
|
- </if>
|
|
+ <make-bundle name="scala-swing" version="${osgi.version.number}"/>
|
|
<stopwatch name="osgi.bundle.timer" action="total"/></then>
|
|
</if>
|
|
</target>
|
|
--- scala-2.10.2-orig/src/swing/scala/swing/ComboBox.scala 2013-05-31 00:44:27.000000000 +1000
|
|
+++ scala-2.10.2/src/swing/scala/swing/ComboBox.scala 2013-08-20 20:26:48.334061000 +1000
|
|
@@ -9,7 +9,7 @@
|
|
package scala.swing
|
|
|
|
import event._
|
|
-import javax.swing.{JList, JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer}
|
|
+import javax.swing.{ JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer }
|
|
import java.awt.event.ActionListener
|
|
|
|
object ComboBox {
|
|
@@ -118,10 +118,10 @@
|
|
implicit def floatEditor(c: ComboBox[Float]): Editor[Float] = new BuiltInEditor(c)(s => s.toFloat, s => s.toString)
|
|
implicit def doubleEditor(c: ComboBox[Double]): Editor[Double] = new BuiltInEditor(c)(s => s.toDouble, s => s.toString)
|
|
|
|
- def newConstantModel[A](items: Seq[A]): ComboBoxModel = {
|
|
- new AbstractListModel with ComboBoxModel {
|
|
+ def newConstantModel[A](items: Seq[A]): ComboBoxModel[A] = {
|
|
+ new AbstractListModel[A] with ComboBoxModel[A] {
|
|
private var selected: A = if (items.isEmpty) null.asInstanceOf[A] else items(0)
|
|
- def getSelectedItem: AnyRef = selected.asInstanceOf[AnyRef]
|
|
+ def getSelectedItem = selected.asInstanceOf[AnyRef]
|
|
def setSelectedItem(a: Any) {
|
|
if ((selected != null && selected != a) ||
|
|
selected == null && a != null) {
|
|
@@ -129,7 +129,7 @@
|
|
fireContentsChanged(this, -1, -1)
|
|
}
|
|
}
|
|
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
|
|
+ def getElementAt(n: Int) = items(n).asInstanceOf[A]
|
|
def getSize = items.size
|
|
}
|
|
}
|
|
@@ -157,7 +157,7 @@
|
|
* @see javax.swing.JComboBox
|
|
*/
|
|
class ComboBox[A](items: Seq[A]) extends Component with Publisher {
|
|
- override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
|
|
+ override lazy val peer: JComboBox[A] = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
|
|
|
|
object selection extends Publisher {
|
|
def index: Int = peer.getSelectedIndex
|
|
@@ -182,7 +182,8 @@
|
|
* of the component to its own defaults _after_ the renderer has been
|
|
* configured. That's Swing's principle of most suprise.
|
|
*/
|
|
- def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getRenderer)
|
|
+ def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getRenderer.asInstanceOf[ListCellRenderer[A]])
|
|
+ // def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getRenderer)
|
|
def renderer_=(r: ListView.Renderer[A]) { peer.setRenderer(r.peer) }
|
|
|
|
/* XXX: currently not safe to expose:
|
|
@@ -201,8 +202,8 @@
|
|
peer.setEditor(editor(this).comboBoxPeer)
|
|
}
|
|
|
|
- def prototypeDisplayValue: Option[A] = toOption[A](peer.getPrototypeDisplayValue)
|
|
+ def prototypeDisplayValue: Option[A] = Option(peer.getPrototypeDisplayValue)
|
|
def prototypeDisplayValue_=(v: Option[A]) {
|
|
- peer.setPrototypeDisplayValue((v map toAnyRef).orNull)
|
|
+ peer.setPrototypeDisplayValue((v map toAnyRef).orNull.asInstanceOf[A])
|
|
}
|
|
}
|
|
--- scala-2.10.2-orig/src/swing/scala/swing/ListView.scala 2013-05-31 00:44:27.000000000 +1000
|
|
+++ scala-2.10.2/src/swing/scala/swing/ListView.scala 2013-08-20 20:26:48.334716000 +1000
|
|
@@ -24,21 +24,21 @@
|
|
val MultiInterval = Value(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
|
|
}
|
|
|
|
- def wrap[A](c: JList) = new ListView[A] {
|
|
+ def wrap[A](c: JList[A]) = new ListView[A] {
|
|
override lazy val peer = c
|
|
}
|
|
|
|
object Renderer {
|
|
- def wrap[A](r: ListCellRenderer): Renderer[A] = new Wrapped[A](r)
|
|
+ def wrap[A](r: ListCellRenderer[A]): Renderer[A] = new Wrapped[A](r)
|
|
|
|
/**
|
|
* Wrapper for <code>javax.swing.ListCellRenderer<code>s
|
|
*/
|
|
- class Wrapped[A](override val peer: ListCellRenderer) extends Renderer[A] {
|
|
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
|
|
+ class Wrapped[A](override val peer: ListCellRenderer[A]) extends Renderer[A] {
|
|
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
|
|
Component.wrap(peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent])
|
|
+ }
|
|
}
|
|
- }
|
|
|
|
/**
|
|
* Returns a renderer for items of type <code>A</code>. The given function
|
|
@@ -55,8 +55,8 @@
|
|
* </code>
|
|
*/
|
|
def apply[A,B](f: A => B)(implicit renderer: Renderer[B]): Renderer[A] = new Renderer[A] {
|
|
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
|
|
- renderer.componentFor(list, isSelected, focused, f(a), index)
|
|
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
|
|
+ renderer.componentFor(list.asInstanceOf[ListView[_ <: B]], isSelected, focused, f(a), index)
|
|
}
|
|
}
|
|
|
|
@@ -69,11 +69,11 @@
|
|
* @see javax.swing.ListCellRenderer
|
|
*/
|
|
abstract class Renderer[-A] {
|
|
- def peer: ListCellRenderer = new ListCellRenderer {
|
|
- def getListCellRendererComponent(list: JList, a: Any, index: Int, isSelected: Boolean, focused: Boolean) =
|
|
- componentFor(ListView.wrap[A](list), isSelected, focused, a.asInstanceOf[A], index).peer
|
|
+ def peer: ListCellRenderer[_ >: A] = new ListCellRenderer[A] {
|
|
+ def getListCellRendererComponent(list: JList[_ <: A], a: A, index: Int, isSelected: Boolean, focused: Boolean) =
|
|
+ componentFor(ListView.wrap[A](list.asInstanceOf[JList[A]]), isSelected, focused, a, index).peer
|
|
}
|
|
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
|
|
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
|
|
}
|
|
|
|
/**
|
|
@@ -110,7 +110,7 @@
|
|
/**
|
|
* Configures the component before returning it.
|
|
*/
|
|
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
|
|
+ def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
|
|
preConfigure(list, isSelected, focused, a, index)
|
|
configure(list, isSelected, focused, a, index)
|
|
component
|
|
@@ -123,10 +123,10 @@
|
|
* that renders the string returned from an item's <code>toString</code>.
|
|
*/
|
|
implicit object GenericRenderer extends Renderer[Any] {
|
|
- override lazy val peer: ListCellRenderer = new DefaultListCellRenderer
|
|
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
|
|
- val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent]
|
|
- Component.wrap(c)
|
|
+ override lazy val peer: ListCellRenderer[Any] = (new DefaultListCellRenderer).asInstanceOf[ListCellRenderer[Any]]
|
|
+ def componentFor(list: ListView[_ <: Any], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
|
|
+ val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused)
|
|
+ Component.wrap(c.asInstanceOf[JComponent])
|
|
}
|
|
}
|
|
}
|
|
@@ -142,34 +142,34 @@
|
|
*/
|
|
class ListView[A] extends Component {
|
|
import ListView._
|
|
- override lazy val peer: JList = new JList with SuperMixin
|
|
+ override lazy val peer: JList[A] = new JList[A] with SuperMixin
|
|
|
|
def this(items: Seq[A]) = {
|
|
this()
|
|
listData = items
|
|
}
|
|
|
|
- protected class ModelWrapper(val items: Seq[A]) extends AbstractListModel {
|
|
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
|
|
+ protected class ModelWrapper[A](val items: Seq[A]) extends AbstractListModel[A] {
|
|
+ def getElementAt(n: Int) = items(n)
|
|
def getSize = items.size
|
|
}
|
|
|
|
def listData: Seq[A] = peer.getModel match {
|
|
- case model: ModelWrapper => model.items
|
|
- case model @ _ => new Seq[A] { selfSeq =>
|
|
+ case model: ModelWrapper[a] => model.items
|
|
+ case model => new Seq[A] { selfSeq =>
|
|
def length = model.getSize
|
|
def iterator = new Iterator[A] {
|
|
var idx = 0
|
|
def next = { idx += 1; apply(idx-1) }
|
|
def hasNext = idx < selfSeq.length
|
|
}
|
|
- def apply(n: Int) = model.getElementAt(n).asInstanceOf[A]
|
|
+ def apply(n: Int): A = model.getElementAt(n)
|
|
}
|
|
}
|
|
|
|
def listData_=(items: Seq[A]) {
|
|
- peer.setModel(new AbstractListModel {
|
|
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
|
|
+ peer.setModel(new AbstractListModel[A] {
|
|
+ def getElementAt(n: Int) = items(n)
|
|
def getSize = items.size
|
|
})
|
|
}
|
|
@@ -216,7 +216,7 @@
|
|
def adjusting = peer.getSelectionModel.getValueIsAdjusting
|
|
}
|
|
|
|
- def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getCellRenderer)
|
|
+ def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getCellRenderer.asInstanceOf[ListCellRenderer[A]])
|
|
def renderer_=(r: ListView.Renderer[A]) { peer.setCellRenderer(r.peer) }
|
|
|
|
def fixedCellWidth = peer.getFixedCellWidth
|