All Downloads are FREE. Search and download functionalities are using the official Maven repository.

okw.gui.OKW_WaitForValue Maven / Gradle / Ivy

Go to download

This is the core-module of OpenKeyWord. This module is automatically integrated by the adapters. In GUI automation, the core module is automatically integrated by the GUI modules (dependencies).

There is a newer version: 0.2.44
Show newest version
package okw.gui;
 
import java.util.ArrayList;
 
public class OKW_WaitForValue
{
        IGUI myObject;
       
        private static Integer CalculateLoopCount(Integer SleepForMillis, Integer MaxWaitMilis)
        {
                Integer lviReturn = MaxWaitMilis/SleepForMillis;
               
                return lviReturn;
        }
       
        public OKW_WaitForValue(IGUI GUIObject)
        {
                myObject = GUIObject;
        }

        public ArrayList getCaption(ArrayList Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                ArrayList ALReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
               
                        Integer Count = 0;
                       
                        while (Count <= MaxCount)
                        {
                                ALReturn = myObject.getCaption();
                       
                                if (Expected.equals(ALReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                Count++;
                        }
 
                        return ALReturn;
        }

        public ArrayList getValue(ArrayList Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                ArrayList ALReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
                Integer Count = 0;
                       
                while (Count <= MaxCount)
                        {
                                ALReturn = myObject.getValue();
                       
                                if (Expected.equals(ALReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                return ALReturn;
        }
 
        public Boolean getExists(Boolean Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                Boolean bReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
                Integer Count = 0;
                       
                while (Count <= MaxCount)
                        {
                                bReturn = myObject.getExists();
                       
                                if (Expected.equals(bReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                return bReturn;
        }

        public Boolean getIsActive(Boolean Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                Boolean bReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
                Integer Count = 0;
                       
                while (Count <= MaxCount)
                        {
                                bReturn = myObject.getIsActive();
                       
                                if (Expected.equals(bReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                return bReturn;
        }
     
        public Boolean getHasActive(Boolean Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                Boolean bReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
                Integer Count = 0;
                       
                while (Count <= MaxCount)
                        {
                                bReturn = myObject.getHasFocus();
                       
                                if (Expected.equals(bReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                return bReturn;
        }

        public Boolean getHasFocus(Boolean Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                Boolean bReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
                Integer Count = 0;
                       
                while (Count <= MaxCount)
                        {
                                bReturn = myObject.getHasFocus();
                       
                                if (Expected.equals(bReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                return bReturn;
        }
      
        public ArrayList getLabel(ArrayList Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                ArrayList ALReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
               
                        Integer Count = 0;
                       
                        while (Count <= MaxCount)
                        {
                                ALReturn = myObject.getLabel();
                       
                                if (Expected.equals(ALReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                        return ALReturn;
        }

        public ArrayList getTooltip(ArrayList Expected, Integer SleepForMillis, Integer MaxWaitMilis) throws InterruptedException
        {
                ArrayList ALReturn = null;
               
                Integer MaxCount = CalculateLoopCount( SleepForMillis, MaxWaitMilis);
               
               
                        Integer Count = 0;
                       
                        while (Count <= MaxCount)
                        {
                                ALReturn = myObject.getTooltip();
                       
                                if (Expected.equals(ALReturn))
                                {
                                        break;
                                }
                                else                                   
                                {
                                        Thread.sleep(SleepForMillis);
                                }
                                
                                Count++;
                        }
 
                        return ALReturn;
        }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy