AutoSwingRunner.java |
1 /* 2 * Copyright 2005 Paul Hinds 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package org.tp23.antinstaller.runtime; 17 18import java.util.List; 19 20import org.tp23.antinstaller.InstallerContext; 21import org.tp23.antinstaller.page.Page; 22import org.tp23.antinstaller.renderer.swing.SwingPageRenderer; 23/** 24 * Swing runner that starts with the last page bypassing all the other pages. 25 * This will be used during auto builds where the properties are already known. 26 * @author teknopaul 27 * 28 */ 29public class AutoSwingRunner extends SwingRunner { 30 31 public AutoSwingRunner(InstallerContext ctx){ 32 super(ctx); 33 } 34 protected void showFirstPage() throws Exception { 35 Page[] pages = installer.getPages(); 36 // run all postDisplayTargets as if the pages were shown 37 for (int i = 0; i < pages.length; i++) { 38 Page page = pages[i]; 39 if(page.getPostDisplayTarget() != null){ 40 if( ifHelper.ifProperty(page) && 41 ifHelper.ifTarget(page, ctx.getInstaller().getPages()) ){ // page would have been shown 42 runPost(page); 43 } 44 } 45 } 46 47 // shows the LAST page directly which should be the Progress page 48 ctx.setCurrentPage(pages[pages.length - 1]); 49 List pageRenderers = getPageRenderers(); 50 renderNext((SwingPageRenderer)pageRenderers.get(pageRenderers.size() - 1)); 51 } 52 53} 54