src/main/java/org/sikuli/slides/driver/WidgetSlideFactory.java
public static <T> T create(Class<T> classToProxy) {

		if (!classToProxy.isAnnotationPresent(WidgetSlide.class))
			// path to pptx file is not specified
			throw new RuntimeException("@Source annotation is missing in " + classToProxy + ". Need this to know where" +
					"to read slides");

		WidgetSlide source = classToProxy.getAnnotation(WidgetSlide.class);
		source.value();
		
//		if (source.url().isEmpty() > 0){
		SlidesReader reader = new PPTXSlidesReader();

		List<Slide> slides;
//		File file = new File(source.value());
		try {
			
			if (!source.value().isEmpty()){
				slides = reader.read(new File(source.value()));	
			}else if (!source.url().isEmpty()){
				slides = reader.read(new URL(source.url()));
			}else{
				throw new RuntimeException("@Source is not specified correctly");
			}
			
		} catch (IOException e) {
			// error in reading the slides from the given source 
			throw new RuntimeException(e);
		}
		
		DefaultSlideDriver driver;
		if (slides.size() == 0){
			// there is no slide found
			driver = new DefaultSlideDriver();
		}else{

			driver = new DefaultSlideDriver(slides.get(0));
		}

		T page = instantiatePage(driver, classToProxy);		
		initElements(driver, page);
		return page;
	}
public static <T> T create(Class<T> classToProxy) {

		if (!classToProxy.isAnnotationPresent(WidgetSlide.class))
			// path to pptx file is not specified
			throw new RuntimeException("@Source annotation is missing in " + classToProxy + ". Need this to know where" +
					"to read slides");

		WidgetSlide source = classToProxy.getAnnotation(WidgetSlide.class);
		source.value();
		
//		if (source.url().isEmpty() > 0){
		SlidesReader reader = new PPTXSlidesReader();

		List<Slide> slides;
//		File file = new File(source.value());
		try {
			
			if (!source.value().isEmpty()){
				slides = reader.read(new File(source.value()));	
			}else if (!source.url().isEmpty()){
				slides = reader.read(new URL(source.url()));
			}else{
				throw new RuntimeException("@Source is not specified correctly");
			}
			
		} catch (IOException e) {
			// error in reading the slides from the given source 
			throw new RuntimeException(e);
		}
		
		DefaultSlideDriver driver;
		if (slides.size() == 0){
			// there is no slide found
			driver = new DefaultSlideDriver();
		}else{

			driver = new DefaultSlideDriver(slides.get(0));
		}

		T page = instantiatePage(driver, classToProxy);		
		initElements(driver, page);
		return page;
	}
public static < T > T create ( Class < T > classToProxy ) { if ( ! classToProxy . isAnnotationPresent ( WidgetSlide . class ) ) // path to pptx file is not specified throw new RuntimeException ( "@Source annotation is missing in " + classToProxy + ". Need this to know where" + "to read slides" ) ; WidgetSlide source = classToProxy . getAnnotation ( WidgetSlide . class ) ; source . value ( ) ; //		if (source.url().isEmpty() > 0){ SlidesReader reader = new PPTXSlidesReader ( ) ; List < Slide > slides ; //		File file = new File(source.value()); try { if ( ! source . value ( ) . isEmpty ( ) ) { slides = reader . read ( new File ( source . value ( ) ) ) ; } else if ( ! source . url ( ) . isEmpty ( ) ) { slides = reader . read ( new URL ( source . url ( ) ) ) ; } else { throw new RuntimeException ( "@Source is not specified correctly" ) ; } } catch ( IOException e ) { // error in reading the slides from the given source  throw new RuntimeException ( e ) ; } DefaultSlideDriver driver ; if ( slides . size ( ) == 0 ) { // there is no slide found driver = new DefaultSlideDriver ( ) ; } else { driver = new DefaultSlideDriver ( slides . get ( 0 ) ) ; } T page = instantiatePage ( driver , classToProxy ) ; initElements ( driver , page ) ; return page ; }
Create an object where each field represents an {@link Widget} that can be found and interacted with
automatically

@param classToProxy
@return
Create an object where each field represents an { @link Widget } that can be found and interacted with automatically