Permalink
Browse files

Ref #872, #873, #817: More deprecation fixes and scala 2.8 alignment

  • Loading branch information...
1 parent 94555af commit cda5a9e5eedeee398fea7a87b9f2e8bff71e3f95 @indrajitr indrajitr committed Feb 27, 2011
Showing with 225 additions and 266 deletions.
  1. +4 −7 core/actor/src/main/scala/net/liftweb/actor/LAPinger.scala
  2. +1 −1 core/util/src/main/scala/net/liftweb/util/BaseField.scala
  3. +1 −1 core/util/src/main/scala/net/liftweb/util/Maker.scala
  4. +11 −12 core/util/src/main/scala/net/liftweb/util/SoftReferenceCache.scala
  5. +14 −14 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedPostalCode.scala
  6. +5 −7 persistence/mapper/src/main/scala/net/liftweb/mapper/OneToMany.scala
  7. +11 −12 persistence/mapper/src/main/scala/net/liftweb/mapper/Schemifier.scala
  8. +13 −19 persistence/mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala
  9. +1 −2 persistence/mongodb-record/src/test/scala/net/liftweb/mongodb/record/MongoRecordSpec.scala
  10. +16 −19 persistence/record/src/main/scala/net/liftweb/record/field/EnumField.scala
  11. +15 −18 persistence/record/src/main/scala/net/liftweb/record/field/EnumNameField.scala
  12. +13 −15 persistence/record/src/main/scala/net/liftweb/record/field/LocaleField.scala
  13. +15 −18 persistence/record/src/main/scala/net/liftweb/record/field/PasswordField.scala
  14. +15 −18 persistence/record/src/main/scala/net/liftweb/record/field/StringField.scala
  15. +13 −15 persistence/record/src/main/scala/net/liftweb/record/field/TimeZoneField.scala
  16. +2 −3 web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
  17. +14 −14 web/webkit/src/main/scala/net/liftweb/http/LiftScreen.scala
  18. +9 −16 web/webkit/src/main/scala/net/liftweb/http/LiftServlet.scala
  19. +23 −22 web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
  20. +6 −6 web/webkit/src/main/scala/net/liftweb/http/Paginator.scala
  21. +11 −12 web/webkit/src/main/scala/net/liftweb/http/S.scala
  22. +1 −1 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
  23. +3 −3 web/webkit/src/main/scala/net/liftweb/http/TemplateFinder.scala
  24. +1 −1 web/webkit/src/main/scala/net/liftweb/http/auth/HttpAuthentication.scala
  25. +7 −10 web/webkit/src/main/scala/net/liftweb/sitemap/XmlMenu.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package net.liftweb {
-package actor {
+package net.liftweb
+package actor
-import _root_.java.util.concurrent._
+import java.util.concurrent._
/**
* The ActorPing object schedules an actor to be ping-ed with a given message at specific intervals.
@@ -72,6 +72,3 @@ private object TF extends ThreadFactory {
d
}
}
-
-}
-}
@@ -66,7 +66,7 @@ trait ReadableField extends FieldIdentifier with ValueHolder with Bindable {
/**
* Default read-only rendering of field
*/
- def asHtml: NodeSeq = Text(is.toString)
+ def asHtml: NodeSeq = Text(get.toString)
/**
* Given the current context, should this field be displayed
@@ -147,7 +147,7 @@ trait StackableMaker[T] extends Maker[T] {
protected final def find(in: List[PValueHolder[Maker[T]]]): Box[T] = in match {
case Nil => Empty
case x :: rest =>
- x.is.make match {
+ x.get.make match {
case Full(v) => Full(v)
case _ => find(rest)
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-package net.liftweb {
-package util {
+package net.liftweb
+package util
-import _root_.java.lang.ref.{ReferenceQueue,SoftReference};
-import _root_.java.util._
-import _root_.java.util.concurrent.locks._
-import _root_.net.liftweb.util._
+import java.lang.ref.{ReferenceQueue,SoftReference};
+import java.util._
import Map._
-import Helpers._
-import ActorPing._
+import concurrent.locks._
+
import common._
+import util._
+import Helpers._
+import Schedule._
+
/**
* Companion module that has the role of monitoring garbage collected references and remove the orphaned
@@ -163,6 +165,3 @@ class SoftValue[K, V](k: K,
def key: K = k
def cache: SoftReferenceCache[K, V] = lruCache
}
-
-}
-}
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,15 +14,18 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
+package net.liftweb
+package mapper
-import _root_.scala.xml.{Text, Elem}
-import _root_.net.liftweb.http.{S, SHtml}
-import _root_.net.liftweb.common._
-import _root_.net.liftweb.util._
+import java.util.{Locale, TimeZone}
+
+import xml.{Text, Elem}
+
+import common._
+import util._
import Helpers._
-import _root_.java.util.{Locale, TimeZone}
+import http.{S, SHtml}
+
object Countries extends Enumeration(1) {
@@ -81,7 +84,7 @@ abstract class MappedLocale[T <: Mapper[T]](owner: T) extends MappedString[T](ow
override def _toForm: Box[Elem] =
Full(SHtml.select(Locale.getAvailableLocales.
- toList.sort(_.getDisplayName < _.getDisplayName).
+ toList.sortWith(_.getDisplayName < _.getDisplayName).
map(lo => (lo.toString, lo.getDisplayName)),
Full(this.is), set) % ("id" -> fieldId))
}
@@ -104,15 +107,15 @@ object MappedTimeZone {
TimeZone.getAvailableIDs.toList.
filter(!_.startsWith("SystemV/")).
filter(!_.startsWith("Etc/")).filter(_.length > 3).
- sort(_ < _).map(tz => (tz, tz))
+ sortWith(_ < _).map(tz => (tz, tz))
}
abstract class MappedCountry[T <: Mapper[T]](owner: T) extends MappedEnum[T, Countries.type](owner, Countries) {
override def buildDisplayList: List[(Int, String)] = {
val collator = java.text.Collator.getInstance(S.locale)
- super.buildDisplayList.sort((s1, s2) =>
+ super.buildDisplayList.sortWith((s1, s2) =>
collator.compare(s1._2, s2._2) < 0)
}
@@ -153,6 +156,3 @@ abstract class MappedPostalCode[T <: Mapper[T]](owner: T, country: MappedCountry
case _ => genericCheck _ :: super.validations
}
}
-
-}
-}
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
+package net.liftweb
+package mapper
+
/**
* Add this trait to a Mapper for managed one-to-many support
@@ -174,7 +175,7 @@ trait OneToMany[K,T<:KeyedMapper[K, T]] extends KeyedMapper[K,T] { this: T =>
def remove(n: Int) = {
val e = unown(delegate(n))
- delegate = delegate.remove(e eq)
+ delegate = delegate.filterNot(e eq)
e
}
@@ -314,6 +315,3 @@ trait LongMappedForeignMapper[T<:Mapper[T],O<:KeyedMapper[Long,O]]
if (obj eq Empty) List(FieldError(this, scala.xml.Text("Required field: " + name)))
else Nil
}
-
-}
-}
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
+package net.liftweb
+package mapper
-import _root_.java.sql.{Connection, ResultSet, DatabaseMetaData}
-import _root_.scala.collection.mutable.{HashMap, ListBuffer}
-import _root_.net.liftweb.common.{Full, Box, Loggable}
-import _root_.net.liftweb.util.Helpers
+import java.sql.{Connection, ResultSet, DatabaseMetaData}
+
+import collection.mutable.{HashMap, ListBuffer}
+
+import common.{Full, Box, Loggable}
+import util.Helpers
import Helpers._
/**
@@ -266,7 +268,7 @@ object Schemifier extends Loggable {
// val q = quad(rs)
// q.foreach{case (name, col, pos) => byColumn.get(col) match {case Some(li) => byColumn(col) = (name, col, pos) :: li case _ => byColumn(col) = List((name, col, pos))}}
q.foreach{case (name, col, pos) => byName.get(name) match {case Some(li) => byName(name) = col :: li case _ => byName(name) = List(col)}}
- val indexedFields: List[List[String]] = byName.map{case (name, value) => value.sort(_ < _)}.toList
+ val indexedFields: List[List[String]] = byName.map{case (name, value) => value.sortWith(_ < _)}.toList
//rs.close
val single = table.mappedFields.filter{f => f.dbIndexed_?}.toList.flatMap {
@@ -293,7 +295,7 @@ object Schemifier extends Loggable {
case _ => logger.error("Invalid index: " + index); ""
}
- val fn = columns.map(_.field._dbColumnNameLC.toLowerCase).sort(_ < _)
+ val fn = columns.map(_.field._dbColumnNameLC.toLowerCase).sortWith(_ < _)
if (!indexedFields.contains(fn)) {
cmds += maybeWrite(performWrite, logFunc, connection) {
() => createStatement
@@ -337,6 +339,3 @@ object Schemifier extends Loggable {
Collector(ret, cmds.toList)
}
}
-
-}
-}
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,25 +14,23 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
-package view {
+package net.liftweb
+package mapper
+package view
-import net.liftweb.http.{SHtml, S, DispatchSnippet}
-import S.?
-import net.liftweb.util.BindPlus._
-import net.liftweb.util.{Helpers, BindHelpers}
-import net.liftweb.common.{Box, Full, Empty}
+import xml.{NodeSeq, Text}
+
+import common.{Box, Full, Empty}
+import util.BindPlus._
+import util.{Helpers, BindHelpers}
import Helpers._
+import http.{SHtml, S, DispatchSnippet}
+import S.?
-import net.liftweb.mapper.{Mapper,
- MetaMapper,
- LongKeyedMetaMapper,
- MappedField}
+import mapper.{Mapper, MetaMapper, LongKeyedMetaMapper, MappedField}
import Util._
-import scala.xml.{NodeSeq, Text}
/**
* Keeps track of pending adds to and removes from a list of mappers.
@@ -87,7 +85,7 @@ trait ItemsList[T <: Mapper[T]] {
case None =>
unsorted
case Some(field) =>
- unsorted.sort {
+ unsorted.sortWith {
(a, b) => ((field.actualField(a).is: Any, field.actualField(b).is: Any) match {
case (aval: String, bval: String) => aval.toLowerCase < bval.toLowerCase
case (aval: Ordered[Any], bval: Ordered[Any]) => aval < bval
@@ -311,7 +309,3 @@ trait ItemsListEditor[T<:Mapper[T]] {
}
}
-
-}
-}
-}
@@ -26,7 +26,6 @@ import org.specs.Specification
import common._
import json._
-import http.js.JE._
import net.liftweb.record.field.Countries
@@ -48,7 +47,7 @@ object MongoRecordSpec extends Specification("MongoRecord Specification") with M
} yield flavor + typeName + "Field").toList
"introspect only the expected fields" in {
- rec.fields().map(_.name).sortWith(_ < _) must_== allExpectedFieldNames.sort(_ < _)
+ rec.fields().map(_.name).sortWith(_ < _) must_== allExpectedFieldNames.sortWith(_ < _)
}
"correctly look up fields by name" in {
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,20 +14,21 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
-
-import scala.reflect.Manifest
-import scala.xml._
-import net.liftweb.common._
-import net.liftweb.http.js._
-import net.liftweb.http.{S, SHtml}
-import net.liftweb.json.JsonAST.{JInt, JNothing, JNull, JString, JValue}
-import net.liftweb.util._
+package net.liftweb
+package record
+package field
+
+import reflect.Manifest
+import xml._
+
+import common._
import Box.option2Box
-import S._
+import json._
+import util._
import Helpers._
+import http.js._
+import http.{S, SHtml}
+import S._
import JE._
@@ -61,7 +62,7 @@ trait EnumTypedField[EnumType <: Enumeration] extends TypedField[EnumType#Value]
* is the value of the field and the second string is the Text name of the Value.
*/
def buildDisplayList: List[(Box[EnumType#Value], String)] = {
- val options = enum.map(a => (Full(a), a.toString)).toList
+ val options = enum.values.map(a => (Full(a), a.toString)).toList
if (optional_?) (Empty, emptyOptionLabel)::options else options
}
@@ -74,7 +75,7 @@ trait EnumTypedField[EnumType <: Enumeration] extends TypedField[EnumType#Value]
case _ => Full(elem)
}
- def defaultValue: EnumType#Value = enum.iterator.next
+ def defaultValue: EnumType#Value = enum.values.iterator.next
def asJs = valueBox.map(_ => Str(toString)) openOr JsNull
@@ -119,7 +120,3 @@ class OptionalEnumField[OwnerType <: Record[OwnerType], EnumType <: Enumeration]
def owner = rec
protected val valueManifest = m
}
-
-}
-}
-}
Oops, something went wrong.

0 comments on commit cda5a9e

Please sign in to comment.