Skip to content

Commit 65197ee

Browse files
authored
Merge pull request UdashFramework#686 from UdashFramework/readable-removal
Remove ReadableProperty#readable
2 parents 6e94feb + 6f16334 commit 65197ee

File tree

11 files changed

+6
-30
lines changed

11 files changed

+6
-30
lines changed

bootstrap4/.js/src/main/scala/io/udash/bootstrap/alert/DismissibleUdashAlert.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class DismissibleUdashAlert private[alert](
1616
private val _dismissed = Property[Boolean](false)
1717

1818
def dismissed: ReadableProperty[Boolean] =
19-
_dismissed.readable
19+
_dismissed
2020

2121
private val button = UdashButton(buttonStyle = BootstrapStyles.Color.Link.toProperty) { _ => Seq[Modifier](
2222
componentId.withSuffix("close"),

core/.js/src/main/scala/io/udash/routing/RoutingEngine.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private[udash] final class RoutingEngine[HierarchyRoot >: Null <: GState[Hierarc
108108
def currentState: HierarchyRoot = currentStateProp.get
109109

110110
/** @return Property reflecting current routing state */
111-
def currentStateProperty: ReadableProperty[HierarchyRoot] = currentStateProp.readable
111+
def currentStateProperty: ReadableProperty[HierarchyRoot] = currentStateProp
112112

113113
@tailrec
114114
private def getStatePath(forState: Option[HierarchyRoot], acc: List[HierarchyRoot] = Nil): List[HierarchyRoot] = forState match {

core/src/main/scala/io/udash/properties/ImmutableProperty.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ private[properties] class ImmutableProperty[A](value: A) extends ReadablePropert
3939
ImmutableProperty.NoOpRegistration
4040
}
4141

42-
override final def readable: this.type = this
4342
}
4443

4544
private[properties] final class ImmutableModelProperty[A](value: A)

core/src/main/scala/io/udash/properties/model/ModelProperty.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ trait ModelProperty[A] extends AbstractProperty[A] with ModelPropertyMacroApi[A]
3232
implicit ev: SeqPropertyCreator[B, SeqTpe]
3333
): SeqProperty[B, CastableProperty[B]] = macro io.udash.macros.PropertyMacros.reifySubSeq[A, B, SeqTpe]
3434

35-
override def readable: ModelProperty[A] = this
3635
}
3736

core/src/main/scala/io/udash/properties/model/ReadableModelProperty.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ trait ReadableModelProperty[+A] extends ReadableProperty[A] {
1919
/** Returns child DirectSeqProperty[B] */
2020
def roSubSeq[B, SeqTpe[T] <: BSeq[T]](f: A => SeqTpe[B])(implicit ev: SeqPropertyCreator[B, SeqTpe]): ReadableSeqProperty[B, CastableReadableProperty[B]] =
2121
macro io.udash.macros.PropertyMacros.reifyRoSubSeq[A, B]
22-
23-
/** Ensures read-only access to this property. */
24-
override def readable: ReadableModelProperty[A]
2522
}
2623

2724
trait ModelPropertyMacroApi[A] extends ReadableModelProperty[A] {

core/src/main/scala/io/udash/properties/seq/PropertySeqCombinedReadableSeqProperty.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ private[properties] class PropertySeqCombinedReadableSeqProperty[A](value: ISeq[
1010

1111
override protected[properties] val parent: ReadableProperty[_] = null
1212

13-
private val children = value.map(_.readable)
1413
private var originListenerRegistration: Registration = _
1514

1615
private def killOriginListeners(): Unit = {
@@ -66,10 +65,10 @@ private[properties] class PropertySeqCombinedReadableSeqProperty[A](value: ISeq[
6665
}
6766

6867
override def get: ISeq[A] =
69-
children.map(_.get)
68+
value.map(_.get)
7069

7170
override def elemProperties: ISeq[ReadableProperty[A]] =
72-
children
71+
value
7372

7473
override def listenStructure(structureListener: Patch[ReadableProperty[A]] => Any): Registration =
7574
ImmutableProperty.NoOpRegistration

core/src/main/scala/io/udash/properties/seq/ReadableSeqProperty.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ trait ReadableSeqProperty[+A, +ElemType <: ReadableProperty[A]] extends Readable
6666

6767
/** Zips elements from `this` SeqProperty with their indexes. */
6868
def zipWithIndex: ReadableSeqProperty[(A, Int), ReadableProperty[(A, Int)]]
69-
70-
override def readable: ReadableSeqProperty[A, ReadableProperty[A]]
7169
}
7270

7371
private[properties] trait AbstractReadableSeqProperty[A, ElemType <: ReadableProperty[A]]
@@ -107,5 +105,4 @@ private[properties] trait AbstractReadableSeqProperty[A, ElemType <: ReadablePro
107105
)
108106
}
109107

110-
override def readable: ReadableSeqProperty[A, ReadableProperty[A]] = this
111108
}

core/src/main/scala/io/udash/properties/seq/SeqPropertyFromSingleValue.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ private[properties] final class ReadableSeqPropertyFromSingleValue[A, B: Propert
138138
origin: ReadableProperty[A], transformer: A => BSeq[B]
139139
) extends BaseReadableSeqPropertyFromSingleValue[A, B, ReadableProperty[B]](origin, transformer, listenChildren = false) {
140140

141-
override protected def toElemProp(p: Property[B]): ReadableProperty[B] =
142-
p.readable
141+
override protected def toElemProp(p: Property[B]): ReadableProperty[B] = p
143142
}
144143

145144
private[properties] final class SeqPropertyFromSingleValue[A, B: PropertyCreator](

core/src/main/scala/io/udash/properties/single/ReadableProperty.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ trait ReadableProperty[+A] {
2424
/** Returns listeners count. */
2525
def listenersCount(): Int
2626

27-
/** Read-only interface of this property. */
28-
def readable: ReadableProperty[A]
29-
3027
/** This method should be called when the value has changed. */
3128
protected[properties] def valueChanged(): Unit
3229

@@ -104,8 +101,6 @@ private[properties] trait AbstractReadableProperty[A] extends ReadableProperty[A
104101
if (parent != null) parent.listenersUpdate()
105102
}
106103

107-
override def readable: ReadableProperty[A] = this
108-
109104
override def transform[B](transformer: A => B): ReadableProperty[B] =
110105
new TransformedReadableProperty[A, B](this, transformer)
111106

guide/guide/.js/src/main/scala/io/udash/web/guide/views/ext/demo/bootstrap/BreadcrumbsDemo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object BreadcrumbsDemo extends AutoDemo with CssView {
1919
new Breadcrumb("Dev's Guide", Url("https://guide.udash.io/")),
2020
new Breadcrumb("Extensions", Url("https://guide.udash.io/")),
2121
new Breadcrumb("Bootstrap wrapper", Url("https://guide.udash.io/ext/bootstrap"))
22-
).readable
22+
)
2323

2424
div(
2525
UdashBreadcrumbs(pages)(

guide/guide/.js/src/main/scala/io/udash/web/guide/views/frontend/FrontendPropertiesView.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,6 @@ class FrontendPropertiesView extends View with CssView {
321321
|strings.clear()
322322
|// withIdx.get == Seq()""".stripMargin
323323
)(GuideStyles),
324-
h4("Ensuring readonly access"),
325-
p(
326-
"When you expose a property and you want to ensure that the exposed reference enables only the read access ",
327-
"use the ", i("_.readable"), " method which does not allow to modify the property by type casting. "
328-
),
329-
CodeBlock(
330-
"""val p: Property[Int] = Property(0)
331-
|val ro: ReadableProperty[Int] = p.readable""".stripMargin
332-
)(GuideStyles),
333324
h3("Immutable properties"),
334325
p(
335326
"GUI components may take numerous arguments defining their behaviour as the properties. ",

0 commit comments

Comments
 (0)