01: /*
02: * Copyright 2005 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: */
16: package org.tp23.antinstaller.runtime;
17:
18: import java.util.List;
19:
20: import org.tp23.antinstaller.InstallerContext;
21: import org.tp23.antinstaller.page.Page;
22: import org.tp23.antinstaller.renderer.swing.SwingPageRenderer;
23:
24: /**
25: * Swing runner that starts with the last page bypassing all the other pages.
26: * This will be used during auto builds where the properties are already known.
27: * @author teknopaul
28: *
29: */
30: public class AutoSwingRunner extends SwingRunner {
31:
32: public AutoSwingRunner(InstallerContext ctx) {
33: super (ctx);
34: }
35:
36: protected void showFirstPage() throws Exception {
37: Page[] pages = installer.getPages();
38: // run all postDisplayTargets as if the pages were shown
39: for (int i = 0; i < pages.length; i++) {
40: Page page = pages[i];
41: if (page.getPostDisplayTarget() != null) {
42: if (ifHelper.ifProperty(page)
43: && ifHelper.ifTarget(page, ctx.getInstaller()
44: .getPages())) { // page would have been shown
45: runPost(page);
46: }
47: }
48: }
49:
50: // shows the LAST page directly which should be the Progress page
51: ctx.setCurrentPage(pages[pages.length - 1]);
52: List pageRenderers = getPageRenderers();
53: renderNext((SwingPageRenderer) pageRenderers.get(pageRenderers
54: .size() - 1));
55: }
56:
57: }
|