public static int FindColumnIndex(string id, GuiTableControl table, GuiSession session, string columnName) { if (table == null && string.IsNullOrEmpty(id)) { throw new Exception("Parameters for the Target object not provided: id or GuiTableControl object"); } if (session == null) { throw new Exception("SAP session parameter is required and was not provided."); } if (table == null) { table = (GuiTableControl)(session).FindById(id); } IEnumerator <GuiTableColumn> cols = table.Columns.Cast <GuiTableColumn>().GetEnumerator(); int counter = 0; string colname; while (cols.MoveNext()) { colname = ((GuiComponent)cols.Current).Name; if (colname.ToUpper().Trim().Replace(" ", "").Equals(columnName.Trim().ToUpper().Replace(" ", ""))) { return(counter); } ; counter++; } return(-1); }
public static int[] FindColumnIndexByName(string id, GuiTableControl table, GuiSession session, string columnTitle) { if (table == null && string.IsNullOrEmpty(id)) { throw new Exception("Parameters for the Target object not provided: id or GuiTableControl object"); } if (session == null) { throw new Exception("SAP session parameter is required and was not provided."); } if (table == null) { table = (GuiTableControl)(session).FindById(id); } List <int> output = new List <int>(); int index = 0; foreach (GuiTableColumn c in table.Columns) { if (columnTitle.ToLower().Trim().Equals(c.Title.ToLower().Trim())) { output.Add(index); } index++; } return(output.ToArray()); }
public string Table_GetCellValue(string TableID, int rowIndex, int columnIndex) { GuiSession SapSession = getCurrentSession(); GuiTableControl tblControl = (GuiTableControl)SapSession.ActiveWindow.FindById(TableID, "GuiTableControl"); tblControl.SetFocus(); return(tblControl.GetCell(Convert.ToInt32(rowIndex), Convert.ToInt32(columnIndex)).Text); }
public GuiClassVariable(GuiTableControl table, int rowIndex, int nameIndex, int typeIndex, int visibilityIndex, int typingIndex) { this.table = table; this.rowIndex = rowIndex; this.nameIndex = nameIndex; this.typeIndex = typeIndex; this.visibilityIndex = visibilityIndex; this.typingIndex = typingIndex; }
public static T FindDescendantByProperty <T>(this GuiTableControl TableControl, Func <T, bool> Property = null) where T : class { if (Property == null) { Property = new Func <T, bool>(t => true); } return(findDescendantByPropertyTemplate <T>(TableControl.Children, Property)); }
public static void SetBatchValues(this GuiTableControl table, List <string> Values, Action <int> process = null) { List <List <Tuple <int, string> > > datas = Values.Select(s => new List <Tuple <int, string> >() { new Tuple <int, string>(1, s) }).ToList(); SAPFEExtension.SetBatchValues(table, datas, process); }
public bool TableRow_Select(string strControlID, string RowIndex) { int intRowIndex = Convert.ToInt32(RowIndex); GuiSession SapSession = getCurrentSession(); GuiTableControl tblControl = (GuiTableControl)SapSession.ActiveWindow.FindById(strControlID, "GuiTableControl"); tblControl.SetFocus(); tblControl.GetAbsoluteRow(intRowIndex).Selected = true; return(true); }
public static void SetBatchValues(this GuiTableControl table, List <List <Tuple <int, string> > > Values, Action <int> process = null) { var component = table as GuiComponent; while ((component is GuiSession) == false) { component = component.Parent; } var session = component as GuiSession; var id = table.Id; var pageSize = table.VerticalScrollbar.PageSize; int row = 0; int range = pageSize - 1; for (int i = 0; i < Values.Count; i++) { if (row != 0 && row % range == 0) { table.VerticalScrollbar.Position += pageSize; table = session.FindById <GuiTableControl>(id); //table = SAPTestHelper.Current.PopupWindow.FindByName<GuiTableControl>("SAPLALDBSINGLE"); } if (i < range) { for (int j = 0; j < Values[i].Count; j++) { var rowData = Values[i]; table.GetCell(row, rowData[j].Item1).Text = rowData[j].Item2; } } else { for (int j = 0; j < Values[i].Count; j++) { var rowData = Values[i]; table.GetCell(row % range + 1, rowData[j].Item1).Text = rowData[j].Item2; } } row++; if (process != null) { process(i + 1); } } }
public static int RowsCountBasedOnEmptyField(string id, GuiTableControl table, GuiSession session, string SAPColumnName, string columnNameToTest) { if (table == null && string.IsNullOrEmpty(id)) { throw new Exception("Parameters for the Target object not provided: id or GuiTableControl object"); } if (session == null) { throw new Exception("SAP session parameter is required and was not provided."); } if (table == null) { table = (GuiTableControl)(session).FindById(id); } string tableid = table.Id; int output = 0; GuiVComponent next; GuiVComponent current; table.VerticalScrollbar.Position = 0; table = (GuiTableControl)((GuiSession)session).FindById(tableid); bool aux = true; do { table.VerticalScrollbar.Position = output; table = (GuiTableControl)((GuiSession)session).FindById(tableid); current = (GuiVComponent)table.FindById(SAPColumnName.ToString() + "[" + FindColumnIndex(id, table, session, columnNameToTest).ToString() + ",0]", false); next = (GuiVComponent)table.FindById(SAPColumnName.ToString() + "[" + FindColumnIndex(id, table, session, columnNameToTest).ToString() + ",1]", false); if (current != null && !String.IsNullOrEmpty(current.Text.Trim()) && !(new Regex("^_+$").Match(current.Text).Success)) { output = output + 1; } if (next == null || String.IsNullOrEmpty(next.Text.Trim()) || new Regex("^_+$").Match(next.Text).Success) { aux = false; } } while (aux); table.VerticalScrollbar.Position = 0; return(output); }
/// <summary>Note: Do not iterate through this ienumerable more than once</summary> public static IEnumerable <GuiTableRow> AsEnumerable(this GuiTableControl table) { var container = table.Parent as dynamic; string name = table.Name, type = table.Type; int rowCount = table.VerticalScrollbar.Maximum; Func <GuiTableControl> getTable = () => container.FindByName(name, type) as GuiTableControl; for (int i = 0; i <= rowCount; i++) { getTable().VerticalScrollbar.Position = i; yield return(getTable().Rows.Item(0) as GuiTableRow); } }
public static GuiTableControl MoveScroll(string id, GuiTableControl table, GuiSession session, int position) { if (table == null && string.IsNullOrEmpty(id)) { throw new Exception("Parameters for the Target object not provided: id or GuiTableControl object"); } if (session == null) { throw new Exception("SAP session parameter is required and was not provided."); } if (table == null) { table = (GuiTableControl)(session).FindById(id); } string tableid = table.Id; table.VerticalScrollbar.Position = position; return((GuiTableControl)((GuiSession)session).FindById(tableid)); }
public ClassVariableColumnIndexDefinition(GuiTableControl table, ClassVariableColumnNameDefinition definition) { for (int i = 0; i < table.Columns.Count; i++) { GuiVComponent component = table.GetCell(i, 0); string columnName = component.Name; if (columnName.Equals(definition.GetTypingColumn())) { typingIndex = i; } if (columnName.Equals(definition.GetTypingColumn())) { typeIndex = i; } if (columnName.Equals(definition.GetTypingColumn())) { visibilityIndex = i; } if (columnName.Equals(definition.GetTypingColumn())) { nameIndex = i; } } }
public static T FindById <T>(this GuiTableControl TableControl, string Id) where T : class { return(findByIdTemplate <T>(Id, TableControl.FindById)); }
public static IEnumerable <T> FindDescendantsByProperty <T>(this GuiTableControl TableControl, Func <T, bool> Property = null) where T : class { return(findDescendantsByPropertyTemplate <T>(TableControl.Children, Property)); }
public GuiClassVariable2(GuiTableRow row, GuiTableControl table, ClassVariableColumnNameDefinition definition) : this(row, new ClassVariableColumnIndexDefinition(table, definition)) { }
public static T GetCell <T>(this GuiTableControl Table, int row, int col) where T : class { return(Table.GetCell(row, col) as T); }
public static IEnumerable <T> FindAllByName <T>(this GuiTableControl TableControl, string Name) where T : class { return(findAllByNameTemplate <T>(Name, TableControl.FindAllByName)); }
public static T FindByNameEx <T>(this GuiTableControl TableControl, string Name, int TypeId) where T : class { return(findByNameExTemplate <T>(Name, TypeId, TableControl.FindByNameEx)); }
public static T FindChildByProperty <T>(this GuiTableControl TableControl, Func <T, bool> Property = null) where T : class { return(findChildByPropertyTemplate <T>(TableControl.Children, Property)); }
public GuiClassVariableFactory(GuiTableControl table, ClassVariableColumnNameDefinition definition) { this.table = table; this.definition = new ClassVariableColumnIndexDefinition(table, definition); }