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.io.IOException;
19
20import org.tp23.antinstaller.InstallException;
21import org.tp23.antinstaller.InstallerContext;
22import org.tp23.antinstaller.page.Page;
23
24public class AutoTextRunner extends TextRunner {
25    
26    public AutoTextRunner(InstallerContext ctx) throws IOException{
27        super(ctx);
28    }
29
30    public boolean runInstaller() throws InstallException {
31        Page[] pages = installer.getPages();
32        // run all postDisplayTargets as if the pages were shown
33        for (int i = 0; i < pages.length; i++) {
34            Page page = pages[i];
35            if(page.getPostDisplayTarget() != null) {
36                if( ifHelper.ifProperty(page) && 
37                    ifHelper.ifTarget(page, ctx.getInstaller().getPages()) ) { // page would have been shown
38                    runPost(page);
39                }
40            }
41        }
42
43        return true;
44    }
45}
46