Package

ch.awae.mcddpui

api

Permalink

package api

package holding basic API traits and other core API functionality.

Some functionality of the scala API require implicit conversions. These implicits are all contained in the package object itself.

Version

1.2 (0.2.0), 2016-03-02

Since

MCDDPUI 0.1.0

Linear Supertypes
AnyRef, Any
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. api
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait CommandExecutor[T] extends AnyRef

    Permalink

    A handler that accepts commands and executes them.

    A handler that accepts commands and executes them.

    T

    the type of the data structure the executor operates on

    Version

    1.1 (0.1.0), 2016-02-26

    Since

    MCDDPUI 0.1.0

  2. trait CommandLike extends AnyRef

    Permalink

    Marker Trait for commands.

    Marker Trait for commands.

    Version

    1.1 (0.2.0), 2016-03-01

    Since

    MCDDPUI 0.2.0

  3. class ComposedMutationCommand[T, U, V] extends MutationCommand[T, V]

    Permalink

    A MutationCommand defined as the concatenation of two commands.

    A MutationCommand defined as the concatenation of two commands.

    T

    the input type

    U

    the intermediate type

    V

    the output type

    Version

    1.1 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.2.0

    Exceptions thrown

    NullPointerException if f or g is null.

  4. case class FunctionMutationCommand[T, U](ƒ: (T) ⇒ U, name: String = null) extends MutationCommand[T, U] with Product with Serializable

    Permalink

    A MutationCommand backed by a scala function

    A MutationCommand backed by a scala function

    T

    the input type

    U

    the output type

    ƒ

    the function the command is based off. may not be null.

    name

    the name of the command. may be null.

    Version

    1.1 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.2.0

    Exceptions thrown

    NullPointerException if ƒ is null

  5. class LambdaMutationCommand[T, U] extends MutationCommand[T, U]

    Permalink

    A MutationCommand backed by a java lambda

    A MutationCommand backed by a java lambda

    T

    the input type

    U

    the output type

    Version

    1.1 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.2.0

    Exceptions thrown

    NullPointerException if λ is null.

  6. trait ManagerCommand extends CommandLike

    Permalink

    A manager command is a command targeted at a CommandExecutor to influence the internal behaviour of the executor.

    A manager command is a command targeted at a CommandExecutor to influence the internal behaviour of the executor.

    They are not targeted at modification of the internal data structure. In fact this trait is a pure marker trait without any methods.

    Version

    1.2 (0.2.0), 2016-03-01

    Since

    MCDDPUI 0.1.0

  7. trait MutationCommand[T, U] extends CommandLike

    Permalink

    A mutation command represents a function transforming a given (immutable) data structure into another (immutable) data structure.

    A mutation command represents a function transforming a given (immutable) data structure into another (immutable) data structure. Any mutation may result in any arbitrary exception or error. Therefore error handling is necessary at the command execution site.

    T

    the input type

    U

    the output type

    Version

    1.4 (0.3.1), 2016-04-06

    Since

    MCDDPUI 0.1.0

    Note

    The implicit conversion methods function2mutationCommand and mutationCommand2function can be used to convert freely between types T => Unit and ReadCommand[T].

    ,

    Immutability of the data structure cannot be enforced. Therefore ensuring immutability (or at least apparent immutability) lies in the responsibility of the user.

  8. trait MutationFunction[T, U] extends AnyRef

    Permalink

    Functional Interface variant of the MutationCommand trait.

    Functional Interface variant of the MutationCommand trait.

    // Java: use implicitly as lambda with name
    MutationCommand<String, String> c0 = Command.get(s -> s.toUpperCase(), "toUpperCase");
    // Java: use implicitly as lambda without name. Name will be null by default
    MutationCommand<String, String> c1 = Command.get(s -> s.toUpperCase());
    Annotations
    @FunctionalInterface()
    Version

    1.1 (0.1.0), 2016-02-26

    Since

    MCDDPUI 0.1.0

  9. trait ReadCommand[T] extends CommandLike

    Permalink

    A read command represents a function inspecting a (preferably immutable) data structure without effect in said data structure.

    A read command represents a function inspecting a (preferably immutable) data structure without effect in said data structure. A read command may also have side-effects. A read command may result in any arbitrary exception or error. Therefore error handling is necessary at the command execution site. If a read command has side effects the command implementation must ensure a valid (preferably unaffected) state of any (potentially) affected resource.

    T

    the input type for the command

    Annotations
    @FunctionalInterface()
    Version

    1.3 (0.2.0), 2016-03-01

    Since

    MCDDPUI 0.1.0

    Note

    The implicit conversion methods function2readCommand and readCommand2function can be used to convert freely between types T => Unit and ReadCommand[T].

    ,

    Immutability of the data structure cannot be enforced. Therefore ensuring immutability (or at least ensuring the lack of any mutating operations on the data structure) lies in the responsibility of the user.

  10. trait Record[T] extends Serializable

    Permalink

    a record encapsulates an immutable data structure in a modifiable container with a modification history and undo/redo functionality

    a record encapsulates an immutable data structure in a modifiable container with a modification history and undo/redo functionality

    T

    the type of the encapsulated data structure

    Version

    1.2 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.1.0

    Note

    Immutability of the data structure cannot be enforced. Therefore ensuring immutability (or at least apparent immutability) lies in the responsibility of the user.

  11. case class RedoCommand(index: Int) extends ManagerCommand with Product with Serializable

    Permalink

    a command requesting the executor to redo a mutation

    a command requesting the executor to redo a mutation

    index

    the index of the desired redo path

    Version

    1.1 (0.2.0), 2016-03-01

    Since

    MCDDPUI 0.2.0

  12. case class TargetFocusRequestCommand(v: ViewData) extends ManagerCommand with Product with Serializable

    Permalink

    a command requesting focus for a given view

    a command requesting focus for a given view

    This command should only be used in multi-frame applications and should only be dispatched from the view representing the target ViewData.

    Version

    1.1 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.2.0

  13. case class UIData(viewStack: List[ViewData], props: HashMap[String, String] = HashMap.empty) extends Product with Serializable

    Permalink

    root object for the structural representation of the UI state in a UI application.

    root object for the structural representation of the UI state in a UI application. Contains a view stack and an immutable hash map for representing global UI state.

    viewStack

    the stack containing the view data representations in the order they are layered. (opaque layers!).

    props

    a hash map containing global UI properties

    Annotations
    @SerialVersionUID()
    Version

    1.1 (0.1.0), 2016-02-29

    Since

    MCDDPUI 0.1.0

  14. case class UIUniverse[T](data: T, ui: UIData) extends Product with Serializable

    Permalink

    data structure root node for UI applications.

    data structure root node for UI applications.

    Holds the operational data as well as an abstract representation encoding the state of the UI. This allows for full historizing not only operational data but for UI state changes as well.

    T

    the data type of the operational data

    data

    the operational data

    ui

    the UI state representation

    Annotations
    @SerialVersionUID()
    Version

    1.1 (0.1.0), 2016-02-29

    Since

    MCDDPUI 0.1.0

  15. trait View[T] extends AnyRef

    Permalink

    base trait for all views.

    base trait for all views.

    This trait does not discriminate between multi-frame and single-view UI solutions.

    View Life-Cycle

    A view be either unbound or bound and unpacked or packed.

    The binding state of a view describes whether or not a view is bound to a CommandExecutor. Whenever a view is unbound, no reference to an executor may be retained and no commands may be dispatched from the view. Whenever a view is bound, it must retain a reference to exactly one executor. This is the executor the view may dispatch commands to. As long as a view is bound, it may dispatch commands.

    The packing state of a view describes whether or not a view is active. An active (unpacked) view must be visible and focused. Interactions with the view are allowed, and the view must be bound. At any time exactly one view may be active. An inactive (packed) view may be visible or invisible, however no direct interaction with the view is allowed. An inactive view may therefore never dispatch any commands - even when bound. There is however one exception to this rule:

    • Since only one view can be active at once, unfocused frames in a multi-frame UI are packed. A view in an unfocused frame may request focus when clicked on. This is necessary to be able to keep the data structure synchronised with the UI. For this use the command TargetFocusRequestCommand is provided. This is the only command that may be issued from an inactive view.
    Transitions
    1. When starting the application, all views should be constructed and initialised as far as possible. After startup all views should be packed and unbound
    2. When a view enters the view stack, it is bound but remains packed
    3. When a view reaches the top of the stack, it is bound and unpacked
    4. When a view leaves the top of the stack, it is bound and packed
    5. When a view leaves the view stack, it is unbound and packed
    Updates

    During UI updates the views are updated in the order they appear in the view stack. If a view is applicable to multiple entries in the view stack, the top-most one will be used. If multiple view are applicable to the same entry, the first matching view is used. The views are checked in the order they were registered.

    The update cycle operates according to a simple procedure:

    1. Try to assign a view to every entry in the view stack. Entries near the head of the view stack are prioritised, and views are prioritised in the order they were registered.
    2. Assert that the top-most entry of the view stack has a view assigned.
    3. Pack the view that was previously assigned to the top-most entry of the stack if it it is not again assigned to the top-most element.
    4. Unbind all views that were assigned previously, that have no (new assignment).
    5. Update all assigned views.
    6. Bind all views that previously had no assignment.
    7. Unpack the view assigned to the top-most element if it is packed.
    T

    the data type of the data structure

    Version

    1.1 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.2.0

  16. final class ViewCommandExecutor[T] extends CommandExecutor[UIUniverse[T]]

    Permalink

    command executor for view interaction that checks if a view is in a legal state for sending commands.

    command executor for view interaction that checks if a view is in a legal state for sending commands.

    Annotations
    @throws( ... )
    Version

    1.1 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.2.0

    Exceptions thrown

    NullPointerException if backer or view is null

    See also

    View for complete documentation

  17. trait ViewData extends Serializable

    Permalink

    common base trait for all view data objects.

    common base trait for all view data objects.

    A view data object represents a particular UI state in the internal data structure of a UI application. implementations of this trait should always be immutable to allow for proper thread-safe object sharing in multi-threaded applications.

    Version

    1.1 (0.1.0), 2016-02-29

    Since

    MCDDPUI 0.1.0

  18. final class ViewManager[T] extends ViewManagerLike[T]

    Permalink

    core view life-cycle management

    core view life-cycle management

    T

    the type of the data structure

    Annotations
    @throws( ... )
    Version

    1.2 (0.3.0), 2016-03-24

    Since

    MCDDPUI 0.2.0

    Exceptions thrown

    NullPointerException if the executor is null

    See also

    View for full life-cycle documentation

  19. trait ViewManagerLike[T] extends AnyRef

    Permalink

    core view life-cycle management base trait.

    core view life-cycle management base trait.

    T

    the type of the data structure

    Version

    1.1 (0.3.0), 2016-03-24

    Since

    MCDDPUI 0.3.0

    See also

    View for full life-cycle documentation

Value Members

  1. object Command

    Permalink

    Command Helper

    Command Helper

    This object contains command getters useful for command instantiation through java lambda definitions. Also getters for the undo and redo commands are provided that map back to the corresponding singleton objects

    Version

    1.3 (0.2.0), 2016-03-02

    Since

    MCDDPUI 0.1.0

    Note

    this object is designed for usage with java

  2. object UndoCommand extends ManagerCommand with Product with Serializable

    Permalink

    a command requesting the executor to undo a mutation

    a command requesting the executor to undo a mutation

    Version

    1.1 (0.2.0), 2016-03-01

    Since

    MCDDPUI 0.2.0

  3. implicit def function2mutationCommand[T, U](f: (T) ⇒ U): MutationCommand[T, U]

    Permalink

    converts a scala function into a MutationCommand.

    converts a scala function into a MutationCommand.

    T

    the input type of the command

    U

    the output type of the command

    f

    the function to be converted into a MutationCommand. May not be null.

    returns

    a MutationCommand based off the function f

    Example:
    1. import ch.waan.mcddpui.api._
      val c0: MutationCommand[String, String] = (s: String) => s.toUpperCase
      val c1: MutationCommand[String, String] = (_: String).toUpperCase
    Since

    MCDDPUI 0.1.0

    Exceptions thrown

    NullPointerException if f is null

  4. implicit def function2readCommand[T](f: (T) ⇒ Unit): ReadCommand[T]

    Permalink

    converts a scala function into a ReadCommand.

    converts a scala function into a ReadCommand.

    T

    the input type of the command

    f

    the function to be converted into a ReadCommand. May not be null.

    returns

    a ReadCommand based off the function f

    Example:
    1. import ch.waan.mcddpui.api._
      val c0: ReadCommand[String] = (s: String) => println(s)
      val c1: ReadCommand[String] = println(_: String)
    Since

    MCDDPUI 0.1.0

    Exceptions thrown

    NullPointerException if f is null

  5. implicit def functionNameTuple2mutationCommand[T, U](τ: ((T) ⇒ U, String)): MutationCommand[T, U]

    Permalink

    converts a tuple with a scala function and a naming string into a MutationCommand.

    converts a tuple with a scala function and a naming string into a MutationCommand.

    T

    the input type of the command

    U

    the output type of the command

    τ

    the tuple containing a function, and a name string

    Since

    MCDDPUI 0.2.0

    Exceptions thrown

    NullPointerException if τ is null or the function provided through τ is null

  6. implicit def mutatefunc2command[T, U](f: MutationFunction[T, U]): MutationCommand[T, U]

    Permalink

    converts a MutationFunction instance into a mutation command without a name.

    converts a MutationFunction instance into a mutation command without a name.

    Since

    MCDDPUI 0.2.0

  7. implicit def mutationCommand2function[T, U](c: MutationCommand[T, U]): (T) ⇒ U

    Permalink

    converts a MutationCommand into a scala function.

    converts a MutationCommand into a scala function.

    T

    the input type of the command

    U

    the output type of the command

    c

    the command to be converted into a function. May not be null.

    returns

    a function based off the command c

    Since

    MCDDPUI 0.1.0

    Exceptions thrown

    NullPointerException if c is null

  8. implicit def readCommand2function[T](c: ReadCommand[T]): (T) ⇒ Unit

    Permalink

    converts a ReadCommand into a scala function.

    converts a ReadCommand into a scala function.

    T

    the input type of the command

    c

    the command to be converted into a function. May not be null.

    returns

    a function based off the command c

    Since

    MCDDPUI 0.1.0

    Exceptions thrown

    NullPointerException if c is null

Inherited from AnyRef

Inherited from Any

Ungrouped