1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.setup.Panel; 25 26 import org.openoffice.setup.PanelHelper.PanelLabel; 27 import org.openoffice.setup.PanelHelper.PanelTitle; 28 import org.openoffice.setup.ResourceManager; 29 import java.awt.BorderLayout; 30 import java.awt.ComponentOrientation; 31 import java.awt.Dimension; 32 import java.awt.Insets; 33 import javax.swing.JEditorPane; 34 import javax.swing.JPanel; 35 import javax.swing.JScrollBar; 36 import javax.swing.JScrollPane; 37 import javax.swing.border.EmptyBorder; 38 import org.openoffice.setup.InstallData; 39 40 public class InstallationImminent extends JPanel { 41 42 private String infoText; 43 private JEditorPane ProductInformation; 44 private JScrollPane ProductPane; 45 private PanelTitle titlebox; 46 InstallationImminent()47 public InstallationImminent() { 48 49 InstallData data = InstallData.getInstance(); 50 51 setLayout(new java.awt.BorderLayout()); 52 setBorder(new EmptyBorder(new Insets(10, 10, 10, 10))); 53 54 String titletext = ResourceManager.getString("String_InstallationImminent1"); 55 titlebox = new PanelTitle(titletext); 56 add(titlebox, BorderLayout.NORTH); 57 58 JPanel contentpanel = new JPanel(); 59 contentpanel.setLayout(new java.awt.BorderLayout()); 60 if ( data.useRtl() ) { contentpanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 61 62 String text1 = ResourceManager.getString("String_InstallationImminent2"); 63 PanelLabel label1 = new PanelLabel(text1); 64 if ( data.useRtl() ) { label1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 65 66 ProductInformation = new JEditorPane("text/html", getInfoText()); 67 ProductInformation.setEditable(false); 68 if ( data.useRtl() ) { ProductInformation.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 69 70 ProductPane = new JScrollPane(ProductInformation); 71 ProductPane.setPreferredSize(new Dimension(250, 145)); 72 ProductPane.setBorder(new EmptyBorder(10, 0, 10, 0)); 73 if ( data.useRtl() ) { ProductPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 74 75 contentpanel.add(label1, BorderLayout.NORTH); 76 contentpanel.add(ProductPane, BorderLayout.CENTER); 77 78 add(contentpanel, BorderLayout.CENTER); 79 } 80 setInfoText(String text)81 public void setInfoText(String text) { 82 infoText = text; 83 updateInfoText(); 84 } 85 setTitleText(String s)86 public void setTitleText(String s) { 87 titlebox.setTitle(s); 88 } 89 getInfoText()90 public String getInfoText() { 91 return infoText; 92 } 93 updateInfoText()94 public void updateInfoText() { 95 ProductInformation.setText(infoText); 96 } 97 setTabOrder()98 public void setTabOrder() { 99 JScrollBar ScrollBar = ProductPane.getVerticalScrollBar(); 100 if ( ScrollBar.isShowing() ) { 101 ProductInformation.setFocusable(true); 102 } else { 103 ProductInformation.setFocusable(false); 104 } 105 } 106 setCaretPosition()107 public void setCaretPosition() { 108 ProductInformation.setCaretPosition(0); 109 } 110 111 } 112