Class Reify

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasMembersChangedHandlers

public class Reify extends VLayout
An application available within Reify OnSite that allows developers to create and manage Smart GWT screens and datasources. Only internal framework code can create an instance of the Reify tool - do not try it directly in your applications. If you want to create visual tools similar to Reify, see the Dashboards & Tools framework overview.

Note that in the Smart GWT SDK, this class present only to provide Reify utility class method APIs, and is not an instantiable widget. For example, you can call getMockDS() to export a DataSource as XML-formatted values and metadata for importing into Reify to create a MockDataSource.

See Also:
  • Constructor Details

  • Method Details

    • getOrCreateRef

      public static Reify getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class VLayout
    • setProjectDataSource

      public Reify setProjectDataSource(DataSource projectDataSource) throws IllegalStateException
      The DataSource to use for saving the project, using fileSource operations. If not set, the property defaults to "vbProjects" except in hostedMode where "isc_hostedProjects" is the default.
      Parameters:
      projectDataSource - New projectDataSource value. Default value is null
      Returns:
      Reify instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getProjectDataSource

      public DataSource getProjectDataSource()
      The DataSource to use for saving the project, using fileSource operations. If not set, the property defaults to "vbProjects" except in hostedMode where "isc_hostedProjects" is the default.
      Returns:
      Current projectDataSource value. Default value is null
      See Also:
    • setProjectDataSource

      public Reify setProjectDataSource(String projectDataSource) throws IllegalStateException
      The DataSource to use for saving the project, using fileSource operations. If not set, the property defaults to "vbProjects" except in hostedMode where "isc_hostedProjects" is the default.
      Parameters:
      projectDataSource - New projectDataSource value. Default value is null
      Returns:
      Reify instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getProjectDataSourceAsString

      public String getProjectDataSourceAsString()
      The DataSource to use for saving the project, using fileSource operations. If not set, the property defaults to "vbProjects" except in hostedMode where "isc_hostedProjects" is the default.
      Returns:
      Current projectDataSource value. Default value is null
      See Also:
    • loadProject

      public void loadProject(String projectName)
      Loads an existing project from projectDataSource within Reify making it the current project. If project cannot be found a new project will be created and loaded.

      The last accessed screen within the project is restored to the current screen.

      Parameters:
      projectName - the name of the project to load
    • loadProject

      public void loadProject(String projectName, String ownerId)
    • loadProject

      public void loadProject(String projectName, String ownerId, Function callback)
      Loads an existing project from projectDataSource within Reify making it the current project. If project cannot be found a new project will be created and loaded.

      The last accessed screen within the project is restored to the current screen.

      Parameters:
      projectName - the name of the project to load
      ownerId - optional ID of the project owner
      callback - optional callback to fire when the project has been loaded
    • getMockDS

      public static void getMockDS(String[] dsNames, MockDSExportCallback callback, MockDSExportSettings settings)
      Exports or serializes the specified DataSources using the provided settings.

      The "reifyCSV" format generates comma-separated values to paste into the DataSource creation wizard in Reify. The use case for the other two formats is, if you have a Smart GWT application, and you plan to load MockDataSources to enable people to add screens to your application using Reify, you may want to test your application with the MockDataSources to ensure they have the right data to allow your application to function (for example, that records in one MockDataSource that are related to another MockDataSource match up). Similarly, you may want to test any custom classes that you upload to Reify in a standalone file using MockDataSources.

      You can customize the settings, such as numRows (or numLevels for tree-DataSources) to keep the data volume returned by the export low. When related DataSources are present, all related records will be included in the export, even if numRows is exceeded. If this is too much data, criteria can be used to further restrict exported records. Note that settings supports an array of requestProperties, so that you can provide unique configuration for each DataSource being exported, rather than only global configuration.

      Unless you need programmatic or expert control over the settings, you will likely find it easier to use the "Reify Export" button in the DataSources tab. as when using that route, useful global and per-DataSources settings can be configured in an intuitively-arranged popup dialog.

      Parameters:
      dsNames - IDs of the desired DataSources
      callback - called with the complete export or serialization
      settings - controls format and what records and metadata to include
      See Also:
    • loadProject

      public static void loadProject(String projectNames, LoadProjectCallback callback, LoadProjectSettings settings)
      Loads projects from the Reify server specified by serverURL (or LoadProjectSettings.serverURL) using the ProjectLoaderServlet, reachable at the relative path projectLoaderPath (or LoadProjectSettings.projectLoaderPath) underneath the server URL, and fires the given callback after the project has been cached. When a project is loaded, all of its DataSources and screens (except where explicitly overridden by settings) are also cached in the project.

      See RPCManager.loadProject() for further details.

      Parameters:
      projectNames - Comma-separated string containing the names of project(s) to load.
      callback - Callback for notification of completion of project(s) loaded and screens cached.
      settings - Settings applicable to the loadProject operation.
      See Also:
    • loadSavedProject

      public static void loadSavedProject(String path, LoadProjectCallback callback)
      Loads a Project from a file on the server previously saved by saveProject(), without contacting a Reify server.

      A saved project file is a JSON envelope containing each screen and DataSource definition. Each definition includes the JavaScript component code (the code property) and, when the project was originally loaded with includeXML:true, the original XML source as well (the xml property). Both representations are preserved through save/load round-trips.

      The resulting Project is cached the same way as one loaded via loadProject(), and screens can be created via Project.createScreen().

      Parameters:
      path - server path relative to the webRoot (e.g. "shared/myApp.proj.json")
      callback - called with the loaded Project
      See Also:
    • loadSavedProject

      public static void loadSavedProject(String path, LoadProjectCallback callback, LoadProjectSettings settings)
      Loads a Project from a file on the server previously saved by saveProject(), without contacting a Reify server.

      A saved project file is a JSON envelope containing each screen and DataSource definition. Each definition includes the JavaScript component code (the code property) and, when the project was originally loaded with includeXML:true, the original XML source as well (the xml property). Both representations are preserved through save/load round-trips.

      The resulting Project is cached the same way as one loaded via loadProject(), and screens can be created via Project.createScreen().

      Parameters:
      path - server path relative to the webRoot (e.g. "shared/myApp.proj.json")
      callback - called with the loaded Project
      settings - optional settings for project loading
      See Also:
    • saveProject

      public static void saveProject(Project project, String path)
      Saves a loaded Project to a file on the server, using the saveFile built-in RPC. The file can later be loaded via loadSavedProject() to recreate the project without contacting a Reify server.

      By default, the saved format is determined by how the project was loaded. If the project was loaded with includeXML:true, only the original XML definitions are saved — these are the verbatim strings from the Reify server, with no re-serialization or round-tripping. Otherwise, the JavaScript component code is saved.

      The optional format parameter overrides this default:

      • "json" – saves only the JavaScript code representation
      • "xml" – saves only the xml representation. Requires includeXML:true to have been set when the project was loaded.
      • "both" – saves both code and xml (when present)

      Note: Project.createScreen() requires the code property. Files saved with only xml (the default when includeXML was used, or format "xml") cannot be loaded via loadSavedProject() for screen creation. Use format "both" or "json" to produce a file suitable for loadSavedProject().

      The saveFile built-in method must be enabled in server.properties:

        RPCManager.enabledBuiltinMethods: saveFile
        
      Parameters:
      project - a loaded project
      path - server path relative to the webRoot (e.g. "shared/myApp.proj.json")
      See Also:
    • saveProject

      public static void saveProject(Project project, String path, DSCallback callback)
    • saveProject

      public static void saveProject(Project project, String path, DSCallback callback, String format)
      Saves a loaded Project to a file on the server, using the saveFile built-in RPC. The file can later be loaded via loadSavedProject() to recreate the project without contacting a Reify server.

      By default, the saved format is determined by how the project was loaded. If the project was loaded with includeXML:true, only the original XML definitions are saved — these are the verbatim strings from the Reify server, with no re-serialization or round-tripping. Otherwise, the JavaScript component code is saved.

      The optional format parameter overrides this default:

      • "json" – saves only the JavaScript code representation
      • "xml" – saves only the xml representation. Requires includeXML:true to have been set when the project was loaded.
      • "both" – saves both code and xml (when present)

      Note: Project.createScreen() requires the code property. Files saved with only xml (the default when includeXML was used, or format "xml") cannot be loaded via loadSavedProject() for screen creation. Use format "both" or "json" to produce a file suitable for loadSavedProject().

      The saveFile built-in method must be enabled in server.properties:

        RPCManager.enabledBuiltinMethods: saveFile
        
      Parameters:
      project - a loaded project
      path - server path relative to the webRoot (e.g. "shared/myApp.proj.json")
      callback - called on completion
      format - "json", "xml", "both", or null for auto-detect
      See Also:
    • setPassword

      public static void setPassword(String password)
      Setter for password.
      Parameters:
      password -
    • setProjectLoaderPath

      public static void setProjectLoaderPath(String path)
      Setter for projectLoaderPath.
      Parameters:
      path -
    • setServerURL

      public static void setServerURL(String serverURL)
      Setter for serverURL.
      Parameters:
      serverURL - . See URL
      See Also:
    • setUserName

      public static void setUserName(String userName)
      Setter for userName.
      Parameters:
      userName -
    • showMockDS

      public static void showMockDS(String[] dsNames, MockDSExportCallback callback, MockDSExportSettings settings)
      Shows the result of running getMockDS() in a modal window so it can be copied and pasted as needed into Reify or elsewhere.

      Note that the callback is fired when the window is closed, not when it's populated.

      Parameters:
      dsNames - IDs of the desired DataSources
      callback - called with the complete export or serialization
      settings - controls format and what records and metadata to include
    • setDefaultProperties

      public static void setDefaultProperties(Reify reifyProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      reifyProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • getOrCreateJsObj

      public JavaScriptObject getOrCreateJsObj()
      Overrides:
      getOrCreateJsObj in class BaseWidget
    • onInit

      protected void onInit()
      Overrides:
      onInit in class Layout
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(ReifyLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class VLayout