Created
February 23, 2011 21:44
-
-
Save wfaler/841249 to your computer and use it in GitHub Desktop.
CarDropdown.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bowlerframework.view.scalate.ComponentRenderSupport | |
import com.recursivity.jpa.Jpa._ | |
import collection.mutable.MutableList | |
/** | |
* Created by IntelliJ IDEA. | |
* User: wfaler | |
* Date: 20/02/2011 | |
* Time: 23:40 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
object MakeDropdownComponent extends ComponentRenderSupport{ | |
def show(make: Make): String = { | |
transaction{ | |
val makes = entityManager.createQuery("from Make as m").getResultList.asInstanceOf[java.util.List[Make]] | |
val list = new MutableList[Make] | |
val iterator = makes.iterator | |
while(iterator.hasNext) | |
list += iterator.next | |
if(make != null) | |
render(make, list.toList) | |
else render(list.toList, new Make("Yibberish that will never be selected")) | |
}.asInstanceOf[String] | |
} | |
def show: String = show(new Make("Yibberish that will never be selected")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment