Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class FlinkZeppelinContext(val flinkInterpreter: FlinkScalaInterpreter,

private def angularWatch(name: String, noteId: String, func: (AnyRef, AnyRef) => Unit): Unit = {
val w = new AngularObjectWatcher(getInterpreterContext) {
override def watch(oldObject: Any, newObject: AnyRef, context: InterpreterContext): Unit = {
override def watch(oldObject: AnyRef, newObject: AnyRef, context: InterpreterContext): Unit = {
func(newObject, newObject)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import scala.xml._
*/
abstract class AbstractAngularElem(val interpreterContext: InterpreterContext,
val modelName: String,
val angularObjects: Map[String, AngularObject[Any]],
val angularObjects: Map[String, AngularObject],
prefix: String,
label: String,
attributes1: MetaData,
Expand Down Expand Up @@ -70,7 +70,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext,
* @return
*/
@ZeppelinApi
def model(name: String, value: Any): AbstractAngularElem = {
def model(name: String, value: AnyRef): AbstractAngularElem = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val registry = interpreterContext.getAngularObjectRegistry

// create AngularFunction in current paragraph
Expand All @@ -79,7 +79,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext,
Null)

val angularObject = addAngularObject(name, value)
.asInstanceOf[AngularObject[Any]]
.asInstanceOf[AngularObject]

newElem(
interpreterContext,
Expand Down Expand Up @@ -111,7 +111,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext,
* @return
*/
@ZeppelinApi
def model(): Any = {
def model(): AnyRef = {
if (angularObjects.contains(modelName)) {
angularObjects(modelName).get()
} else {
Expand All @@ -134,10 +134,10 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext,
Text(s"${functionName}=${functionName} + 1"),
Null)

val angularObject = addAngularObject(functionName, 0)
val angularObject = addAngularObject(functionName, Int.box(0))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place where I am not sure that this is completely correct.


angularObject.addWatcher(new AngularObjectWatcher(interpreterContext) {
override def watch(oldObject: scala.Any, newObject: scala.Any, context: InterpreterContext)
override def watch(oldObject: AnyRef, newObject: AnyRef, context: InterpreterContext)
:Unit = {
InterpreterContext.set(interpreterContext)
callback()
Expand All @@ -151,11 +151,11 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext,
elem)
}

protected def addAngularObject(name: String, value: Any): AngularObject[Any]
protected def addAngularObject(name: String, value: AnyRef): AngularObject

protected def newElem(interpreterContext: InterpreterContext,
name: String,
angularObjects: Map[String, AngularObject[Any]],
angularObjects: Map[String, AngularObject],
elem: scala.xml.Elem): AbstractAngularElem

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ abstract class AbstractAngularModel(name: String) {
* @param newValue value
*/
@ZeppelinApi
def this(name: String, newValue: Any) = {
def this(name: String, newValue: AnyRef) = {
this(name)
value(newValue)
}

protected def getAngularObject(): AngularObject[Any]
protected def addAngularObject(value: Any): AngularObject[Any]
protected def getAngularObject(): AngularObject
protected def addAngularObject(value: AnyRef): AngularObject

/**
* Get value of the model
*
* @return
*/
@ZeppelinApi
def apply(): Any = {
def apply(): AnyRef = {
value()
}

Expand All @@ -59,7 +59,7 @@ abstract class AbstractAngularModel(name: String) {
* @return
*/
@ZeppelinApi
def value(): Any = {
def value(): AnyRef = {
val angularObject = getAngularObject()
if (angularObject == null) {
None
Expand All @@ -69,7 +69,7 @@ abstract class AbstractAngularModel(name: String) {
}

@ZeppelinApi
def apply(newValue: Any): Unit = {
def apply(newValue: AnyRef): Unit = {
value(newValue)
}

Expand All @@ -80,7 +80,7 @@ abstract class AbstractAngularModel(name: String) {
* @param newValue
*/
@ZeppelinApi
def value(newValue: Any): Unit = {
def value(newValue: AnyRef): Unit = {
var angularObject = getAngularObject()
if (angularObject == null) {
// create new object
Expand All @@ -92,7 +92,7 @@ abstract class AbstractAngularModel(name: String) {
}

@ZeppelinApi
def remove(): Any = {
def remove(): AnyRef = {
val angularObject = getAngularObject()

if (angularObject == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import scala.xml._
*/
class AngularElem(override val interpreterContext: InterpreterContext,
override val modelName: String,
override val angularObjects: Map[String, AngularObject[Any]],
override val angularObjects: Map[String, AngularObject],
prefix: String,
label: String,
attributes1: MetaData,
Expand All @@ -40,15 +40,15 @@ class AngularElem(override val interpreterContext: InterpreterContext,
interpreterContext, modelName, angularObjects, prefix, label, attributes1, scope,
minimizeEmpty, child: _*) {

override protected def addAngularObject(name: String, value: Any): AngularObject[Any] = {
override protected def addAngularObject(name: String, value: AnyRef): AngularObject = {
val registry = interpreterContext.getAngularObjectRegistry
registry.add(name, value, interpreterContext.getNoteId, null).asInstanceOf[AngularObject[Any]]
registry.add(name, value, interpreterContext.getNoteId, null).asInstanceOf[AngularObject]

}

override protected def newElem(interpreterContext: InterpreterContext,
name: String,
angularObjects: Map[String, AngularObject[Any]],
angularObjects: Map[String, AngularObject],
elem: scala.xml.Elem): angular.AbstractAngularElem = {
new AngularElem(
interpreterContext,
Expand All @@ -68,7 +68,7 @@ object AngularElem {

implicit def Elem2AngularDisplayElem(elem: Elem): AbstractAngularElem = {
new AngularElem(InterpreterContext.get(), null,
Map[String, AngularObject[Any]](),
Map[String, AngularObject](),
elem.prefix, elem.label, elem.attributes, elem.scope, elem.minimizeEmpty, elem.child:_*);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ import org.apache.zeppelin.interpreter.InterpreterContext
class AngularModel(name: String)
extends org.apache.zeppelin.display.angular.AbstractAngularModel(name) {

def this(name: String, newValue: Any) = {
def this(name: String, newValue: AnyRef) = {
this(name)
value(newValue)
}

override protected def getAngularObject(): AngularObject[Any] = {
registry.get(name, context.getNoteId, null).asInstanceOf[AngularObject[Any]]
override protected def getAngularObject(): AngularObject = {
registry.get(name, context.getNoteId, null).asInstanceOf[AngularObject]
}

override protected def addAngularObject(value: Any): AngularObject[Any] = {
registry.add(name, value, context.getNoteId, null).asInstanceOf[AngularObject[Any]]
override protected def addAngularObject(value: AnyRef): AngularObject = {
registry.add(name, value, context.getNoteId, null).asInstanceOf[AngularObject]
}
}

Expand All @@ -46,7 +46,7 @@ object AngularModel {
new AngularModel(name)
}

def apply(name: String, newValue: Any): AbstractAngularModel = {
def apply(name: String, newValue: AnyRef): AbstractAngularModel = {
new AngularModel(name, newValue)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import scala.xml._
*/
class AngularElem(override val interpreterContext: InterpreterContext,
override val modelName: String,
override val angularObjects: Map[String, AngularObject[Any]],
override val angularObjects: Map[String, AngularObject],
prefix: String,
label: String,
attributes1: MetaData,
Expand All @@ -41,16 +41,16 @@ class AngularElem(override val interpreterContext: InterpreterContext,
interpreterContext, modelName, angularObjects, prefix, label, attributes1, scope,
minimizeEmpty, child: _*) {

override protected def addAngularObject(name: String, value: Any): AngularObject[Any] = {
override protected def addAngularObject(name: String, value: Object): AngularObject = {
val registry = interpreterContext.getAngularObjectRegistry
registry.add(name, value, interpreterContext.getNoteId, interpreterContext.getParagraphId)
.asInstanceOf[AngularObject[Any]]
.asInstanceOf[AngularObject]

}

override protected def newElem(interpreterContext: InterpreterContext,
name: String,
angularObjects: Map[String, AngularObject[Any]],
angularObjects: Map[String, AngularObject],
elem: scala.xml.Elem): angular.AbstractAngularElem = {
new AngularElem(
interpreterContext,
Expand All @@ -70,7 +70,7 @@ object AngularElem {

implicit def Elem2AngularDisplayElem(elem: Elem): AbstractAngularElem = {
new AngularElem(InterpreterContext.get(), null,
Map[String, AngularObject[Any]](),
Map[String, AngularObject](),
elem.prefix, elem.label, elem.attributes, elem.scope, elem.minimizeEmpty, elem.child:_*);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ import org.apache.zeppelin.display.angular.AbstractAngularModel
class AngularModel(name: String)
extends org.apache.zeppelin.display.angular.AbstractAngularModel(name) {

def this(name: String, newValue: Any) = {
def this(name: String, newValue: AnyRef) = {
this(name)
value(newValue)
}

override protected def getAngularObject(): AngularObject[Any] = {
override protected def getAngularObject(): AngularObject = {
registry.get(name,
context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject[Any]]
context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject]
}

override protected def addAngularObject(value: Any): AngularObject[Any] = {
override protected def addAngularObject(value: AnyRef): AngularObject = {
registry.add(name, value,
context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject[Any]]
context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject]
}
}

Expand All @@ -47,7 +47,7 @@ object AngularModel {
new AngularModel(name)
}

def apply(name: String, newValue: Any): AbstractAngularModel = {
def apply(name: String, newValue: AnyRef): AbstractAngularModel = {
new AngularModel(name, newValue)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ trait AbstractAngularElemTest

// simulate click
def fireEvent(eventName: String, elem: org.apache.zeppelin.display.angular.AbstractAngularElem) = {
val angularObject: AngularObject[Any] = elem.angularObjects(eventName);
val angularObject: AngularObject = elem.angularObjects(eventName);
angularObject.set("event");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ with BeforeAndAfter with BeforeAndAfterEach with Eventually {
}

def angularModel(name: String): AbstractAngularModel
def angularModel(name: String, value: Any): AbstractAngularModel
def angularModel(name: String, value: AnyRef): AbstractAngularModel

"AngularModel" should "able to create AngularObject" in {
val registry = InterpreterContext.get().getAngularObjectRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AngularModelTest extends AbstractAngularModelTest {
AngularModel(name)
}

override def angularModel(name: String, value: Any): AbstractAngularModel = {
override def angularModel(name: String, value: AnyRef): AbstractAngularModel = {
AngularModel(name, value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AngularModelTest extends AbstractAngularModelTest {
AngularModel(name)
}

override def angularModel(name: String, value: Any): AbstractAngularModel = {
override def angularModel(name: String, value: AnyRef): AbstractAngularModel = {
AngularModel(name, value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class SparkZeppelinContext(val sc: SparkContext,

private def angularWatch(name: String, noteId: String, func: (AnyRef, AnyRef) => Unit): Unit = {
val w = new AngularObjectWatcher(getInterpreterContext) {
override def watch(oldObject: Any, newObject: AnyRef, context: InterpreterContext): Unit = {
override def watch(oldObject: AnyRef, newObject: AnyRef, context: InterpreterContext): Unit = {
func(newObject, newObject)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class SparkZeppelinContext(val sc: SparkContext,

private def angularWatch(name: String, noteId: String, func: (AnyRef, AnyRef) => Unit): Unit = {
val w = new AngularObjectWatcher(getInterpreterContext) {
override def watch(oldObject: Any, newObject: AnyRef, context: InterpreterContext): Unit = {
override def watch(oldObject: AnyRef, newObject: AnyRef, context: InterpreterContext): Unit = {
func(newObject, newObject)
}
}
Expand Down
Loading
Loading