Documentation

Folder App Add-Ins API Reference

What is it?
Folder app add-ins api reference contains a set of Javascript event and method functions that interoperate between IntelliCabinet and a HTML / Javascript web page via the embedded JavaFX panel and our JConnect Javascript Object.

JAVASCRIPT EVENT FUNCTIONS
FunctionDescription
jconnectFolderDataChanged(int Type, int FirstRow, int LastRow, int Column)
(Optional) Include this in your javascript to be notified when folder row data has been changed.
Type: 1=Row Inserted, -1=Row Removed, 0=Column Value Changed
FirstRow: First row affected
LastRow: Last row affected
Column: Column index affected
jconnectFolderSelectionChanged()(Optional) Include this in your javascript to be notified when selected folder files have changed
Example

<!DOCTYPE html>
<body>

<div>Hello!</div>

</body>

<script>

// Catch and display Javascript errors
window.onerror = function(errorMsg, url, lineNumber) {

	alert('Error:\n' + '\n\nScript:\n' + url + '\n\nLine:' + lineNumber);
}

function jconnectFolderDataChanged(Type, FirstRow, LastRow, Column) {
	// Perform actions
}

function jconnectFolderSelectionChanged() {
	// Perform actions
}

</script>

</html>


JAVASCRIPT INTEROPERATE METHOD FUNCTIONS
FunctionReturn TypeDescription
getCabinetProperties()JSONMethod to return the active cabinets assigned property attributes, returned in JSON string format. View the Advanced Settings > Cabinet Properties > Login documentation for details on how cabinet properties are defined.
setCabinetPropertyValue(String Name, String Value)Integer
Method to set the active cabinet's property value
Name: The name of the property to set.
Value: The value to set the property to.
Return: 0 if the property was set successfully, -1 if there was an error while attempting to set the defined property, or -2 if the defined property name could not be set due to the property not having its modifiable attribute defined as true
getFromSQL(String ServerDriver, String ConnectionURL, String SQLQueryStatement, String NullValue)JSON
Method to return a JSON formatted string of data from an SQL Query via a Java sql class.
ServerDriver: The SQL Java server driver class name
ConnectionURL: The Java SQL connection string
SQLQueryStatement: The SQL SELECT query string
NullValue: A String to return for a null table column value
Note: This method assumes you have included the SQL JDBC driver in the java classpath
updateFromSQL(String ServerDriver, String ConnectionURL, String SQLQueryStatement)String
Method to execute and SQL INSERT, UPDATE, or DELETE Query via a Java sql class.
ServerDriver: The SQL Java server driver class name
ConnectionURL: The Java SQL connection string
SQLQueryStatement: The SQL INSERT / UPDATE / DELETE query string
Return: error, count of rows affected, or 0 for the SQL result returned nothing.
Note: This method assumes you have included the SQL JDBC driver in the java classpath
getContentFromURL(String URL)String
Method to retrieve the contents from an HTTP URL.
URL: The URL path (e.g. http://mywebsite.com/index.php)
Return: The content returned from the URL, the HTTP error code if the URL site was not able to be sourced, or error messages created when attempting to source the URL.
addFolderFile()String / JSON
Method to add a file to the active folder.
Return: -1 if the active folder is not read and write enabled, error, or a JSON formatted string of the added file contents.
removeFolderFile(int RowIndex)String
Method to remove a file from the active folder.
RowIndex: The row index of the file to remove, starting at 0. If called by a folder Tab app then this is the row number within the folder file view, if called by a folder View app then this is the row index of the stored file.
Return: undefined if the row index is not valid, -1 if the active folder is not read and write enabled or if the specified file's Path column is not read and write enabled, or an empty string if the request was successfully completed.
getFolderFiles()JSONMethod to return a JSON formatted string of all files stored within the active folder
getFolderFile(int RowIndex)JSONMethod to return a JSON formatted string of a folder file's contents for the specified RowIndex, starting at row 0.
getVisibleFolderFiles()JSONA Tab app method to return a JSON formatted string containing the active folder's visible (i.e. filtered and/or ordered) file contents.
getFolderFilesCount()IntegerMethod to return the number of files in the active folder
getVisibleColumnNames()JSONMethod to return a JSON formatted string containing an active folders visible column names
getVisibleColumnName(int Index)StringMethod to return a folder column name for the specified column index, starting a index 0
getSelectedColumnIndex()IntegerMethod to return the last column index selected
getSelectedRowCount()IntegerMethod to return the number of folder rows selected
getSelectedRows()Integer[]Method to return an Integer array of the active folder's selected rows, or an empty array if no rows are selected.
setFileColumnAttributes(int RowIndex, String ColumnName, String ColumnValue, String ColumnSettings)String
Method to set a file's column attributes.
RowIndex: The row number of the file to edit.
ColumnName: The name of the column to edit.
ColumnValue: The new content for the specified column's value attribute.
ColumnSettings: The new content for the specified column's settings attribute.
Return: undefined if the colum or row does not exist, failed if the column's validation rules failed, error, or an empty string for successful editing.
Note: To set a column value and not a column settings attribute or vise versa specify the ColumnValue or ColumnSettings as null
getFileColumnFormatting(int RowIndex, String ColumnName)JSON
Method to get a file column's format attribute assignments (e.g. background, foreground, left_indent, right_indent, style)
RowIndex: The row number of the file to get, starting at 0.
ColumnName: The name of the column to get the formatting for.
Return: undefined if the colum or row does not exist, error, or JSON string containing the requested item's formatting.
setFileColumnFormat(int RowIndex, String ColumnName, String FormatType, String FormatValue)String
Method to set a file column's format attribute assignments.
RowIndex: The row number of the file to set, starting at 0.
ColumnName: The name of the column to set the formatting for.
FormatType: background, foreground, left_indent, right_indent, or style
FormatValue: background and foreground is specified in html hex codes: #0000FF for example, left_indent and right_indent is specified as a number, and style is specified as plain, bold, italic or an empty string for the default plain style
Return: undefined if the colum or row does not exist, error, or an empty string for successfully completing the request
setFolderTabCount(int FolderIndex, int Count)String
Method to set a folder tab's file count.
FolderIndex: The index of the folder to set, starting at 0 for the first folder
Count: The number to set the counter to, must be greater than or equal to 0
Return: an empty string for successfully setting the counter, -1 if the FolderIndex provided was outside of the available folders range, or -2 if the Count provided was not greater than or equal to 0.
saveCabinet(String Text)Void
Method to save the active cabinet and create a restore point with the specified Text. Once you have performed a series of modifications to cabinet items you will need to save the cabinet in order for the changes to be committed; changes may also be committed if other modifications are performed to folder items by the user where IntelliCabinet automatically saves the cabinet. If a cabinet folder is a different data type other than Standard, the changes are assumed to be captured since the data is stored by a different storage method and assumed Push events have been specified for the changes made via the api calls.
repaintFolderTable()Void
Method to repaint the active folder's displayed table file grid. This may be required if changes have been made that impact the rendering of an active folder's file column data.
refreshFolderData()Void
Method to refresh the active folder's file data.
filterFolder(String Criteria, String MatchingColumns, boolean HighlightMatching)Boolean
Method to filter the active folder's file rows by entering data in the built in folder filter panel.
Criteria: The content to filter by
MatchingColumns: The column names to search in
HighlightMatching: true or false to check or uncheck the highlight matching option on the folder filter panel
Return: true or false for whether the filtering completed successfully
execCommand(String Command, String ArgumentDelimiter)String[]
Method to execute and returning results from a command line string
Command: The command line string to execute
ArgumentDelimiter: If the command to execute contains several arguments you can delimit the command and its arguments by a character and specify the ArgumentDelimiter. Sometimes this is required for the command to execute properly in the Java Runtime environment. Review the Java Runtime.exec method for additional details on this function.
Return: A 0 indexed 3 length string array. The first or index 0 contains the return code that the executed command provided or -1 if there was an error when executing the command specified; The second or index 1 contains the executed commands Output stream; The third or index 2 contains the executed commands Error stream or will contain error information if the second index value is a -1.
messageAlert(String Type, String Title, String Text, int ScollLimit)Void
Method to display a popup message to the user
Type: Error, Warning, Question, or empty string for Plain
Title: The message dialog title
Text: The message text
ScollLimit: The length of characters within the specified Text before providing a scollbar within the message dialog for the Text displayed.
getFileChooser(String Settings)JSON
Method to display a JFileChooser dialog
Settings: A continuous semicolon delimited string defined as SELECTION_MODE=FILES_AND_DIRECTORIES; MULTISELECTION=true

SELECTION_MODE: Can be specified as FILES_AND_DIRECTORIES, FILES_ONLY, or DIRECTORIES_ONLY. FILES_AND_DIRECTORIES is the default if no setting is specified.
MULTISELECTION: True or False to enable the selection of multiple files. False is the default if no setting is specified.
Return: A JSON formatted string containing the files or directories selected along with the operating system attributes, such as name, path, parent, last modified time, etc. Within the JSON string there is a return_code variable that represents the JFileChooser dialog return code.
Example

<!DOCTYPE html>
<body>

<div>Hello!</div>

<script>

// Catch and display Javascript errors
window.onerror = function(errorMsg, url, lineNumber) {

	alert('Error:\n' + '\n\nScript:\n' + url + '\n\nLine:' + lineNumber);
}

function addFolderFile() {

    var AddFile = JConnect.addFolderFile();
    
    if ( AddFile != "-1" ) {
    
    	JConnect.saveCabinet("Added file");
        
        var obj = JSON.parse(AddFile);
    	alert(obj['Name'].value);
    }

}

function getSelectedFolderFile() {
	
    var SelectedRows = JConnect.getSelectedRows();
    var FolderFile = JConnect.getFolderFile(SelectedRows[0]);
    var obj = JSON.parse(FolderFile);
    
    alert(obj['Name'].value);
}

function setFileAttributes(RowIndex, ColumnName, ColumnValue, ColumnSetting) {
	
    var SetAttribute = JConnect.setFileColumnAttributes(RowIndex, ColumnName, ColumnValue, ColumnSetting);
    
    JConnect.saveCabinet("Set column attribute");
}

</script>

</body>
</html>