/** * find a table and select a cell in it. double click if requested * * @param operator * the operator to search in * @param fieldLabel * the column name * @param value * the value to search in the column cells * @param doubleClick * if True will double click the cell, False will only select */ public void selectInTable(ContainerOperator operator, String fieldLabel, Object value, boolean doubleClick) { JTableOperator table = new JTableOperator(operator); int column = table.findColumn(fieldLabel); int row = table.findCellRow(value.toString(), column, 0); if (doubleClick) { table.clickOnCell(row, column, 2); } else { table.selectCell(row, column); } }
/** * This method search for a String key in a table according to the given * table, column, and string key, and return the index (Row) of this key in * the table. * * @param tableOperator * - The table to search in * @param key * - The String to be found * @param keyColumn * - The column of the key to be search. * @return the row of the given key, in the table */ public int getTableRowIndexOfValue(JTableOperator tableOperator, String key, int keyColumn) { String value; for (int row = 0; row < tableOperator.getRowCount(); row++) { value = (String) tableOperator.getValueAt(row, keyColumn); if (value.equals(key)) { return row; } } return -1; }
private void selectCellArea(int startRow, int endRow, int startColumn, int endColumn) { jTableOperator.setRowSelectionAllowed(true); jTableOperator.addRowSelectionInterval(startRow, endRow); jTableOperator.setColumnSelectionAllowed(true); jTableOperator.addColumnSelectionInterval(startColumn, endColumn); }
public int findCellRow(String text, String columnIdentifier) { int col = jTableOperator.findColumn(columnIdentifier); if (col == -1) throw new RuntimeException("Column '" + columnIdentifier + " not found."); return jTableOperator.findCellRow(text, col, 0); }
public Component getCellRendererComponent(int row, int column) { TableCellRenderer renderer = jTableOperator.getCellRenderer(row, column); JTable table = (JTable) jTableOperator.getSource(); Object value = jTableOperator.getValueAt(row, column); boolean isSelected = jTableOperator.isCellSelected(row, column); boolean hasFocus = jTableOperator.hasFocus(); return getTableCellRendererComponentSmoothly(row, column, renderer, table, value, isSelected, hasFocus); }
paramTable.clickOnCell(row, column); JComboBoxOperator combo = new JComboBoxOperator(paramTable); combo.setEnabled(true); combo.selectItem(value); } else { paramTable.clickOnCell(row, column); paramTable.changeCellObject(row, column, value); report("----- Setting Table cell,Row=" + row + ",column=" + column + ",value=" + value + "-attempt " + i); currentValue = paramTable.getValueAt(row, column).toString(); i++;
public TableOperator createOperatorByIndex(int index) { return new TableOperator(new JTableOperator((ContainerOperator) Context.getContext(), index)); }
/** * will return the value in table cell locate in Row= row and Column=column * * @param paramTable * @param row * @param column * @return */ public Object getTableCellValue(JTableOperator paramTable, int row, int column) { return paramTable.getValueAt(row, column); }
public int findCellRow(String text) { return jTableOperator.findCellRow(text); }
public int getRowCount() { return jTableOperator.getRowCount(); }
public void selectCell(String row, String columnIdentifier) { Point coordinates = findCell(row, columnIdentifier); jTableOperator.selectCell(coordinates.y, coordinates.x); }
public void typeIntoCell(Object newValue, String row, String columnIdentifier) { Point coordinates = findCell(row, columnIdentifier); jTableOperator.changeCellObject(coordinates.y, coordinates.x, newValue); // See // http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=197 ensureEnterIsReleased(); }
public void clickOnCell(String rowNumber, String columnIdentifier, String clickCount, String button, String[] keyModifiers) { Point cell = findCell(rowNumber, columnIdentifier); jTableOperator.clickOnCell(cell.y, cell.x, Integer.parseInt(clickCount), toInputEventMask(button), toCombinedInputEventMasks(keyModifiers)); }
/** Tries to find null JTable in this dialog. * @return JTableOperator */ public JTableOperator tabSourcePackageFolders() { if (_tabSourcePackageFolders==null) { if (lblSourcePackageFolders().getLabelFor()!=null) { _tabSourcePackageFolders = new JTableOperator( (JTable) lblSourcePackageFolders().getLabelFor()); } else { _tabSourcePackageFolders = new JTableOperator(this); } } return _tabSourcePackageFolders; }
public TableOperator createOperatorByName(String name) { return new TableOperator(new JTableOperator((ContainerOperator) Context.getContext(), new ByNameComponentChooser(name))); } }