Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ListView and ListItem components. #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions SeleniumTools/src/com/redheap/selenium/component/AdfListItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.redheap.selenium.component;

import org.openqa.selenium.WebDriver;

public class AdfListItem extends AdfComponent {

public AdfListItem(WebDriver webDriver, String clientId) {
super(webDriver, clientId);
}

}
29 changes: 29 additions & 0 deletions SeleniumTools/src/com/redheap/selenium/component/AdfListView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.redheap.selenium.component;

import java.util.ArrayList;
import java.util.List;

import org.openqa.selenium.WebDriver;

public class AdfListView extends AdfComponent {

private static final String JS_SELECTED_ROWS =
JS_FIND_PEER +
"var keys=Object.keys(comp.getSelectedRowKeys()); var retval=[]; keys.forEach(function(key){retval.push(peer.getRowIndex(key))}); return retval;";

public AdfListView(WebDriver webDriver, String clientId) {
super(webDriver, clientId);
}

public List<Integer> getSelectedRows() {
return rowIndices((List<Long>) executeScript(JS_SELECTED_ROWS, getClientId()));
}

private List<Integer> rowIndices(List<Long> longs) {
List<Integer> retval = new ArrayList<Integer>(longs.size());
for (Long l : longs) {
retval.add(l.intValue());
}
return retval;
}
}