Package org.dwcj

Class App

java.lang.Object
org.dwcj.App
Direct Known Subclasses:
ButtonAlignment, ButtonDemo, ButtonDisable, ButtonExpanses, ButtonHelloWorld, WelcomeApp

public abstract class App extends Object
This is the central class representing an app. In order to implement an app, extend this class and override the run() method.
  • Constructor Details

    • App

      protected App()
  • Method Details

    • setTitle

      public static void setTitle(String title)
      Set the application title
      Parameters:
      title - The title to set
      Throws:
      DwcRuntimeException
    • getTitle

      public static String getTitle()
      Get the application title
      Returns:
      The title
      Throws:
      DwcRuntimeException
    • getApplicationName

      public static String getApplicationName()
      Get the registered DWC application name
      Returns:
      the application name
      Throws:
      DwcRuntimeException
    • setTheme

      public static void setTheme(String theme)
      Set the application theme
      Parameters:
      theme - The theme to set
      Throws:
      DwcRuntimeException
    • setTheme

      public static void setTheme(App.Theme theme)
      Set the application theme
      Parameters:
      theme - The theme to set
      Throws:
      DwcRuntimeException
      See Also:
    • getTheme

      public static String getTheme()
      Get the application theme
      Returns:
      The theme
      Throws:
      DwcRuntimeException
    • setDarkTheme

      public static void setDarkTheme(String darkTheme)
      Set the name of the dark theme to use for the application. The dark theme setting is used when the application theme is set to "system".
      Parameters:
      darkTheme - The dark theme to set
      Throws:
      DwcRuntimeException
    • getDarkTheme

      public static String getDarkTheme()
      Get the name of the dark theme
      Returns:
      The dark theme
      Throws:
      DwcRuntimeException
    • setLightTheme

      public static void setLightTheme(String lightTheme)
      Set the name of the light theme to use for the application. The light theme setting is used when the application theme is set to "system".
      Parameters:
      lightTheme - The light theme to set
      Throws:
      DwcRuntimeException
    • getLightTheme

      public static String getLightTheme()
      Get the name of the light theme to use for the application.
      Returns:
      The light theme
      Throws:
      DwcRuntimeException
    • setMeta

      public static void setMeta(String name, String content, Map<String,String> attributes)
      Set a meta tag
      Parameters:
      name - The name of the meta tag
      content - The content of the meta tag
      attributes - A map of attributes to set
      Throws:
      DwcRuntimeException
    • setMeta

      public static void setMeta(String name, String content, String attributes)
      Set a meta tag
      Parameters:
      name - The name of the meta tag
      content - The content of the meta tag
      attributes - A map of attributes to set (comma separated)
      Throws:
      DwcRuntimeException
    • setMeta

      public static void setMeta(String name, String content)
      Set a meta tag
      Parameters:
      name - The name of the meta tag
      content - The content of the meta tag
      Throws:
      DwcRuntimeException
    • setAttribute

      public static void setAttribute(String name, String value, String selector)
      Set an attribute on the document
      Parameters:
      name - The name of the attribute
      value - The value of the attribute
      selector - By default, setAttribute applies to the document element on the web page. If a selector is specified, it selects a descendant element within the document to set this attribute. If a specified selector doesn't return any elements, the default document element is used.
      Throws:
      DwcRuntimeException
    • setAttribute

      public static void setAttribute(String name, String value)
      Set an attribute on the document
      Parameters:
      name - The name of the attribute
      value - The value of the attribute
      Throws:
      DwcRuntimeException
    • setAttribute

      public static void setAttribute(String name)
      Set an attribute on the document
      Parameters:
      name - The name of the attribute
      Throws:
      DwcRuntimeException
    • getAttribute

      public static String getAttribute(String name, String selector)
      Get an attribute from the document
      Parameters:
      name - The name of the attribute
      selector - By default, setAttribute applies to the document element on the web page. If a selector is specified, it selects a descendant element within the document to set this attribute. If a specified selector doesn't return any elements, the default document element is used.
      Returns:
      The attribute value
      Throws:
      DwcRuntimeException
    • getAttribute

      public static String getAttribute(String name)
      Get an attribute from the document
      Parameters:
      name - The name of the attribute
      Returns:
      The attribute value
      Throws:
      DwcRuntimeException
    • addStyleSheet

      public static void addStyleSheet(String url, boolean top, Map<String,String> attributes)
      Inject a stylesheet into the page
      Parameters:
      url - The URL of the stylesheet
      top - Whether to inject the stylesheet at the top of the page
      attributes - A map of attributes to set
      Throws:
      DwcRuntimeException
    • addStyleSheet

      public static void addStyleSheet(String url, boolean top, String attributes)
      Inject a stylesheet into the page
      Parameters:
      url - The URL of the stylesheet
      top - Whether to inject the stylesheet at the top of the page
      attributes - A map of attributes to set (comma separated)
      Throws:
      DwcRuntimeException
    • addStyleSheet

      public static void addStyleSheet(String url, boolean top)
      Inject a stylesheet into the page
      Parameters:
      url - The URL of the stylesheet
      top - Whether to inject the stylesheet at the top of the page
      Throws:
      DwcRuntimeException
    • addStyleSheet

      public static void addStyleSheet(String url)
      Inject a stylesheet into the page
      Parameters:
      url - The URL of the stylesheet
      Throws:
      DwcRuntimeException
    • addInlineStyleSheet

      public static void addInlineStyleSheet(String css, boolean top, Map<String,String> attributes)
      Inject an inline stylesheet into the page
      Parameters:
      css - The CSS to inject
      top - Whether to inject the stylesheet at the top of the page
      attributes - A map of attributes to set
      Throws:
      DwcRuntimeException
    • addInlineStyleSheet

      public static void addInlineStyleSheet(String css, boolean top, String attributes)
      Inject an inline stylesheet into the page
      Parameters:
      css - The CSS to inject
      top - Whether to inject the stylesheet at the top of the page
      attributes - A map of attributes to set (comma separated)
      Throws:
      DwcRuntimeException
    • addInlineStyleSheet

      public static void addInlineStyleSheet(String css, boolean top)
      Inject an inline stylesheet into the page
      Parameters:
      css - The CSS to inject
      top - Whether to inject the stylesheet at the top of the page
      Throws:
      DwcRuntimeException
    • addInlineStyleSheet

      public static void addInlineStyleSheet(String css)
      Inject an inline stylesheet into the page
      Parameters:
      css - The CSS to inject
      Throws:
      DwcRuntimeException
    • addJavaScript

      public static void addJavaScript(String url, boolean top, Map<String,String> attributes)
      Inject a script into the page
      Parameters:
      url - The URL of the script
      top - Whether to inject the script at the top of the page
      attributes - A map of attributes to set
      Throws:
      DwcRuntimeException
    • addJavaScript

      public static void addJavaScript(String url, boolean top, String attributes)
      Inject a script into the page
      Parameters:
      url - The URL of the script
      top - Whether to inject the script at the top of the page
      attributes - A map of attributes to set (comma separated)
      Throws:
      DwcRuntimeException
    • addJavaScript

      public static void addJavaScript(String url, boolean top)
      Inject a script into the page
      Parameters:
      url - The URL of the script
      top - Whether to inject the script at the top of the page
      Throws:
      DwcRuntimeException
    • addJavaScript

      public static void addJavaScript(String url)
      Inject a script into the page
      Parameters:
      url - The URL of the script
      Throws:
      DwcRuntimeException
    • addInlineJavaScript

      public static void addInlineJavaScript(String script, boolean top, Map<String,String> attributes)
      Inject an inline script into the page
      Parameters:
      script - The script to inject
      top - Whether to inject the script at the top of the page
      attributes - A map of attributes to set
      Throws:
      DwcRuntimeException
    • addInlineJavaScript

      public static void addInlineJavaScript(String script, boolean top, String attributes)
      Inject an inline script into the page
      Parameters:
      script - The script to inject
      top - Whether to inject the script at the top of the page
      attributes - A map of attributes to set (comma separated)
      Throws:
      DwcRuntimeException
    • addInlineJavaScript

      public static void addInlineJavaScript(String script, boolean top)
      Inject an inline script into the page
      Parameters:
      script - The script to inject
      top - Whether to inject the script at the top of the page
      Throws:
      DwcRuntimeException
    • addInlineJavaScript

      public static void addInlineJavaScript(String script)
      Inject an inline script into the page
      Parameters:
      script - The script to inject
      Throws:
      DwcRuntimeException
    • addLink

      public static void addLink(String url, boolean top, Map<String,String> attributes)
      Inject a link into the page
      Parameters:
      url - The URL of the link
      top - Whether to inject the link at the top of the page
      attributes - A map of attributes to set
      Throws:
      DwcRuntimeException
    • addLink

      public static void addLink(String url, boolean top, String attributes)
      Inject a link into the page
      Parameters:
      url - The URL of the link
      top - Whether to inject the link at the top of the page
      attributes - A map of attributes to set (comma separated)
      Throws:
      DwcRuntimeException
    • addLink

      public static void addLink(String url, boolean top)
      Inject a link into the page
      Parameters:
      url - The URL of the link
      top - Whether to inject the link at the top of the page
      Throws:
      DwcRuntimeException
    • addLink

      public static void addLink(String url)
      Inject a link into the page
      Parameters:
      url - The URL of the link
      Throws:
      DwcRuntimeException
    • consoleLog

      public static void consoleLog(String output)
      Log a String to the browser console (console.out)
      Parameters:
      output - The message to log
    • consoleError

      public static void consoleError(String output)
    • msgbox

      public static int msgbox(String alert)
      Shows a message box
      Parameters:
      alert - The message to show
      Returns:
    • msgbox

      public static int msgbox(String alert, int options)
      Parameters:
      alert - The message to show
      options -
      Returns:
    • msgbox

      public static int msgbox(String alert, int options, String title)
      Parameters:
      alert - The message to show
      options -
      title -
      Returns:
    • busy

      public static void busy(boolean busy)
      Show or hide a busy indicator overlay
      Parameters:
      busy - A boolean value true=show false=hide
    • busy

      public static void busy(String busyText)
      show the busy indicator with the text passed to this method
      Parameters:
      busyText - the text to show
    • terminate

      public void terminate()
      Call this method to terminate your App.
    • cleanup

      public void cleanup()
      Override this method to implement custom cleanup e.g. kill all background threads that may still run
    • run

      public abstract void run() throws DwcException
      Override this method to implement your app behavior
      Throws:
      DwcAppInitializeException
      DwcException
    • getNamespace

      public static Namespace getNamespace(Namespace.NamespaceType namespaceType)
    • getNamespace

      public static Namespace getNamespace(String prefix, String name, Boolean fCreateIfMissing)