// Path: src/main/java/org/robotframework/formslibrary/operator/HorizontalScrollBarOperator.java
// public class HorizontalScrollBarOperator extends AbstractComponentOperator {
// 
//     /**
//      * Initialize a HorizontalScrollBarOperator with the n'th horizontal scroll
//      * bar in the current context.
//      * 
//      * @param index
//      *            0 (first), 1 (second), ...
//      */
//     public HorizontalScrollBarOperator(int index) {
//         super(new CompositeChooser(new ByOrientationChooser(ByOrientationChooser.Orientation.HORIZONTAL),
//                 new ByComponentTypeChooser(index, ComponentType.ALL_SCROLL_BAR_TYPES)));
//     }
// 
//     /**
//      * Scroll left by pressing the left arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollLeft(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component leftButton = null;
//         if (buttons[1].getX() < buttons[0].getX()) {
//             leftButton = buttons[1];
//         } else {
//             leftButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(leftButton, "simulatePush");
//         }
//     }
// 
//     /**
//      * Scroll right by pressing the right arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollRight(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component rightButton = null;
//         if (buttons[1].getX() > buttons[0].getX()) {
//             rightButton = buttons[1];
//         } else {
//             rightButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(rightButton, "simulatePush");
//         }
//     }
// }
// 
// Path: src/main/java/org/robotframework/formslibrary/operator/VerticalScrollBarOperator.java
// public class VerticalScrollBarOperator extends AbstractComponentOperator {
// 
//     /**
//      * Initialize a VerticalScrollBarOperator with the n'th vertical scroll bar
//      * in the current context.
//      * 
//      * @param index
//      *            0 (first), 1 (second), ...
//      */
//     public VerticalScrollBarOperator(int index) {
//         super(new CompositeChooser(new ByOrientationChooser(ByOrientationChooser.Orientation.VERTICAL),
//                 new ByComponentTypeChooser(index, ComponentType.ALL_SCROLL_BAR_TYPES)));
//     }
// 
//     /**
//      * Scroll up by pressing the up arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollUp(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component upButton = null;
//         if (buttons[1].getY() < buttons[0].getY()) {
//             upButton = buttons[1];
//         } else {
//             upButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(upButton, "simulatePush");
//         }
//     }
// 
//     /**
//      * Scroll down by pressing the down arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollDown(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component downButton = null;
//         if (buttons[1].getY() > buttons[0].getY()) {
//             downButton = buttons[1];
//         } else {
//             downButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(downButton, "simulatePush");
//         }
//     }
// }


import org.robotframework.formslibrary.operator.HorizontalScrollBarOperator;
import org.robotframework.formslibrary.operator.VerticalScrollBarOperator;
import org.robotframework.javalib.annotation.ArgumentNames;
import org.robotframework.javalib.annotation.RobotKeyword;
import org.robotframework.javalib.annotation.RobotKeywordOverload;
import org.robotframework.javalib.annotation.RobotKeywords;

package org.robotframework.formslibrary.keyword;


@RobotKeywords
public class ScrollBarKeywords {

    @RobotKeyword("Scroll down in the current window by clicking the down arrow button on a vertical scrollbar.\\n\\n Specify how many times the button should be clicked in the count parameter. One click scrolls approximately one table row. If multiple vertical scrollbars exist in the window, you can optionnally specify the scroll bar index to indicate which scrollbar should be used. Use index 1 for the first scrollbar, 2 for the second, and so on. Example:\\n | Scroll Down | _count_ ||\\\\n | Scroll Down | _count_ | _index_ |\\n")
    @ArgumentNames({ "count", "index=" })
    public void scrollDown(int count, int index) {

// Path: src/main/java/org/robotframework/formslibrary/operator/HorizontalScrollBarOperator.java
// public class HorizontalScrollBarOperator extends AbstractComponentOperator {
// 
//     /**
//      * Initialize a HorizontalScrollBarOperator with the n'th horizontal scroll
//      * bar in the current context.
//      * 
//      * @param index
//      *            0 (first), 1 (second), ...
//      */
//     public HorizontalScrollBarOperator(int index) {
//         super(new CompositeChooser(new ByOrientationChooser(ByOrientationChooser.Orientation.HORIZONTAL),
//                 new ByComponentTypeChooser(index, ComponentType.ALL_SCROLL_BAR_TYPES)));
//     }
// 
//     /**
//      * Scroll left by pressing the left arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollLeft(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component leftButton = null;
//         if (buttons[1].getX() < buttons[0].getX()) {
//             leftButton = buttons[1];
//         } else {
//             leftButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(leftButton, "simulatePush");
//         }
//     }
// 
//     /**
//      * Scroll right by pressing the right arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollRight(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component rightButton = null;
//         if (buttons[1].getX() > buttons[0].getX()) {
//             rightButton = buttons[1];
//         } else {
//             rightButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(rightButton, "simulatePush");
//         }
//     }
// }
// 
// Path: src/main/java/org/robotframework/formslibrary/operator/VerticalScrollBarOperator.java
// public class VerticalScrollBarOperator extends AbstractComponentOperator {
// 
//     /**
//      * Initialize a VerticalScrollBarOperator with the n'th vertical scroll bar
//      * in the current context.
//      * 
//      * @param index
//      *            0 (first), 1 (second), ...
//      */
//     public VerticalScrollBarOperator(int index) {
//         super(new CompositeChooser(new ByOrientationChooser(ByOrientationChooser.Orientation.VERTICAL),
//                 new ByComponentTypeChooser(index, ComponentType.ALL_SCROLL_BAR_TYPES)));
//     }
// 
//     /**
//      * Scroll up by pressing the up arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollUp(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component upButton = null;
//         if (buttons[1].getY() < buttons[0].getY()) {
//             upButton = buttons[1];
//         } else {
//             upButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(upButton, "simulatePush");
//         }
//     }
// 
//     /**
//      * Scroll down by pressing the down arrow button in the scroll bar.
//      * 
//      * @param count
//      *            number of times to press the button.
//      */
//     public void scrollDown(int count) {
//         Component[] buttons = ((Container) getSource()).getComponents();
//         Component downButton = null;
//         if (buttons[1].getY() > buttons[0].getY()) {
//             downButton = buttons[1];
//         } else {
//             downButton = buttons[0];
//         }
//         for (int i = 0; i < count; i++) {
//             ObjectUtil.invokeMethod(downButton, "simulatePush");
//         }
//     }
// }


// Path: src/main/java/org/robotframework/formslibrary/keyword/ScrollBarKeywords.java
import org.robotframework.formslibrary.operator.HorizontalScrollBarOperator;
import org.robotframework.formslibrary.operator.VerticalScrollBarOperator;
import org.robotframework.javalib.annotation.ArgumentNames;
import org.robotframework.javalib.annotation.RobotKeyword;
import org.robotframework.javalib.annotation.RobotKeywordOverload;
import org.robotframework.javalib.annotation.RobotKeywords;

package org.robotframework.formslibrary.keyword;


@RobotKeywords
public class ScrollBarKeywords {

    @RobotKeyword("Scroll down in the current window by clicking the down arrow button on a vertical scrollbar.\\n\\n Specify how many times the button should be clicked in the count parameter. One click scrolls approximately one table row. If multiple vertical scrollbars exist in the window, you can optionnally specify the scroll bar index to indicate which scrollbar should be used. Use index 1 for the first scrollbar, 2 for the second, and so on. Example:\\n | Scroll Down | _count_ ||\\\\n | Scroll Down | _count_ | _index_ |\\n")
    @ArgumentNames({ "count", "index=" })
    public void scrollDown(int count, int index) {

        new VerticalScrollBarOperator(index - 1).scrollDown(count);
