Class

Data

Data(props) → {React.Component}

Constructor

# 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)

View Source Body/Project/Data/DisplayData.js, line 163

React.Component

Methods

# static applyOnAddAttribute()

Method runs after clicking Apply in the Add Attribute dialog

View Source Body/Project/Data/DisplayData.js, line 2629

# static applyOnEditAttributes()

Method runs after clicking Apply in the Edit attributes dialog

View Source Body/Project/Data/DisplayData.js, line 2827

# 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

View Source Body/Project/Data/DisplayData.js, line 2150

# 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.

View Source Body/Project/Data/DisplayData.js, line 566

# static closeOnAddAttribute()

Method responsible for closing the "Add attribute" dialog. The dialog is accessible through the "ADD ATTRIBUTE" button.

View Source Body/Project/Data/DisplayData.js, line 1331

# static closeOnEditAttributes()

Method responsible for closing the "Edit attributes" dialog. The dialog is accessible through the "EDIT ATTRIBUTES" button.

View Source Body/Project/Data/DisplayData.js, line 1349

# static closeOnSaveToFile()

Method responsible for closing the "Save to file" dialog. The dialog is accessible through the "SAVE TO FILE" button.

View Source Body/Project/Data/DisplayData.js, line 1645

# static closeOnTransform()

Method responsible for closing the transform dialog. The method is executed when the chosen option is "No" in the transform dialog.

View Source Body/Project/Data/DisplayData.js, line 1368

# 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]

View Source Body/Project/Data/DisplayData.js, line 2064

# 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

View Source Body/Project/Data/DisplayData.js, line 2048

# 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

View Source Body/Project/Data/DisplayData.js, line 2367

Object

# 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.

View Source Body/Project/Data/DisplayData.js, line 1125

# static deleteSelectedRows()

Method responsible for removing selected rows (the selected row means that the checkbox on the left of the row is marked).

View Source Body/Project/Data/DisplayData.js, line 1153

# 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.

View Source Body/Project/Data/DisplayData.js, line 2676

Array

# 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

View Source Body/Project/Data/DisplayData.js, line 2920

# 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.

View Source Body/Project/Data/DisplayData.js, line 681

# 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.

View Source Body/Project/Data/DisplayData.js, line 2211

# 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.

View Source Body/Project/Data/DisplayData.js, line 2184

# 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

View Source Body/Project/Data/DisplayData.js, line 2168

# 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).

View Source Body/Project/Data/DisplayData.js, line 598

# 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

View Source Body/Project/Data/DisplayData.js, line 245

# static DisplayData#componentWillUnmount()

A component's lifecycle method. Fired when component was requested to be unmounted.

View Source Body/Project/Data/DisplayData.js, line 643

# static DisplayData#getColumns()

Method returns columns for the current history step

View Source Body/Project/Data/DisplayData.js, line 1977

# 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.

View Source Body/Project/Data/DisplayData.js, line 656

Object

# 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 filter objects

View Source Body/Project/Data/DisplayData.js, line 1088

# static DisplayData#prepareDataFileBeforeSendingToServer() → {Array}

Method responsible for preparing data before sending it to the server. I.e. removing "No." property from all the rows.

View Source Body/Project/Data/DisplayData.js, line 1581

Array

# 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.

View Source Body/Project/Data/DisplayData.js, line 1560

Array

# 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

View Source Body/Project/Data/DisplayData.js, line 2715

Array

# static displayListOfAttributesForModification() → {Array}

Method returns columns which can be selected and then modified in the Edit attributes dialog.

View Source Body/Project/Data/DisplayData.js, line 2899

Array

# 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 true the informationTable will be fetched from the server.

cdm boolean

If true this method is called from the ComponentDidMount method.

View Source Body/Project/Data/DisplayData.js, line 424

# static filteredRows()

Method responsible for getting all the filtered rows. Uses method getRows.

View Source Body/Project/Data/DisplayData.js, line 1098

# static getSelectedAttributePreferenceType(selected)

Method responsible for remembering selected attribute preference type.

Parameters:
Name Type Description
selected Object

It is one of [gain, cost, none]

View Source Body/Project/Data/DisplayData.js, line 2003

# static getSelectedAttributeType(selected)

Method responsible for remembering selected attribute type.

Parameters:
Name Type Description
selected Object

It is one of [identification, description, condition, decision]

View Source Body/Project/Data/DisplayData.js, line 1992

# static getSelectedIdentifierType(selected)

Method responsible for remembering selected identifier type.

Parameters:
Name Type Description
selected Object

It is one of [uuid, text]

View Source Body/Project/Data/DisplayData.js, line 2025

# static getSelectedMissingValueType(selected)

Method responsible for remembering selected missing value type.

Parameters:
Name Type Description
selected Object

It is one of [mv1.5, mv2]

View Source Body/Project/Data/DisplayData.js, line 2036

# 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].

View Source Body/Project/Data/DisplayData.js, line 1633

# static getSelectedValueType(selected)

Method responsible for remembering selected attribute value type.

Parameters:
Name Type Description
selected Object

It is one of [integer, real, enumeration]

View Source Body/Project/Data/DisplayData.js, line 2014

# 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.

View Source Body/Project/Data/DisplayData.js, line 2950

# 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.

View Source Body/Project/Data/DisplayData.js, line 1620

# 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.

View Source Body/Project/Data/DisplayData.js, line 1607

# 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.

View Source Body/Project/Data/DisplayData.js, line 1594

# 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.

View Source Body/Project/Data/DisplayData.js, line 1065

# 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

View Source Body/Project/Data/DisplayData.js, line 2804

# 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.

View Source Body/Project/Data/DisplayData.js, line 1223

# static onAddAttribute()

Method responsible for opening the "Add attribute" dialog. The dialog is accessible through the "ADD ATTRIBUTE" button.

View Source Body/Project/Data/DisplayData.js, line 1311

# static onBack()

Method responsible for displaying previous history step

View Source Body/Project/Data/DisplayData.js, line 3047

# static onClearFilters()

Method responsible for clearing filters.

View Source Body/Project/Data/DisplayData.js, line 1111

# 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)

View Source Body/Project/Data/DisplayData.js, line 2970

# 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

View Source Body/Project/Data/DisplayData.js, line 3091

# static onEditAttributes()

Method responsible for opening the "Edit attributes" dialog. The dialog is accessible through the "EDIT ATTRIBUTES" button.

View Source Body/Project/Data/DisplayData.js, line 1321

# 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.

View Source Body/Project/Data/DisplayData.js, line 3021

# 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.

View Source Body/Project/Data/DisplayData.js, line 3004

# 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.

View Source Body/Project/Data/DisplayData.js, line 697

# 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.

View Source Body/Project/Data/DisplayData.js, line 980

# static onRedo()

Method responsible for displaying next history step

View Source Body/Project/Data/DisplayData.js, line 3068

# 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.

View Source Body/Project/Data/DisplayData.js, line 1045

# 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.

View Source Body/Project/Data/DisplayData.js, line 1031

# static onTransformAttributes()

Method responsible for imposing preference order when evaluation attribute doesn't have preference order. For more information click here.

View Source Body/Project/Data/DisplayData.js, line 1393

# static openOnSaveToFile()

Method responsible for opening the "Save to file" dialog. The dialog is accessible through the "SAVE TO FILE" button.

View Source Body/Project/Data/DisplayData.js, line 1661

# 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.

View Source Body/Project/Data/DisplayData.js, line 1380

# 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.

View Source Body/Project/Data/DisplayData.js, line 330

Array

# 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)

View Source Body/Project/Data/DisplayData.js, line 306

# 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.

View Source Body/Project/Data/DisplayData.js, line 346

Array

# 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

View Source Body/Project/Data/DisplayData.js, line 2524

# static replaceMissingDataWithQuestionMarks()

Method responsible for inserting into cells missing value signs (?) if the key of an object doesn't match the attribute.

View Source Body/Project/Data/DisplayData.js, line 389

# 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)

View Source Body/Project/Data/DisplayData.js, line 1706

# 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

View Source Body/Project/Data/DisplayData.js, line 1854

# static saveToFile()

Method resonsible for passing (to this method) appropriate parameters for saving (downloading) files.

View Source Body/Project/Data/DisplayData.js, line 1673

# 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)

View Source Body/Project/Data/DisplayData.js, line 514

# 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

View Source Body/Project/Data/DisplayData.js, line 2238

# 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

View Source Body/Project/Data/DisplayData.js, line 2402

# 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

View Source Body/Project/Data/DisplayData.js, line 2510

# 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

View Source Body/Project/Data/DisplayData.js, line 2480

# 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.

View Source Body/Project/Data/DisplayData.js, line 2539

# static turnOffCellCopyPaste()

Method responsible for turning off the copy paste mode (same behaviour as pressing Escape)

View Source Body/Project/Data/DisplayData.js, line 3036

# static updateChangedIdentifOrDescriptAttribute()

Helper method responsible for preparing objects and attributes and forward them to DisplayData#sendInfoTableToServerDueToIdentifOrDescriptAttributeChange.

View Source Body/Project/Data/DisplayData.js, line 551

# 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.

View Source Body/Project/Data/DisplayData.js, line 627

# static updateProject()

Method responsible for preparing whole project to update it (in the parent).

View Source Body/Project/Data/DisplayData.js, line 610

# 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

View Source Body/Project/Data/DisplayData.js, line 2260

Boolean