# new Data(props) → {React.Component}
The data tab in RuleStudio. Presents the list of all objects (and attributes) from information table, allows to add, remove and edit them.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Arguments received from the parent component |
project |
Object | Holds data about the current project like id, name and everything associated with the project e.g. information table, unions, cones etc. |
informationTable |
Object | InformationTable received from and sent to the server, holds attributes and objects |
project.informationTable.attributes |
Array | Attributes (metadata, might be empty) |
project.informationTable.objects |
Array | Objects (data, might be empty) |
onDataChange |
function | Callback method responsible for updating the informationTable in the parent component (which is ProjectTabs.js) |
updateProject |
function | Callback method responsible for updating the whole project (kept in App.js) |
Methods
# static applyOnAddAttribute()
Method runs after clicking Apply in the Add Attribute dialog
# static applyOnEditAttributes()
Method runs after clicking Apply in the Edit attributes dialog
# static attributeAlreadyExists(name)
Method responsible for checking if any attribute with the same name already exists. It is used in the Add attribute dialog
Parameters:
Name | Type | Description |
---|---|---|
name |
string | It is the name of the new attribute |
# static checkIfUpdateOfAttributesNeeded(oldCol, newCol)
Method checks if the updateChangedIdentifOrDescriptAttribute
needs to be fired.
Parameters:
Name | Type | Description |
---|---|---|
oldCol |
Object | object representing old (previous) version of the column. |
newCol |
Object | if it is false it means column has been removed, if it true column activeness has been changed, if it isn't boolean type then it is the object representing new version of (changes made to) the column. |
# static closeOnAddAttribute()
Method responsible for closing the "Add attribute" dialog. The dialog is accessible through the "ADD ATTRIBUTE" button.
# static closeOnEditAttributes()
Method responsible for closing the "Edit attributes" dialog. The dialog is accessible through the "EDIT ATTRIBUTES" button.
# static closeOnSaveToFile()
Method responsible for closing the "Save to file" dialog. The dialog is accessible through the "SAVE TO FILE" button.
# static closeOnTransform()
Method responsible for closing the transform dialog. The method is executed when the chosen option is "No" in the transform dialog
.
# static closeOpenedColumnHeaderMenu(selected)
Method responsible for closing right click header menu.
Parameters:
Name | Type | Description |
---|---|---|
selected |
string | It is one of [Delete attribute, Edit attribute, Mark attribute as: active, Mark attribute as: inactive] |
# static closeOpenedNotification(reason, event)
Method responsible for closing notification.
Parameters:
Name | Type | Description |
---|---|---|
reason |
Object | Reason of closing notification |
event |
Object | Represents an event that takes place in DOM |
# static createColumn(name, active, type, mvType, identifierType, preferenceType, valueType, domain) → {Object}
Method responsible for creating new column (new attribute).
It runs only when validation
gives positive result.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | It is the name of the new attribute |
active |
boolean | It is true if the attribute is active, else false |
type |
string | It is one of [identification, decision, condition, description] |
mvType |
string | It is one of [mv1.5, mv2] |
identifierType |
string | It is one of [uuid, text] |
preferenceType |
string | It is one of [gain, cost, none] |
valueType |
string | It is one of [integer, real, enumeration] |
domain |
Array | It is the array containing domain elements for the enumeration value type |
# static deleteRowByRowIdx(rowIdx)
Method responsible for removing certain row after choosing option "Delete object" from right click menu.
Parameters:
Name | Type | Description |
---|---|---|
rowIdx |
Number | Indicates the row number from the top, to be removed. |
# static deleteSelectedRows()
Method responsible for removing selected rows (the selected row means that the checkbox on the left of the row is marked).
# static displayAddAttributeFields() → {Array}
Method prepares array of html elements which will be displayed through the render
method.
These are fields of the Add attribute dialog.
# static displayColumnHeaderMenu(col)
Method prepares array of html elements which will be displayed through the render
method.
These are options available through right click on the column header.
Parameters:
Name | Type | Description |
---|---|---|
col |
Object | It is the column (attribute) selected from the list |
# static DisplayData#absoluteValue(x)
Method returns absolute value of an integer / real number.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | It is the number from which absolute value will be taken. |
# static DisplayData#activeDecisionAttributeAlreadyExists(isAddMethodElseIndex)
Method responsible for checking if any decision attribute exists and is active.
Parameters:
Name | Type | Description |
---|---|---|
isAddMethodElseIndex |
string | If it is -1 it means adding new column, else it is index of the old column which has been edited. |
# static DisplayData#activeIdentificationAttributeAlreadyExists(isAddMethodElseIndex)
Method responsible for checking if any identification attribute exists and is active.
Parameters:
Name | Type | Description |
---|---|---|
isAddMethodElseIndex |
string | If it is -1 it means adding new column, else it is index of the old column which has been edited. |
# static DisplayData#attributeAlreadyExistAndIsDifferentThanSelected(name, coldIdx)
Method responsible for checking if any attribute with the same name already exists. It is used in the Edit attributes dialog
Parameters:
Name | Type | Description |
---|---|---|
name |
string | It is the name of the new attribute |
coldIdx |
integer | It is the index of the edited column |
# static DisplayData#componentDidMount()
A component's lifecycle method. Fired once when component was mounted.
Method responsible for setting the color of column headers accordingly to the attribute preference type during initialization of the component.
Runs only once, after component is mounted (after first render
and before methods shouldComponentUpdate() and componentDidUpdate
).
# static DisplayData#componentDidUpdate(prevProps, prevState)
A component's lifecycle method. Fired after a component was updated.
Method responsible for changing displayed data when project is changed. Runs after every render()
and holds the newest values of props and state.
If the project has been changed then initialize all the values (overwrite) in the state.
Parameters:
Name | Type | Description |
---|---|---|
prevProps |
Object | Old props object containing all the props e.g. props.project.id or props.project.name |
prevState |
Object | Old state object containing all the properties from state e.g. state.columns or state.rows |
# static DisplayData#componentWillUnmount()
A component's lifecycle method. Fired when component was requested to be unmounted.
# static DisplayData#getColumns()
Method returns columns for the current history step
# static DisplayData#getNumberPartAndConstantPart(text) → {Object}
Method returns the object containing of number part and rest of the string. It is used e.g. when holding CTRL and double clicking on the square placed in the bottom right corner of the cell (in the identification attribute).
Parameters:
Name | Type | Description |
---|---|---|
text |
string | Text to be divided into number part and constant part. |
# static DisplayData#getRows(rows, filters)
Helper method to get all the filtered rows. This method uses selectors
Parameters:
Name | Type | Description |
---|---|---|
rows |
Array | All the rows i.e. this is the array containing all the rows where each row (object of the array) consists of key-value pairs |
filters |
Array | All the filters i.e. this is the array containing |
# static DisplayData#prepareDataFileBeforeSendingToServer() → {Array}
Method responsible for preparing data before sending it to the server. I.e. removing "No." property from all the rows.
# static DisplayData#prepareMetadataFileBeforeSendingToServer() → {Array}
Method responsible for preparing metadata before sending it to the server. E.g. removing certain properties from all the columns like sorting, filtering, resizing, width etc.
# static displayEditAttributeFields() → {Array}
Method prepares array of html elements which will be displayed through the render
method.
These are fields of the Edit attribute dialog
# static displayListOfAttributesForModification() → {Array}
Method returns columns which can be selected and then modified in the Edit attributes dialog.
# static fetchDataFromServerOrParent(isFetchNeeded, cdm)
Method responsible for getting information table from the server or from the parent component, used when entering the data tab.
Parameters:
Name | Type | Description |
---|---|---|
isFetchNeeded |
boolean | If |
cdm |
boolean | If |
# static filteredRows()
Method responsible for getting all the filtered rows. Uses method getRows
.
# static getSelectedAttributePreferenceType(selected)
Method responsible for remembering selected attribute preference type.
Parameters:
Name | Type | Description |
---|---|---|
selected |
Object | It is one of [gain, cost, none] |
# static getSelectedAttributeType(selected)
Method responsible for remembering selected attribute type.
Parameters:
Name | Type | Description |
---|---|---|
selected |
Object | It is one of [identification, description, condition, decision] |
# static getSelectedIdentifierType(selected)
Method responsible for remembering selected identifier type.
Parameters:
Name | Type | Description |
---|---|---|
selected |
Object | It is one of [uuid, text] |
# static getSelectedMissingValueType(selected)
Method responsible for remembering selected missing value type.
Parameters:
Name | Type | Description |
---|---|---|
selected |
Object | It is one of [mv1.5, mv2] |
# static getSelectedSaveToFileCsvSeparator(selected)
In the "Save to file" dialog this method is responsible for remembering the separator in CSV format
Parameters:
Name | Type | Description |
---|---|---|
selected |
string | Selected option from the separator list. One of [comma, semicolon, space, tab]. |
# static getSelectedValueType(selected)
Method responsible for remembering selected attribute value type.
Parameters:
Name | Type | Description |
---|---|---|
selected |
Object | It is one of [integer, real, enumeration] |
# static handleChangeBinarize(e)
Method responsible for remembering if binarize nominal attributes with 3+ values is selected. This option is available in the impose preference order dialog through the Transform button.
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | Represents an event that takes place in DOM tree. |
# static handleChangeSaveToFileCsvHeader(e)
In the "Save to file" dialog this method is responsible for remembering if the user wants to have the header in CSV format
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | Represents an event that takes place in DOM tree. |
# static handleChangeSaveToFileData(e)
In the "Save to file" dialog this method is responsible for remembering if the user wants to download the data in JSON or CSV format
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | Represents an event that takes place in DOM tree. |
# static handleChangeSaveToFileMetaData(e)
In the "Save to file" dialog this method is responsible for remembering if the user wants to download the metadata in JSON format
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | Represents an event that takes place in DOM tree. |
# static handleFilterChange(filter)
Method responsible for adding filter to filters array which is in the state.
Parameters:
Name | Type | Description |
---|---|---|
filter |
Object | Consists of two key-value pairs. The first one is the column object containg all the pairs key-value for the column. The second is flterTerm which has been written in the filter field. If there is more than one filter term (e.g. in numeric filter let's choose numbers 1,2,3 and greater than 10. Then we have: 1,2,3,>10) the filter term becomes the array. The class NumericFilter is responsible for handling numeric filters. |
# static handleListItemClick(col)
Method responsible for remembering selected attribute from the list in the Edit attributes dialog.
Parameters:
Name | Type | Description |
---|---|---|
col |
Object | It is the column (attribute) selected from the list |
# static insertRow(rowIdx, where)
Method responsible for adding row. After right click menu one can add row above ("Add new object above") or below ("Add new object below") the clicked row. After "ADD NEW OBJECT" button click one can add row at the end of the rows array.
Parameters:
Name | Type | Description |
---|---|---|
rowIdx |
Number | Indicates the row number from the top. |
where |
string | Indicates where to add the row. The existing options are "above" or "below" (the clicked row) or any other name which means at the end of the rows array. |
# static onAddAttribute()
Method responsible for opening the "Add attribute" dialog. The dialog is accessible through the "ADD ATTRIBUTE" button.
# static onBack()
Method responsible for displaying previous history step
# static onClearFilters()
Method responsible for clearing filters.
# static onColumnHeaderDragDrop(source, target)
Method responsible for changing order of columns via drag and drop.
Parameters:
Name | Type | Description |
---|---|---|
source |
Object | It is the key of the source column (dragged-from column) |
target |
Object | It is the key of the target column (dropped-on column) |
# static onColumnResize(columnIdx, newWidth)
Method responsible for adjusting width to the resized column
Parameters:
Name | Type | Description |
---|---|---|
columnIdx |
Integer | Index of the column |
newWidth |
Number | New width of the column |
# static onEditAttributes()
Method responsible for opening the "Edit attributes" dialog. The dialog is accessible through the "EDIT ATTRIBUTES" button.
# static onGridKeyDown(e)
Method responsible for catching key down keyboard event, more specifically to catch if the CTRL or CTRL + C was pressed
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | Represents an event that takes place in DOM tree. |
# static onGridKeyUp(e)
Method responsible for catching key up keyboard event, more specifically to catch if the CTRL or Escape was released
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | Represents an event that takes place in DOM tree. |
# static onGridRowsUpdated(action, cellKey, fromRow, toRow, updated)
Method responsible for updating displayed data when the value in the cell changes (or multiple values when dragging). First row has index 0.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | Indicates which action triggered the update. Can be one of [CELL_UPDATE, COLUMN_FILL, COPY_PASTE, CELL_DRAG] |
cellKey |
string | Indicates on which column updated has been done |
fromRow |
Number | Indicates which row have been changed (or when dragging - from which row dragging has began). |
toRow |
Number | Indicates on which row dragging has ended (or if the number is the same as fromRow, then which row has been changed) inclusive. |
updated |
Object | Indicates on which column and to which value changes happend. It is a pair key - value, where the key is the column key and the value is the value of the cell to which the cell has been changed. |
# static onGridSort(sortColumn, sortDirection)
Method responsible for sorting data. Runs when the header of the column is clicked.
Parameters:
Name | Type | Description |
---|---|---|
sortColumn |
string | Indicates which column header has been clicked i.e. which column should be sorted. This is the column key. |
sortDirection |
Number | Indicates which way sorting should take place. This is one of the values "ASC", "DESC", "NONE", which stand for ascending, descending and none. |
# static onRedo()
Method responsible for displaying next history step
# static onRowsDeselected(rows)
Method responsible for removing deselected, i.e. the checkbox on the left of the row is unmarked, rows from the selectedRows array which is in the state.
Parameters:
Name | Type | Description |
---|---|---|
rows |
Array | Indicates which row has been deselected. It consists of two objects. The first one is rowIdx, which is the number of row from the top (indexing from 0). The second object is row object containg all the pairs key-value for the row. |
# static onRowsSelected(rows)
Method responsible for adding selected rows to the selectedRows array which is in the state (selected row is the row in which the checkbox on the left of the row is marked).
Parameters:
Name | Type | Description |
---|---|---|
rows |
Array | Indicates which row has been selected. It consists of two objects. The first one is rowIdx, which is the number of row from the top (indexing from 0). The second object is row object containg all the pairs key-value for the row. |
# static onTransformAttributes()
Method responsible for imposing preference order when evaluation attribute doesn't have preference order. For more information click here.
# static openOnSaveToFile()
Method responsible for opening the "Save to file" dialog. The dialog is accessible through the "SAVE TO FILE" button.
# static openOnTransform()
Method responsible for opening the transform dialog. The dialog is accessible through the "TRANSFORM" button, but only when modifications have not been saved.
# static prepareDataFromImport(data) → {Array}
Method responsible for preparing data i.e. objects to display them in rows. This is the place where No. property is added to each object.
Parameters:
Name | Type | Description |
---|---|---|
data |
Array | Data i.e. objects received from the props. Each object consists of pairs key-value with name of the property as the key and value as the value. |
# static prepareHistory(history)
Method responsible for adding elements (e.g. numeric filter), which have been removed due to parsing and stringifying history.
Parameters:
Name | Type | Description |
---|---|---|
history |
Array | It is the array containing objects. Each object consists of rows, columns, and what has been changed (column, row, both) |
# static prepareMetaDataFromImport(metadata) → {Array}
Method responsible for preparing metadata i.e. attributes to display them in columns. This is the place where certain properties are added to each attribute e.g. sorting, filtering, resizing etc.
Parameters:
Name | Type | Description |
---|---|---|
metadata |
Array | I.e. attributes received from the props. Each attribute consists of pairs key-value with name of the property as the key and value as the value. |
# static renameKeyInObject(oldName, newName, object)
Method responsible for renaming key in an object.
Parameters:
Name | Type | Description |
---|---|---|
oldName |
string | It is the old key name (the key which will be renamed) |
newName |
string | It is the new key name |
object |
Object | It is the object in which one key is replaced |
# static replaceMissingDataWithQuestionMarks()
Method responsible for inserting into cells missing value signs (?) if the key of an object doesn't match the attribute.
# static saveDataToCsvOrJson(name, header, separator)
Method responsible for saving (downloading) data file.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Stands for the name of the file, usually server replace this name |
header |
Object | True if CSV file needs to be saved with header row, -1 if it is JSON file (no header) |
separator |
Object | Separator in the CSV file, -1 if it JSON file (no separator) |
# static saveMetaDataToJson(name)
Method responsible for saving (downloading) metadata file.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Stands for the name of the file, usually server replace this name |
# static saveToFile()
Method resonsible for passing (to this method
) appropriate parameters for saving (downloading) files.
# static sendInfoTableToServerDueToIdentifOrDescriptAttributeChange(objects, attributes)
Method responsible for updating (sending to server) information table, so it will be possible to make attributes visible to choose in the "project settings" (objects visible name).
Parameters:
Name | Type | Description |
---|---|---|
objects |
Array.<Object> | Array representing objects (data) |
attributes |
Array.<Object> | Array representing attributes (metadata) |
# static setDomainElements(array)
Method responsible for remembering domain elements of the enumeration attribute.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | It is the array containing domain elements |
# static setHeaderColorAndStyle(column, idx, changeWidth)
Method responsible for setting column header color and its bottom text (e.g. condition, active).
Parameters:
Name | Type | Description |
---|---|---|
column |
Object | It is the column object (attribute) on which changes will be made |
idx |
Integer | It is the index of the column in DOM tree |
changeWidth |
boolean | If it is true the width of the column will be set |
# static setHeaderColorAndStyleAndRightClick(column, idx, changeWidth)
Auxiliary method responsible for preparing columns headers.
Parameters:
Name | Type | Description |
---|---|---|
column |
Object | It is the column object (attribute) on which changes will be made |
idx |
Integer | It is the index of the column in DOM tree |
changeWidth |
boolean | If it is true the width of the column will be set |
# static setHeaderRightClick(column, idx)
Method responsible for setting right click column header menu.
Parameters:
Name | Type | Description |
---|---|---|
column |
Object | It is the column object (attribute) on which changes will be made |
idx |
Integer | It is the index of the column in DOM tree |
# static setRowsAndHeaderColorAndStyleAndRightClick(column, idx, ifIsNewColumnElseOldColumn)
Additionally to the method
it also changes rows
(e.g. during the change of attribute value type, or fills all rows with missing value sign "?" if it is new attribute)
Parameters:
Name | Type | Description |
---|---|---|
column |
Object | It is the old column (before any changes) |
idx |
Integer | It is the index of the column in DOM tree |
ifIsNewColumnElseOldColumn |
Object | It is the column object having changes after its edition, it is boolean if new attribute was added. |
# static turnOffCellCopyPaste()
Method responsible for turning off the copy paste mode (same behaviour as pressing Escape)
# static updateChangedIdentifOrDescriptAttribute()
Helper method responsible for preparing objects and attributes and forward them to DisplayData#sendInfoTableToServerDueToIdentifOrDescriptAttributeChange
.
# static updateInfoTableInTheParent(isUpdateNecessary, argsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isUpdateNecessary |
boolean | The parameter indicates if the information table should be send to the server. |
|
args |
Array |
<optional> |
It is either empty array (no data were passed) or the array containing metadata and data, in that order. |
# static updateProject()
Method responsible for preparing whole project to update it (in the parent).
# static validateOnAddAndEditAttribute(isAddMethodElseIndex, active, name, type, mvType, identifierType, preferenceType, valueType, domain) → {Boolean}
Method responsible for validating new attribute or validating edited attribute.
Parameters:
Name | Type | Description |
---|---|---|
isAddMethodElseIndex |
integer | If it is -1 it means adding new column, else it is index of the old column which has been edited. |
active |
boolean | It is true if the attribute is active, else false |
name |
string | It is the name of the new / edited attribute |
type |
string | It is one of [identification, decision, condition, description] |
mvType |
string | It is one of [mv1.5, mv2] |
identifierType |
string | It is one of [uuid, text] |
preferenceType |
string | It is one of [gain, cost, none] |
valueType |
string | It is one of [integer, real, enumeration] |
domain |
Array | It is the array containing domain elements for the enumeration value type |