Class AbstractVueJS

java.lang.Object
io.github.jeemv.springboot.vuejs.AbstractVueJS
Direct Known Subclasses:
VueComponent, VueJS

public abstract class AbstractVueJS extends Object
AbstractVueJS This class is part of springBoot-VueJS
  • Field Details

  • Constructor Details

    • AbstractVueJS

      public AbstractVueJS()
  • Method Details

    • addData

      public void addData(String key, Object value)
      Adds a data
      Parameters:
      key - the name of the data
      value - the value
    • addDataRaw

      public void addDataRaw(String key, String value)
      Adds a data and the exact value without transformation
      Parameters:
      key - the name of the data
      value - the value
    • addData

      public void addData(String key)
      Declare a data
      Parameters:
      key - the name of the data
    • addMethod

      public VueMethod addMethod(String name)
      Adds a method
      Parameters:
      name - the method name
      Returns:
      the method
    • addMethod

      public VueMethod addMethod(String name, String body)
      Adds a method
      Parameters:
      name - the method name
      body - the method body (javascript)
      Returns:
      the method
    • addMethod

      public VueMethod addMethod(String name, String body, String... params)
      Adds a method with parameters
      Parameters:
      name - the method name
      body - the method body (javascript)
      params - the method parameters
      Returns:
      the method
    • addComputed

      public void addComputed(String name, String get, String set)
      Adds an editable computed property
      Parameters:
      name - the name of the computed property
      get - body of the getter
      set - body of the setter
    • addComputed

      public void addComputed(String name, String get)
      Adds a computed property
      Parameters:
      name - the name of the computed property
      get - body of the getter
    • attachWatcher

      public void attachWatcher(String variableName, String methodName, boolean deep, boolean immediate)
      Attaches an existing function for observing the variable The function must have the prototype function (oldVal, val)
      Parameters:
      variableName - the variable to observe
      methodName - the method that observes
      deep - if true, detect nested value changes inside Objects
      immediate - if true, the callback will be called immediately after the start of the observation
    • attachWatcher

      public void attachWatcher(String variableName, String methodName, boolean deep)
      Attaches an existing function for observing the variable The function must have the prototype function (oldVal, val)
      Parameters:
      variableName - the variable to observe
      methodName - the method that observes
      deep - if true, detect nested value changes inside Objects
    • attachWatcher

      public void attachWatcher(String variableName, String methodName)
      Attaches an existing function for observing the variable The function must have the prototype function (oldVal, val)
      Parameters:
      variableName - the variable to observe
      methodName - the method that observes
    • attachImmediateWatcher

      public void attachImmediateWatcher(String variableName, String methodName)
      Attaches an existing function for observing the variable, the callback will be called immediately after the start of the observation The function must have the prototype function (oldVal, val)
      Parameters:
      variableName - the variable to observe
      methodName - the method that observes
    • attachDeepWatcher

      public void attachDeepWatcher(String variableName, String methodName)
      Attaches an existing function for observing the variable, detect nested value changes inside Objects The function must have the prototype function (oldVal, val)
      Parameters:
      variableName - the variable to observe
      methodName - the method that observes
    • addWatcher

      public void addWatcher(String variableName, boolean deep, boolean immediate, String... handlers)
      Adds a watcher on variableName Handlers have oldVal and val as parameters
      Parameters:
      variableName - the variable to observe
      deep - if true, detect nested value changes inside Objects
      immediate - if true, the callback will be called immediately after the start of the observation
      handlers - the bodies of the methods that observe
    • addWatcher

      public void addWatcher(String variableName, boolean deep, String... handlers)
      Adds a watcher on variableName Handlers have oldVal and val as parameters
      Parameters:
      variableName - the variable to observe
      deep - if true, detect nested value changes inside Objects
      handlers - the bodies of the methods that observe
    • addWatcher

      public void addWatcher(String variableName, String... handlers)
      Adds a watcher on variableName Handlers have oldVal and val as parameters
      Parameters:
      variableName - the variable to observe
      handlers - the bodies of the methods that observe
    • addImmediateWatcher

      public void addImmediateWatcher(String variableName, String... handlers)
      Adds an immediate watcher on variableName, the callback will be called immediately after the start of the observation Handlers have oldVal and val as parameters
      Parameters:
      variableName - the variable to observe
      handlers - the bodies of the methods that observe
    • addDeepWatcher

      public void addDeepWatcher(String variableName, String... handlers)
      Adds a deep watcher on variableName, detect nested value changes inside Objects Handlers have oldVal and val as parameters
      Parameters:
      variableName - the variable to observe
      handlers - the bodies of the methods that observe
    • addHook

      protected void addHook(String name, String body)
    • addDirective

      public VueDirective addDirective(String name)
      Adds a new directive in the vue instance
      Parameters:
      name - The directive name
      Returns:
      The created directive
    • addDirective

      public VueDirective addDirective(String name, String shortHand)
      Adds a new directive in the vue instance
      Parameters:
      name - The directive name
      shortHand - Shorthand function for bind and update
      Returns:
      The created directive
    • addFilter

      public VueFilter addFilter(String name, String body, String... args)
      Adds a new filter in the vue instance
      Parameters:
      name - The filter name
      body - The method body
      args - The filter arguments
      Returns:
      The created filter
    • onBeforeCreate

      public void onBeforeCreate(String body)
      Adds code (body) for the beforeCreate hook
      Parameters:
      body - the code to execute
    • onCreated

      public void onCreated(String body)
      Adds code (body) for the created hook
      Parameters:
      body - the code to execute
    • onBeforeMount

      public void onBeforeMount(String body)
      Adds code (body) for the beforeMount hook
      Parameters:
      body - the code to execute
    • onMounted

      public void onMounted(String body)
      Adds code (body) for the mounted hook
      Parameters:
      body - the code to execute
    • onBeforeUpdate

      public void onBeforeUpdate(String body)
      Adds code (body) for the beforeUpdate hook
      Parameters:
      body - the code to execute
    • onUpdated

      public void onUpdated(String body)
      Adds code (body) for the updated hook
      Parameters:
      body - the code to execute
    • onUpdatedNextTick

      public void onUpdatedNextTick(String body)
      Adds code (body) for the updated hook wait until the entire view has been re-rendered with $nextTick
      Parameters:
      body - the code to execute
    • onBeforeDestroy

      public void onBeforeDestroy(String body)
      Adds code (body) for the beforeDestroy hook
      Parameters:
      body - the code to execute
    • onDestroyed

      public void onDestroyed(String body)
      Adds code (body) for the destroyed hook
      Parameters:
      body - the code to execute
    • getHooks

      public Map<String,VueHook> getHooks()
    • set

      public String set(String data, String value)
      Sets a new value to a data in the vueJS instance.
      Parameters:
      data - a data declared with addData method
      value - The value to be set
      Returns:
      the generated script (javascript)
    • get

      public String get(String data)
      Returns the data property
      Parameters:
      data - the data name
      Returns:
      the generated script (javascript)
    • cloneOriginalData

      public String cloneOriginalData(String from, String dataTo)
      Clone an object and save the original object on this.dataTo.original To use with assignOriginal
      Parameters:
      from - The object to clone
      dataTo - a data in vueJS instance
      Returns:
      the generated script (javascript)
    • assignOriginal

      public String assignOriginal(String originalData, String value)
      Assigns a value to an originalData cloned with cloneOriginalData
      Parameters:
      originalData - data declared on the vueJS instance
      value - the value to assign to this.originalData
      Returns:
      the generated script (javascript)
    • assignOriginalWithHttp

      public String assignOriginalWithHttp(String originalData)
      Assigns a value to an originalData cloned with cloneOriginalData using Http response.data
      Parameters:
      originalData - data declared on the vueJS instance
      Returns:
      the generated script (javascript)
    • getScript

      public abstract String getScript()
      Returns the generated script creating the instance
      Returns:
      the generated script (javascript)
    • getData

      public VueData getData()
    • getMethods

      public VueMethods getMethods()
    • getComputed

      public VueComputeds getComputed()
    • getDirectives

      public VueDirectives getDirectives()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getWatchers

      public VueWatchers getWatchers()
    • getFilters

      public VueFilters getFilters()