Class BaseGrid
java.lang.Object
com.onenetwork.platform.tools.test.ui.components.ext.base.BaseGrid
- Direct Known Subclasses:
GridIE
public class BaseGrid
extends java.lang.Object
Base class for Grid component.
-
Field Summary
Fields Modifier and Type Field Description protected org.json.JSONArray
columnsArray
protected java.util.Map<java.lang.String,org.json.JSONObject>
columnsByHeader
protected Component
currentEditor
protected static java.lang.String
DISABLE_BULK_EDIT
protected static java.lang.String
ENABLE_BULK_EDIT
protected static java.lang.String
REQUIREDNESS_CHAR
protected static java.lang.String
REQUIREDNESS_PATTERN
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
addColumn(java.lang.String columnName)
Add (show) a column in the Gridvoid
addColumns(java.lang.String[] columnNames)
Add (show) provided columns in the gridvoid
advancedSort(java.lang.String firstColumnName, java.lang.String firstSortOrder, java.lang.String secondColmnName, java.lang.String secondSortOrder)
Perform an advanced search using the cell header context menuvoid
checkAllRows()
Checks the checkbox in the top-left-most cell to check/uncheck all Grid rows.void
checkRow(int rowIndex)
Select the desired rowvoid
clickColumnHeaderToSort(java.lang.String headerName)
Sort the data according to the header columnprotected void
clickRowChecker(org.openqa.selenium.WebElement checkBox)
void
copyColumns(int rowIndex, java.lang.String... columnNames)
void
disableBulkEdit()
void
dragRoleFromAvailToSelected(java.lang.String roleName, Grid targetGrid)
Drag a Role from one Grid to another Gridvoid
enableBulkEdit()
protected org.json.JSONObject
findColumn(java.lang.String header)
protected org.json.JSONObject
findColumnById(java.lang.String id)
org.openqa.selenium.WebElement
getCell(int rowNum, int colIndex)
Gets cellWebElement
org.openqa.selenium.WebElement
getCell(int rowNum, java.lang.String header)
Gets cellWebElement
java.lang.String
getCellValue(int rowNum, java.lang.String header)
Fetch the cell value by row number and header label or field nameint
getColumnCount()
Get the header columns count including hidden.Component
getEditor()
Returns the current grid editor.java.lang.String
getErrorMessage(int rowNum)
Returns error message for first found error icon in the specified row.java.lang.String
getErrorMessage(int rowNum, java.lang.String columnName)
Checks whether the cell has some error icon, if yes then returns error message for that iconint
getGridColumnIndexByName(java.lang.String dataIndex)
Get the index of the column in Gridprotected java.util.List<org.openqa.selenium.WebElement>
getHeaderCellList()
java.util.List<java.lang.String>
getHeaderColumnNames()
Get the list of labelled Column header names.int
getRowCount()
java.util.List<org.openqa.selenium.WebElement>
getRows()
protected void
initializeColumnsArray()
boolean
isEditable(java.lang.String headerName)
Checks whether the column is editable or notboolean
isErrorIcon(int rowIndex, java.lang.String columnName)
Checks whether the cell has some error icon or notboolean
isRequired(java.lang.String headerName)
Checks whether the value to the column is required or notvoid
openAuditTrail(int rowIndex)
Opens child audit trail from grid of model formvoid
openCellHeaderContextMenu(java.lang.String headerName)
Open the right-click context menu for a cell headervoid
pasteToAllRows()
void
pasteToRow(int rowIndex)
void
removeColumn(java.lang.String columnName)
Remove (hide) a column from Gridvoid
removeRow(int rowIndex)
Removes row from grid of model formvoid
selectCellHeaderMenuItem(java.lang.String itemName)
Select options from context menu except Advanced Sorting and Columnsprotected void
setCurrentEditor(java.lang.String xtype)
Grid
startEditing(int rowNum, java.lang.String header)
Starts editing at the provided row index and column header.Grid
startEditing(int rowNum, java.lang.String header, java.lang.String xtype)
Variation ofstartEditing(int, String)
which allows you to explicitly specify the xtype for the cell editor.void
stopEditing()
Stops any grid editing.void
unselectCopiedColumns(int rowIndex, java.lang.String... columnNames)
-
Field Details
-
columnsArray
protected org.json.JSONArray columnsArray -
columnsByHeader
protected java.util.Map<java.lang.String,org.json.JSONObject> columnsByHeader -
currentEditor
-
REQUIREDNESS_PATTERN
protected static final java.lang.String REQUIREDNESS_PATTERN- See Also:
- Constant Field Values
-
REQUIREDNESS_CHAR
protected static final java.lang.String REQUIREDNESS_CHAR- See Also:
- Constant Field Values
-
ENABLE_BULK_EDIT
protected static final java.lang.String ENABLE_BULK_EDIT- See Also:
- Constant Field Values
-
DISABLE_BULK_EDIT
protected static final java.lang.String DISABLE_BULK_EDIT- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
getRowCount
public int getRowCount() -
getRows
public java.util.List<org.openqa.selenium.WebElement> getRows() -
startEditing
Starts editing at the provided row index and column header. You can then callgetEditor()
to return theComponent
instance of the grid editor. This method returns this (the Grid) instance so that it can be chained withgetEditor()
.- Parameters:
rowNum
-header
-- Returns:
-
startEditing
Variation ofstartEditing(int, String)
which allows you to explicitly specify the xtype for the cell editor. You should only need to use this if the other method throws an exception stating that it cannot find the xtype within the grid's column model config.- Parameters:
rowNum
-header
-xtype
-- Returns:
-
setCurrentEditor
protected void setCurrentEditor(java.lang.String xtype) -
getEditor
Returns the current grid editor. This method is intended to be called immediately afterstartEditing(int, String)
, and because that method returns thisGrid
, they can be chained together. If this method is called and no cell is being edited, it will return null.- Returns:
-
stopEditing
public void stopEditing()Stops any grid editing. Any changes made within the grid editor are accepted (assuming they are valid). -
getCell
public org.openqa.selenium.WebElement getCell(int rowNum, java.lang.String header)Gets cellWebElement
- Parameters:
rowNum
- row numberheader
- column header label- Returns:
WebElement
of the cell
-
getCell
public org.openqa.selenium.WebElement getCell(int rowNum, int colIndex)Gets cellWebElement
- Parameters:
rowNum
- row numbercolIndex
- column index- Returns:
WebElement
of the cell
-
getCellValue
public java.lang.String getCellValue(int rowNum, java.lang.String header)Fetch the cell value by row number and header label or field name- Parameters:
rowNum
- row number (starting from zero)header
- column label or column id- Returns:
- text value of the given cell
-
findColumn
protected org.json.JSONObject findColumn(java.lang.String header) -
findColumnById
protected org.json.JSONObject findColumnById(java.lang.String id) -
getHeaderCellList
protected java.util.List<org.openqa.selenium.WebElement> getHeaderCellList() -
initializeColumnsArray
protected void initializeColumnsArray() -
getGridColumnIndexByName
public int getGridColumnIndexByName(java.lang.String dataIndex)Get the index of the column in Grid- Parameters:
dataIndex
- name of the ext "data index" in the grid store- Returns:
-
checkRow
public void checkRow(int rowIndex)Select the desired row- Parameters:
rowIndex
- (starts from 0)
-
clickRowChecker
protected void clickRowChecker(org.openqa.selenium.WebElement checkBox) -
checkAllRows
public void checkAllRows()Checks the checkbox in the top-left-most cell to check/uncheck all Grid rows. -
clickColumnHeaderToSort
public void clickColumnHeaderToSort(java.lang.String headerName)Sort the data according to the header column- Parameters:
headerName
-
-
openCellHeaderContextMenu
public void openCellHeaderContextMenu(java.lang.String headerName)Open the right-click context menu for a cell header- Parameters:
headerName
- cell header label
-
selectCellHeaderMenuItem
public void selectCellHeaderMenuItem(java.lang.String itemName)Select options from context menu except Advanced Sorting and Columns- Parameters:
itemName
- menu item name
-
advancedSort
public void advancedSort(java.lang.String firstColumnName, java.lang.String firstSortOrder, java.lang.String secondColmnName, java.lang.String secondSortOrder)Perform an advanced search using the cell header context menu- Parameters:
firstColumnName
- first column to sortfirstSortOrder
- first column's sort ordersecondColumnName
- second column to sortsecondSortOrder
- second column's sort order
-
removeColumn
public void removeColumn(java.lang.String columnName)Remove (hide) a column from Grid- Parameters:
cloumnName
- column header label
-
addColumn
public void addColumn(java.lang.String columnName)Add (show) a column in the Grid- Parameters:
columnName
- column header label
-
addColumns
public void addColumns(java.lang.String[] columnNames)Add (show) provided columns in the grid- Parameters:
columnNames
- column headers label
-
getHeaderColumnNames
public java.util.List<java.lang.String> getHeaderColumnNames()Get the list of labelled Column header names.- Returns:
-
getColumnCount
public int getColumnCount()Get the header columns count including hidden.- Returns:
-
isEditable
public boolean isEditable(java.lang.String headerName)Checks whether the column is editable or not- Parameters:
headerName
-- Returns:
-
isRequired
public boolean isRequired(java.lang.String headerName)Checks whether the value to the column is required or not- Parameters:
headerName
-- Returns:
-
isErrorIcon
public boolean isErrorIcon(int rowIndex, java.lang.String columnName)Checks whether the cell has some error icon or not- Parameters:
rowIndex
-columnName
-- Returns:
-
getErrorMessage
public java.lang.String getErrorMessage(int rowNum, java.lang.String columnName)Checks whether the cell has some error icon, if yes then returns error message for that icon- Parameters:
rowNum
-columnName
-- Returns:
-
getErrorMessage
public java.lang.String getErrorMessage(int rowNum)Returns error message for first found error icon in the specified row.- Parameters:
rowNum
-- Returns:
-
dragRoleFromAvailToSelected
Drag a Role from one Grid to another Grid- Parameters:
roleName
-targetGrid
-
-
enableBulkEdit
public void enableBulkEdit() -
disableBulkEdit
public void disableBulkEdit() -
pasteToAllRows
public void pasteToAllRows() -
copyColumns
public void copyColumns(int rowIndex, java.lang.String... columnNames)- Parameters:
roleIndex
- - provide index of row from which we copy column contentcolumnName
- - this parameter accept value as - Select all editable columns [If we have to Select all editable columns] or mention list of columns
-
unselectCopiedColumns
public void unselectCopiedColumns(int rowIndex, java.lang.String... columnNames)- Parameters:
roleIndex
- - provide index of row from which we have to unselect copied column contentcolumnName
- - this parameter accept value as - Unselect all editable columns [If we have to Unselect all editable columns] or mention list of columns
-
pasteToRow
public void pasteToRow(int rowIndex)- Parameters:
roleIndex
- - provide index of row to which we have to paste copied column content
-
removeRow
public void removeRow(int rowIndex)Removes row from grid of model form- Parameters:
rowIndex
-
-
openAuditTrail
public void openAuditTrail(int rowIndex)Opens child audit trail from grid of model form- Parameters:
rowIndex
-
-