ProvideX OOP Overview

Object Oriented Programming in ProvideX

The ProvideX language has been extended to support all of the key design principles of Object Oriented Programming (OOP).

The three basic principles of OOP are Encapsulation, Inheritance, and Polymorphism. These concepts provide a major part of the framework used to create and interact with objects. ProvideX OOP objects are defined through the use of classes. A class defines the name given to the object definition, as well as the object's properties and methods. Properties are the data portion of the object, consisting of fields or variables. Methods (or functions) are the actions that the object will perform. The defined properties/methods are accessible via the Apostrophe Operator.

Directives and Functions used to handle OOP mechanisms in ProvideX

DEF CLASS

Use the DEF CLASS directive in Object Oriented Programming (OOP) to declare the start of an object definition. It defines the name of the object and it can be used to override object creation and deletion logic.

class$ specifies the class name that will refer to this type of object. Class names are case-insensitive and forward/backward slashes are considered equivalent. Duplicate names are not allowed within the system. An object declared as UNIQUE will have a single instance created, and any subsequent attempt to create an instance returns the same object identifier and increments the object reference count by one.

By default, an object can have ON_CREATE and/or ON_DELETE logic defined. You can override this by specifying new label names for the creation/deletion logic via CREATE label and DELETE label clauses in the class definition. Normally, object creation/deletion logic is invoked when an object of this specific class is created/destroyed. That means, if you have ON_CREATE logic for an object A and object B inherits it, then the ON_CREATE for object A will not be executed on creation of object B. You can force creation and/or deletion logic to be executed on inheritance by including the keyword REQUIRED.

In terms of precedence, if an object inherits another object that has creation logic, the creation logic for the inherited object is performed first; e.g., if object C inherited object B which inherited object A, then the ON_CREATE in object A would be performed first, followed by object B's and finally object C's. (Deletion logic is performed in the opposite order).

PROPERTY

The PROPERTY directive is used in Object Oriented Programming to declare the properties that can be accessed by the application program. These properties can be treated like any other variable in the system and are accessible using the Apostrophe Operator.

LOCAL

The LOCAL directive is used to reassign variable names temporarily within a called procedure, without affecting the original contents (if any). In Object Oriented Programming (OOP), the LOCAL directive is similar to the PROPERTY directive, but is used to declare data that is only visible to processing logic within the object itself.

FUNCTION

The FUNCTION directive is used to declare a method for an object in Object Oriented Programming (OOP). Associated logic is to be called when the method is invoked.

LIKE

The LIKE directive is used in Object Oriented Programming (OOP) to inherit the properties from one or more other classes. All properties and methods are inherited from the specified classes.

STATIC

In Object Oriented Programming (OOP), the STATIC directive is used to create variables for use within an object at runtime -- basically, STATIC is used to extend the list of LOCAL properties. This allows for the dynamic creation of variables which are visible to operations within an object, yet which are not directly accessible to outside code.

DROP OBJECT

The DROP OBJECT directive is used in Object Oriented Programming to delete an object.

NEW( )

The NEW( ) function is used in Object Oriented Programming to create a new object based on a specified class name or an existing object (obj_id). If the class name already exists, then its definition is used. If it has not been defined previously, the system attempts to load the program class.pvc and execute/define the DEF CLASS within it (the DEF CLASS clause must be at the start of the program). If the system is unable to properly determine the class definition, an Error #90:"Unable to locate Object class definition" is generated.

REF( )

The REF ( ) function is used in Object Oriented Programming to control access to an object by incrementing or decrementing the reference count.

Apostrophe Operator

An apostrophe operator (tick) allows dynamic access to the properties and methods available for a given COM, OOP, or graphical object. While the syntax is generally the same for all object-oriented coding in ProvideX, the apostrophe operator can be used to read and alter properties, or execute methods, in a variety of different control and object types.


inheritanceAnalysis

Class inheritanceAnalysis

Inherits

ecCommonUI, ecConstant

Properties

LOCAL cTreeSEP$="|"

[string] separator value for the Treeview nodes shown on the pTree folder of the dMain dialogue in SY_InheritanceAnalysis.M4L

Methods

FUNCTION ScanProgram(fileName$)

Function scans the given file name and analyzes all inheritance levels for the definition of properties and functions. This will display a dialogue at the end of the analysis with a tree representation of the inheritance as well as a search so that elements can be searched on.

Parameter | Description
fileName$ | [input, string] Filename for the starting class to begin analysis.
level | [input, numeric] {optional} Used for recursive calls within ScanProgram() this is the current inheritance level and is written to cAnalysisFH
inhPath$ | [input, string] {optional} Used for recursive calls within ScanProgram() this is the current inheritance path and is written to cAnalysisFH
Returns [boolean] True(1) If scan was complete, False(0) If scan encountered an error or file name is not a providex class file.
Footer logo


inheritanceAnalysis_listener

Class inheritanceAnalysis_listener

Inherits

AbstractActionListener

Properties

LOCAL theDescription$="Inheritance Analysis"

Description to be used for tool in the Contributed Tools list

LOCAL cRunTitle$="Inheritance Analysis"
LOCAL cRunUI$="inheritanceAnalysis_Run_ui"

Methods

FUNCTION actionPerformed(inActionEventID)

This method will be called when the action is triggered from the contributed tools menu.

Parameter | Description
inActionEventID | This is a reference to [Java Class:eventmanager/ExtCommand]
Footer logo


inheritanceAnalysis_run_ui

Class inheritanceAnalysis_run_ui

This method will be called when the 'Configure' action is triggered from the contributed tools menu. The code required to implement the configuration action is normally implemented as one or more NOMADS panels that this method will execute.

Parameter | Description
inActionEventID | This is a reference to [Java Class:eventmanager/ExtCommand]

This method is used to check whether a configuration action has been implemented.

Returns True (1) if a configuration action has been implemented

Inherits

com.pvx.util.progress

Properties

LOCAL theCaption$="Inheritance Analysis"

Set the caption for the user interface window

LOCAL theDescription$="Inheritance Analysis"

Description to display in progress log for the work performed

LOCAL theSpecialText$="Analysis.."

Special button text

Methods

No Methods
Footer logo


masStyleCheck

Class masStyleCheck

This class is required on each client workstation to enable the SytleCheck capability that is included in the ProvideX plug-in in the class ecStyleCheck.

Inherits

ecStyleCheck

Properties

LOCAL styleRulesFile$

specify the full path to the location of the file that contains the style rules

LOCAL theDescription$="Sage 100 - Style Check"

Methods

No Methods
Footer logo


Overview

Sage 100 Plug-in

This plug-in is dependent on the ProvideX Plug-in and adds features and functionality specific to Sage 100 developers.

The plug-in includes:

  • Sage 100 constants, properties, and methods for keyword highlighting.
  • Dedicated 'Sage 100' menu for quick access to:
    • Set preference defaults to better fit Sage 100 development process
    • Sage 100 Style Check contributed tools
  • Access to external tools / data from a local Sage 100 install
    • Code Coverage Analysis
    • Data File Display and Maintenance (DFDM)

Next Section: Property Files


Property Files

Project

A simple text file (project.properties) can be created in the root folder of each project to specify properties (or preferences) to be used by contributed tools or to override a Eclipse preference or project property setting.

Workspace

A simple text file (workspace.properties) can be created in the root folder of the Workspace to specify properties (or preferences) to be used when a property file has been defined for a project.

Info Any property value that represents an operating system path must use '/' character instead of '\'.

Preferences

The project/workspace specific properties files can append to string preferences, override the current value of a boolean or string preference, or set a new default to be used for a boolean or string preference.

Append to Preference Value

To append to the value of a string preference, prefix the internal name for the preference with 'appendPreferenceS' and assign a value or list of values to add to the current value of the system preference.

Override Preference

To override the value of a preference, prefix the internal name for the preference with 'overridePreferenceB' or 'overridePreferenceS', depending on the data type of the preference, and assign the new value or override the current value of the system preference.

A Boolean preference can be set to either true or false while a String preference is set to a text value based on the definition of the preference.

Set Default for a Preference

To define the default, prefix the internal name for the preference with 'defaultPreferenceB' or 'defaultPreferenceS' depending on the data type of the preference.

Info If the preference has already been set, or is changed later, this default value will not be used.

Preference: Keywords

The values of many preferences can be set in either a project or workspace properties file using the keywords below except where highlighted.

Sage 100 Environment
ID | Type | Description
_sage100_ToolExe | String | A full path to a ProvideX executable to be used when starting a process for one of the tools on the Sage 100 menu; if this value is not set, will fall back to the executable for the project, and then the workbench.
_sage100_AuthUserCode | String | The user code, from the selected Sage 100 environment, to use for authentication.
_sage100_AuthUserPwd | String | The user password, from the selected Sage 100 environment, to use for authentication.

The following sample properties file shows how to use these keywords.

# Force values for Sage 100 Environment preferences
overridePreferenceS._sage100_ToolExe=C:/Sage/Standard_2021/MAS90/Home/pvxwin32.exe
overridePreferenceS._sage100_AuthUserCode=bob
overridePreferenceS._sage100_AuthUserPwd=box-password

Next Section: Preferences - Sage 100 Environment


Preferences - Sage 100 Environment

The Sage 100 Environment preference page is used to select the ProvideX executable from a local Sage 100 installation and configure authentication to use when starting a Sage 100 process.

Select the Goto the Sage 100 Environment preference page Sage 100 Environment preference page.

Sage 100 Environment

Settings

ProvideX executable to use for Sage 100 Tools
The full path to a ProvideX executable associated to Sage 100 installation to use when executing tools. Click the Browse... button to browse the local file system to locate the file.
Sage 100 Authentication: User Code
The user logon from the selected Sage 100 install to use for authentication.
Sage 100 Authentication: User Password
The password for the user from the selected Sage 100 install to use for authentication.

Next Section: Sage 100 Menu - Set Preference Defaults/Values


Sage 100 - Set Preference Defaults/Values

This tool will set the Sage 100 preference default values based on the standard settings for Sage 100 developers.

info Any preference that has not been changed is set to the default and will be affected by this action.

The prompt will display asking the user to confirm changing the preference settings.

Sage 100 - Preference Defaults

ProvideX - Builder
  • Disable "Only compile files associated with ProvideX Editor"
  • Enable "Compile Files that have no File extension"
  • Enable "Copy ProvideX Data Files"
  • Enable "Copy Resources (BMPs, DLLs, etc)"
ProvideX - Builder - Options
  • Enable "Check logical structure during build"
  • Enable "Allow mixed case for variable names and line labels"
  • Disable "Load/Save resource properties in 'project.BuildTagInfo' control file
  • Disable "Automatically convert ProvideX programs to text"
  • Enable "Skip copy of programs with errors to linked folders"
  • Disable "Scan for duplicate function/variable names (Error 24)"
ProvideX - Contributed Extensions
  • Enable "Enable external observers"
  • Enable "Sage 100 Style Check"
Editor Options
  • Enable "Enable code folding"
  • Enable "Completion Proposals - Enable load of external keyword categories"
  • Enable "Double-Click in a literal - select current word instead of entire content"
ProvideX - NOMADS
  • Set "Default suffix for NOMADS library files" to: M4L LIB
  • Set "Panel setup defaults - Grid Definition" to: Quarter
  • Set "Panel setup defaults - GUI Style/Effect" to: 4D

Next Section: Code Coverage - Gather Data


Code Coverage - Gather Data

Initialize Code Coverage

The *cvr utility, accessed from the File / Run menu, is used to start the process to collect the data for code coverage analysis.

Code Coverage Initialize (Click to view larger image)

Gather Data for Task(s)

The data collection occurs in an active Sage 100 environment as each task is selected from the Launcher.

If the option was selected to enable the user prompts, a prompt will display as each task is selected from the launcher.

Code Coverage UI Prompt

If the user selects Cancel, the task will start but no code coverage data will be collected.

When the user exits the task, if the option was selected to enable the user prompts, a panel will display to set the name of the file where the code coverage data will be stored and an optional note to include with the data.

Code Coverage Initialize (Click to view larger image)

A message will display to tell the user when the code coverage data has been compiled and saved to the data file.

info The application will perform much slower while the code coverage data collection is in progress.

Next Section: Analyze the Data


Code Coverage - Analyze the Data

Analyze the Data

Once all code coverage data is captured, use the code coverage analysis utility to process the data.

Code Coverage Analysis (Click to view larger image)

Select the Code Coverage data file, the Sage 100 source code location, and optionally enter a list if file prefixes to skip or include in the analysis. Click the Start button to begin.

Review Results

The code coverage utility will then match the code coverage data against the source text files within the eclipse workspace and display all the areas within the code base that were executed during the collection of the code coverage data.

Code Coverage Analysis (Click to view larger image)

The left pane shows programs and the percentage of their code which was covered. Click on a program to view the parts of its code which were hit and the parts that were missed.

When viewing program lines in the listing pane on the right, use the Prev and Next buttons to jump through the missed lines of code, which are displayed in red.

Double-click on a label in the hits/misses panes at the bottom-right to jump to the label in the listing.

Improving the Results

Additional code coverage data can be collected, merged, and re-analyzed against the source code base.

Next Section: Data File Display and Maintenance


Sage 100 - Data File Maintenance and Display

Access the Data File Maintenance and Display utility from a Sage 100 install.

Data File Maintenance and Display (Click to view larger image)
info The functionality of the Data File Maintenance and Display utility is determined by the Sage 100 activation. All access to the utility will be tracked in the Activity Log of the selected Sage 100 install.

Next Section: Style Check


Style Check

  • What is it?
  • Configuration
    • Viewing the Rules
    • Order of Rules
    • Add a Rule
    • Edit Rule
    • Delete Rule
  • Execution of Style Check
    • During SAVE in Editor
    • As Contributed Tool

What is it?

The Style Check contributed tool provides a mechanism for defining simple rules to describe a coding standard. The tool will then use these rules to verify that the source code for an application conforms to the defined standards. These rules are processed in order, and the first rule that fails will be recorded to the "Problem View" and the remaining rules will be skipped.

Configuration

Viewing the Rules

The operation of this tool is controlled through the use of simple rules that are stored in a text file located in the same folder as the primary class used to implement the style check.

info A secondary rule file can be created in the folder specified by the preference 'Contributed Extensions / Tools: Directory for user-defined observers' with the same name as the primary class for the style check. When this file exists, any new or modified rules will be saved to this file; the rules in this file will be added to the list of existing (standard) rules for the style check.

The name of the style check class will be displayed in parenthesis after the description of the plug-in on the 'Contributed Extensions / Tools' preference page once the plug-in has started.

The rules can be viewed in the configuration screen for this tool (see image below - click to view a larger image).

Style Check configuration (Click to view larger image)
Order of Rules
The rules are processed in order, from first to last. The first rule that fails will be tagged against the line in the "Problem View" and all remaining rules will be skipped. As a result of this processing method, any program line that has multiple rule violations will be flagged with the first rule that fails rather than all rules that might apply. The position of a rule in the list can be adjusted by pressing move up to move the rule up, or move down to move the rule down.
Automatically update source code for the rules that contain replacement or delete values
When the Style Check is executed from the "Contributed Tool" menu, this option will control whether the replacement and delete values are updated to each source file as it is processed.
Escalate a 'warning' to an 'error' when rule includes a replacement or delete value
When the Style Check is executed from the "Contributed Tool" menu and the automatic update is not enabled, this option will control whether a rule that is defined as a "Warning" and includes a replacement or delete value will get reported as an "Error".

Add a Rule

A new rule can be created by pressing the [Add] button on the screen that displays the list of rules.

Add a new rule (Click to view larger image)

The information associated with a rule is:

Rule Description
A short description for this rule that will be placed in the "Problem View" when there is a violation.
Search Value
The text value (20 characters) to locate within the program line.
Level of Severity
The severity to be assigned to a violation of this rule (E=Error, W=Warning)
Options
The options control how and when a rule will be applied.
Mandatory
This rule is mandatory and cannot be disabled by a user
Enabled
The current state of the rule when the user is allowed to enable/disable it
Ignore with *SC-OK*
A violation of this rule will be ignored if there is a comment on the same program line that contains the text " *SC-OK* "
Whole Word
The search value will be treated as a word for the search; this means that there must be a space before the search value and a space or ...
Check Remarks
Locate the text inside remarks; if not checked, the search will ignore comments
Delete Search Value
The search value will be deleted when the Style Check is executed as a contributed tool and the "Automatic update" option is set
ProvideX Class Only
The rule will be applied to the source files for ProvideX classes only (files with ".pvc" extensions)
Check Literals
Locate the text inside literal values; if not checked, the search will ignore string literals
Search First 10 Lines
Rule is restricted to the first 10 lines of the source file.
Log Text After Tag
Locate the search text and using the remainder of the program line as the description of the warning/error to be logged.
Check Keywords
Locate search text in list of keywords for the line; if search value contains multiple words, will check any order of the words
Replacement Value
The replacement value can be either a simple text value (20 characters) or a string expression that will be evaluated at run-time.
String Expression
This check box determines the type of replacement value to be used for this rule.
Fixed Text
A simple text value (20 characters) to replace all occurrences of the search text on a program line
String Expression
A string expression to be evaluated to create the replacement text value

Edit a Rule

Any existing rule can be modified by pressing the [Edit] button on the screen that displays the list of rules.

Edit existing rule (Click to view larger image)

The string expression is validated for correctness; update of the rule cannot occur until the expression is valid.

Edit existing rule (Click to view larger image)

Delete a Rule

Any existing rule can be deleted by pressing the [Delete] button on the screen that displays the list of rules.

Execution of Style Check

During SAVE in Editor

The external tools must be enabled on the "Contributed Tools / Extensions" preference page. The Style Check can then be enabled as an observer and will be triggered when a file is saved in the editor. When the style check is executed as part of the save process, all rule violations will be updated to the "Problems View" but no modifications will be made to the source files.

As Contributed Tool

When the style check is executed from the 'Contributed Tools' menu, any rule that includes a replacement text value, or option to delete the search value will be applied to the source file. Any remaining rule violations will be updated to the "Problems View".


Sage 100 Plug-in - What's New

This plug-in is dependent on the ProvideX Plug-in and adds several new features.

Overview
Overview of changes in the current release.
Preference Defaults
Summary of changes to the Sage 100 plug-in.
Historic Releases
Summary of change from historic releases of the plug-in.
What's New June 2022
Overview - Latest Release
v2.6.7 June 2022

Sage 100 Environment - Preference Page
A new preference page to set configuration values for the Sage 100 environment used for the Sage 100 tools.

Sage 100 Tools
Additional items on the Sage 100 menu.
  • Code Coverage Analysis
  • Data File Display and Maintenance (DFDM)

Set Preference Defaults/Values
  • Add prompt to allow user to confirm reset of preferences.

Contributed Tools
  • Inheritance Analysis - Scan selected class in Project Explorer to build inheritance tree and then analyze for common issues.

Miscellaneous
  • update control files for keyword highlighting to include additional constants, properties, and methods
  • Additional properties added to list reset when Set Preference Defaults/Values option on Sage 100 menu is used
Preference Defaults
info The current preference settings for any existing workspace will not be affected unless the current value of a preference is set to the default value.
ProvideX - Builder
  • Disable "Only compile files associated with ProvideX Editor"
  • Enable "Compile Files that have no File extension"
  • Enable "Copy ProvideX Data Files"
  • Enable "Copy Resources (BMPs, DLLs, etc)"
ProvideX - Builder - Options
  • Enable "Check logical structure during build"
  • Enable "Allow mixed case for variable names and line labels"
  • Disable "Load/Save resource properties in 'project.BuildTagInfo' control file
  • Disable "Automatically convert ProvideX programs to text"
  • Enable "Skip copy of programs with errors to linked folders"
  • Disable "Scan for duplicate function/variable names (Error 24)"
ProvideX - Contributed Extensions
  • Enable "Enable external observers"
  • Enable "Sage 100 Style Check"
Editor Options
  • Enable "Enable code folding"
  • Enable "Completion Proposals - Enable load of external keyword categories"
  • Enable "Double-Click in a literal - select current word instead of entire content"
ProvideX - NOMADS
  • Set "Default suffix for NOMADS library files" to: M4L LIB
  • Set "Panel setup defaults - Grid Definition" to: Quarter
  • Set "Panel setup defaults - GUI Style/Effect" to: 4D
Historic Releases
v2.6.3 March 2020

Editor
  • update control files for keyword highlighting to include additional constants, properties and methods
  • add new control file for keyword highlighting of constants, properties, and methods for the new Framework version of Job Cost
v2.6.2 July 2019

Editor
  • update style check rules
v2.6.0 March/April 2019

Editor
  • update control files for keyword highlighting to include additional constants, properties, and methods
  • add new control file for keyword highlighting of constants, properties, and methods for Payroll 2.0