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.renderer.text;
17
18import java.io.IOException;
19
20import org.tp23.antinstaller.InstallException;
21import org.tp23.antinstaller.page.Page;
22import org.tp23.antinstaller.page.SplashPage;
23
24public class SplashPageRenderer extends AbstractTextPageRenderer {
25    public SplashPageRenderer() {
26    }
27    public boolean renderPage(Page page) throws InstallException {
28        if (page instanceof SplashPage) {
29            SplashPage sPage = (SplashPage) page;
30            return renderSplashPage(sPage);
31        }
32        else {
33            throw new InstallException("Wrong Renderer in SplashPageRenderer.renderPage");
34        }
35    }
36    private boolean renderSplashPage(SplashPage page) throws InstallException {
37        try {
38            printHeader(page);
39            out.println();
40            out.println(page.getAltText());
41
42            reader.read();
43            return true;
44        }
45        catch (IOException ex) {
46            throw new InstallException("IOException");
47        }
48    }
49}
50