Class Project

java.lang.Object
com.smartgwt.client.core.BaseClass
com.smartgwt.client.rpc.Project
All Implemented Interfaces:
HasHandlers

public class Project extends BaseClass
Represents a Reify project loaded from the server via RPCManager.loadProject(). A project contains cached screens and DataSources that can be used to create actual screens by calling createScreen() or createStartScreen().
See Also:
  • Constructor Details

  • Method Details

    • getOrCreateRef

      public static Project getOrCreateRef(JavaScriptObject jsObj)
    • setJavaScriptObject

      public void setJavaScriptObject(JavaScriptObject jsObj)
      Overrides:
      setJavaScriptObject in class BaseClass
    • create

      public JavaScriptObject create()
      Specified by:
      create in class BaseClass
    • isCreated

      public boolean isCreated()
      Overrides:
      isCreated in class BaseClass
    • getJsObj

      public JavaScriptObject getJsObj()
      Overrides:
      getJsObj in class BaseClass
    • getOrCreateJsObj

      public JavaScriptObject getOrCreateJsObj()
      Overrides:
      getOrCreateJsObj in class BaseClass
    • createScreen

      public Canvas createScreen(String screenName)
      Creates a screen from screen definitions cached in the Project.
      Parameters:
      screenName - name of screen to create
      Returns:
      last top-level widget in the screen definition
      See Also:
    • createScreen

      public Canvas createScreen(String screenName, CreateScreenSettings settings)
      Creates a screen from screen definitions cached in the Project.
      Parameters:
      screenName - name of screen to create
      settings - widgets to allow to take their global IDs, or a widget remap config
      Returns:
      last top-level widget in the screen definition
      See Also:
    • createStartScreen

      public Canvas createStartScreen()
      Creates screen from first definition cached in the project.
      Returns:
      last top-level widget in the screen definition
      See Also:
    • createStartScreen

      public Canvas createStartScreen(CreateScreenSettings settings)
      Creates screen from first definition cached in the project.
      Parameters:
      settings - widgets to allow to take their global IDs, or a widget remap config
      Returns:
      last top-level widget in the screen definition
      See Also:
    • createStartScreen

      public Canvas createStartScreen(String settings)
      Creates screen from first definition cached in the project.
      Parameters:
      settings - widgets to allow to take their global IDs, or a widget remap config
      Returns:
      last top-level widget in the screen definition
      See Also:
    • createStartScreen

      public Canvas createStartScreen(String... settings)
      Creates screen from first definition cached in the project.
      Parameters:
      settings - widgets to allow to take their global IDs, or a widget remap config
      Returns:
      last top-level widget in the screen definition
      See Also:
    • destroy

      public void destroy()
      Releases cached screens and DataSources associated with this project, and unregisters it so get() no longer can find it by name. After destroying a project, it is an error to call any instance method on it.
      Overrides:
      destroy in class BaseClass
    • getDataSource

      public DataSource getDataSource(String ID)
      Returns an instance of the requested DataSource by creating it from the project's cache. If the ID is not globally bound, the framework will globally bind the instance before returning it.

      Note that when a screen cached in the project is created, all project DataSources in the screen will be automatically instantiated from the project cache, so this method need not be called before creating a screen just to ensure its DataSources are available.

      Parameters:
      ID - ID of the DataSource to create. See Identifier
      Returns:
      requested DataSource instance
      See Also:
    • getDataSourceNames

      public String[] getDataSourceNames()
      Return the names of the DataSources cached in this project.
      Returns:
      names of cached DataSources
    • getScreenNames

      public String[] getScreenNames()
      Return the names of the screens cached in this project.
      Returns:
      names of cached screens
      See Also:
    • isInReify

      public void isInReify(Function callback)
      Check whether this project is stored in Reify's project storage.
      Parameters:
      callback - called with (Boolean isStored)
    • loadInReify

      public void loadInReify(ReifyLoadConfig config, Function callback)
      Open this project in Reify for editing. The project must be stored in Reify's project storage; if not, a warning is logged and the call fails.
      Parameters:
      config - optional config for Reify.loadReify()
      callback - called with ReifyRemote
    • get

      public static Project get(String projectName)
      Returns a cached project given its name.
      Parameters:
      projectName - name of project to retrieve
      Returns:
      cached project, or null if it's not cached
    • createScreen

      public Canvas createScreen(String screenName, String[] globals)
      Parameters:
      screenName - name of screen to create
      globals - widgets to allow to take their global IDs, or a widget remap config
      Returns:
      last top-level widget in the screen definition