in Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/complex/table/Table.java [149:217]
public void setup(Field field) {
if (!fieldHasAnnotation(field, JTable.class, ITable.class))
return;
JTable jTable = field.getAnnotation(JTable.class);
By root = findByToBy(jTable.root());
if (root == null)
root = findByToBy(jTable.jRoot());
setLocator(root);
By headers = findByToBy(jTable.headers());
By rowNames = findByToBy(jTable.rowNames());
cellLocatorTemplate = findByToBy(jTable.cell());
columns.lineTemplate = findByToBy(jTable.column());
rows.lineTemplate = findByToBy(jTable.row());
footerLocator = findByToBy(jTable.footer());
columns.startIndex = jTable.colStartIndex();
rows.startIndex = jTable.rowStartIndex();
if (headers == null)
headers = findByToBy(jTable.jHeaders());
if (rowNames == null)
rowNames = findByToBy(jTable.jRowNames());
if (cellLocatorTemplate == null)
cellLocatorTemplate = findByToBy(jTable.jCell());
if (!columns.locatorChanged())
columns.lineTemplate = findByToBy(jTable.jColumn());
if (!rows.locatorChanged())
rows.lineTemplate = findByToBy(jTable.jRow());
if (footerLocator == null)
footerLocator = findByToBy(jTable.jFooter());
if (headers != null)
columns.headersLocator = headers;
if (rowNames != null)
rows.headersLocator = rowNames;
if (jTable.header().length > 0)
hasColumnHeaders(asList(jTable.header()));
if (jTable.rowsHeader().length > 0)
hasRowHeaders(asList(jTable.rowsHeader()));
if (jTable.height() > 0)
setColumnsCount(jTable.height());
if (jTable.width() > 0)
setRowsCount(jTable.width());
if (!jTable.size().equals("")) {
String[] split = jTable.size().split("x");
if (split.length == 1)
split = jTable.size().split("X");
if (split.length != 2)
throw exception("Can't setup Table from attribute. Bad size: " + jTable.size());
setColumnsCount(parseInt(split[0]));
setRowsCount(parseInt(split[1]));
}
switch (jTable.headerType()) {
case COLUMNS_HEADERS:
hasOnlyColumnHeaders();
break;
case ROWS_HEADERS:
hasOnlyRowHeaders();
break;
case ALL_HEADERS:
hasAllHeaders();
break;
case NO_HEADERS:
hasNoHeaders();
break;
}
useCache(jTable.useCache());
}