Skip to content

Commit

Permalink
formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Kerola committed Jan 3, 2015
1 parent 2d48599 commit bcce135
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions addon/src/main/scala/vaadin/scala/FieldFactory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class DefaultFieldGroupFieldFactory extends FieldGroupFieldFactory {
}

def createDefaultField[T <: Field[_]](dataType: Class[_],
fieldType: Class[T]): Option[T] = {
fieldType: Class[T]): Option[T] = {
if (fieldType.isAssignableFrom(TextField.getClass))
createAbstractTextField[TextField](classOf[TextField]) map (fieldType.cast(_))

Expand All @@ -132,7 +132,7 @@ trait TableFieldFactory extends Wrapper {

trait TableFieldFactoryDelegator extends com.vaadin.ui.TableFieldFactory with TableFieldFactoryMixin {
def createField(container: com.vaadin.data.Container, itemId: Any, propertyId: Any,
uiContext: com.vaadin.ui.Component): com.vaadin.ui.Field[_] = {
uiContext: com.vaadin.ui.Component): com.vaadin.ui.Field[_] = {
uiContext match {

case mixin: ScaladinMixin if mixin.wrapper.isInstanceOf[Table] => {
Expand Down
35 changes: 17 additions & 18 deletions addon/src/main/scala/vaadin/scala/Grid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package vaadin.scala
import com.vaadin.data.sort.SortOrder
import vaadin.scala.internal._
import vaadin.scala.mixins._
import com.vaadin.ui.{Grid => VaadinGrid}
import com.vaadin.ui.{ Grid => VaadinGrid }
import vaadin.scala.Grid._
import collection.JavaConverters._
import scala.reflect.ClassTag
import vaadin.scala.event.{SortNotifier, SelectionNotifier}
import vaadin.scala.event.{ SortNotifier, SelectionNotifier }

package mixins {
trait GridMixin extends AbstractComponentMixin { self: com.vaadin.ui.Grid => }
Expand Down Expand Up @@ -49,25 +49,25 @@ object Grid {

val p: com.vaadin.ui.Grid.Column

def propertyId: Any = p.getColumnProperty
def propertyId: Any = p.getColumnProperty

def headerCaption: String = p.getHeaderCaption
def headerCaption_=(headerCaption: String): Unit = p.setHeaderCaption(headerCaption)
def headerCaption: String = p.getHeaderCaption
def headerCaption_=(headerCaption: String): Unit = p.setHeaderCaption(headerCaption)

def width: Double = p.getWidth
def width_=(pixelWidth: Double): Unit = p.setWidth(pixelWidth)
def width: Double = p.getWidth
def width_=(pixelWidth: Double): Unit = p.setWidth(pixelWidth)

def widthUndefined() = p.setWidthUndefined()
def widthUndefined() = p.setWidthUndefined()

//def visible: Boolean = p.isVisible
//def visible_=(visible: Boolean): Unit = p.setVisible(visible)
//def visible: Boolean = p.isVisible
//def visible_=(visible: Boolean): Unit = p.setVisible(visible)

def setLastFrozenColumn(): Unit = p.setLastFrozenColumn()
def setLastFrozenColumn(): Unit = p.setLastFrozenColumn()

// TODO: renderer / sortable
// TODO: renderer / sortable

def sortable: Boolean = p.isSortable
def sortable_=(sortable: Boolean): Unit = p.setSortable(sortable)
def sortable: Boolean = p.isSortable
def sortable_=(sortable: Boolean): Unit = p.setSortable(sortable)
}

case class RowReference(grid: Grid, itemId: Any) {
Expand Down Expand Up @@ -129,7 +129,7 @@ object Grid {
* @author Henri Kerola / Vaadin
*/
class Grid(override val p: VaadinGrid with GridMixin)
extends AbstractComponent(p) with SelectionNotifier with SortNotifier {
extends AbstractComponent(p) with SelectionNotifier with SortNotifier {

def this() {
this(new VaadinGrid(new IndexedContainer().p) with GridMixin)
Expand All @@ -147,7 +147,6 @@ class Grid(override val p: VaadinGrid with GridMixin)
}
editorFieldGroup = new FieldGroup(new CustomVaadinFieldGroup with FieldGroupMixin)


def container: Container.Indexed = wrapperFor(p.getContainerDataSource).get
def container_=(container: Container.Indexed) { p.setContainerDataSource(container.p) }

Expand All @@ -169,7 +168,7 @@ class Grid(override val p: VaadinGrid with GridMixin)

def removeColumn(propertyId: Any): Unit = p.removeColumn(propertyId)

def setColumnOrder(propertyIds: Seq[Any]) = p.setColumnOrder(propertyIds.asInstanceOf[Seq[Object]] : _*)
def setColumnOrder(propertyIds: Seq[Any]) = p.setColumnOrder(propertyIds.asInstanceOf[Seq[Object]]: _*)

def frozenColumnCount: Int = p.getFrozenColumnCount
def frozenColumnCount_=(frozenColumnCount: Int): Unit = p.setFrozenColumnCount(frozenColumnCount)
Expand Down Expand Up @@ -226,7 +225,7 @@ class Grid(override val p: VaadinGrid with GridMixin)
p.getSortOrder.asScala map { so => (so.getPropertyId, SortDirection(so.getDirection.ordinal)) }

def sortOrder_=(sortOrder: Seq[(Any, SortDirection.Value)]): Unit = {
val so = sortOrder map { so => new SortOrder(so._1, com.vaadin.shared.data.sort.SortDirection.values.apply(so._2.id))}
val so = sortOrder map { so => new SortOrder(so._1, com.vaadin.shared.data.sort.SortDirection.values.apply(so._2.id)) }
p.setSortOrder(so.asJava)
}

Expand Down
10 changes: 5 additions & 5 deletions addon/src/main/scala/vaadin/scala/GridLayout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class GridLayout(
extends AbstractLayout(p) with SpacingHandler with AlignmentHandler with MarginHandler with LayoutClickNotifier {

def add[C <: Component](component: C = null,
col: Int = -1,
row: Int = -1,
col2: Int = -1,
row2: Int = -1,
alignment: Alignment.Value = null): C = {
col: Int = -1,
row: Int = -1,
col2: Int = -1,
row2: Int = -1,
alignment: Alignment.Value = null): C = {

if (col >= 0 && row >= 0 && col2 >= 0 && row2 >= 0)
p.addComponent(component.p, col, row, col2, row2)
Expand Down
6 changes: 3 additions & 3 deletions addon/src/main/scala/vaadin/scala/Notification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ object Notification {
}

def apply(caption: String,
description: String,
notificationType: Notification.Type.Value,
htmlContentAllowed: Boolean): Notification = {
description: String,
notificationType: Notification.Type.Value,
htmlContentAllowed: Boolean): Notification = {
val t = VaadinNotification.Type.values.apply(notificationType.id)
new Notification(new VaadinNotification(caption, description, t, htmlContentAllowed))
}
Expand Down
2 changes: 1 addition & 1 deletion addon/src/main/scala/vaadin/scala/UI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ abstract class UI(override val p: WrappedVaadinUI)
* When preserveOnRefresh is true for the UI, this method can be
* overridden to refresh the UI on a browser refresh.
*/
def refresh(request: ScaladinRequest): Unit = { }
def refresh(request: ScaladinRequest): Unit = {}

def uiId: Int = p.getUIId

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package mixins {
override def wrapper = super.wrapper.asInstanceOf[ConverterFactory]

override def createConverter[Presentation, Model](presentationType: Class[Presentation],
modelType: Class[Model]): VaadinConverter[Presentation, Model] = {
modelType: Class[Model]): VaadinConverter[Presentation, Model] = {
WrapperUtil.peerFor(wrapper.createConverter[Presentation, Model](ClassTag(presentationType), ClassTag(modelType)))
}
}
Expand All @@ -32,5 +32,5 @@ trait ConverterFactory extends InterfaceWrapper {
pConverterFactory.wrapper = this

def createConverter[Presentation, Model](implicit presentationType: ClassTag[Presentation],
modelType: ClassTag[Model]): Option[Converter[Presentation, Model]]
modelType: ClassTag[Model]): Option[Converter[Presentation, Model]]
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package vaadin.scala.event

import com.vaadin.ui.{ AbstractComponent => VaadinAbstractComponent }
import com.vaadin.event.SelectionEvent.{SelectionNotifier => VaadinSelectionNotifier}
import com.vaadin.event.SelectionEvent.{ SelectionNotifier => VaadinSelectionNotifier }
import vaadin.scala.ListenersSet
import vaadin.scala.internal.{ListenersTrait, GridSelectionListener}
import vaadin.scala.internal.{ ListenersTrait, GridSelectionListener }

/**
*
Expand Down
4 changes: 2 additions & 2 deletions addon/src/main/scala/vaadin/scala/event/SortNotifier.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package vaadin.scala.event

import vaadin.scala.ListenersSet
import vaadin.scala.internal.{GridSortListener, ListenersTrait}
import vaadin.scala.internal.{ GridSortListener, ListenersTrait }
import com.vaadin.ui.{ AbstractComponent => VaadinAbstractComponent }
import com.vaadin.event.SortEvent.{SortNotifier => VaadinSortNotifier}
import com.vaadin.event.SortEvent.{ SortNotifier => VaadinSortNotifier }

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vaadin.scala.internal

import com.vaadin.event.{SelectionEvent => VaadinSelectionEvent}
import com.vaadin.event.{ SelectionEvent => VaadinSelectionEvent }
import com.vaadin.event.SelectionEvent.SelectionListener
import vaadin.scala.Component
import vaadin.scala.event.SelectionEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package vaadin.scala.internal

import com.vaadin.event.{SortEvent => VaadinSortEvent}
import com.vaadin.event.{ SortEvent => VaadinSortEvent }
import com.vaadin.event.SortEvent.SortListener
import vaadin.scala.{Component, Grid}
import vaadin.scala.{ Component, Grid }
import vaadin.scala.SortDirection
import collection.JavaConverters._
import vaadin.scala.event.SortEvent
Expand Down
11 changes: 6 additions & 5 deletions addon/src/main/scala/vaadin/scala/internal/ListenersTrait.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ trait ListenersTrait[E, L <: Listener] extends mutable.Set[E => Unit] with Liste
def +=(elem: => Unit) = { addListener((e: E) => elem); this }
def +=(elem: E => Unit) = { addListener(elem); this }
def -=(elem: E => Unit) = {
val list = listeners.asScala.collect { case l: L =>
if (l.action == elem) {
removeListener(l)
this
}
val list = listeners.asScala.collect {
case l: L =>
if (l.action == elem) {
removeListener(l)
this
}
}
this
}
Expand Down
2 changes: 1 addition & 1 deletion addon/src/main/scala/vaadin/scala/server/Resource.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vaadin.scala.server

import vaadin.scala.{InterfaceWrapper, Wrapper}
import vaadin.scala.{ InterfaceWrapper, Wrapper }
import vaadin.scala.mixins.ScaladinInterfaceMixin
import vaadin.scala.server.mixins.ResourceMixin

Expand Down

0 comments on commit bcce135

Please sign in to comment.