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 UninstallationImminent extends JPanel {
41 
42     private String infoText;
43     private JEditorPane ProductInformation;
44     private JScrollPane ProductPane;
45 
UninstallationImminent()46     public UninstallationImminent() {
47 
48         InstallData data = InstallData.getInstance();
49 
50         setLayout(new java.awt.BorderLayout());
51         setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
52 
53         String titletext = ResourceManager.getString("String_UninstallationImminent1");
54         PanelTitle titlebox = new PanelTitle(titletext);
55         add(titlebox, BorderLayout.NORTH);
56 
57         JPanel contentpanel = new JPanel();
58         contentpanel.setLayout(new java.awt.BorderLayout());
59         if ( data.useRtl() ) { contentpanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
60 
61         String text1 = ResourceManager.getString("String_UninstallationImminent2");
62         PanelLabel label1 = new PanelLabel(text1);
63         if ( data.useRtl() ) { label1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
64 
65         ProductInformation = new JEditorPane("text/html", getInfoText());
66         ProductInformation.setEditable(false);
67         if ( data.useRtl() ) { ProductInformation.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
68 
69         ProductPane = new JScrollPane(ProductInformation);
70         ProductPane.setPreferredSize(new Dimension(250, 145));
71         ProductPane.setBorder(new EmptyBorder(10, 0, 10, 0));
72         if ( data.useRtl() ) { ProductPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
73 
74         contentpanel.add(label1, BorderLayout.NORTH);
75         contentpanel.add(ProductPane, BorderLayout.CENTER);
76 
77         add(contentpanel, BorderLayout.CENTER);
78     }
79 
setInfoText(String text)80     public void setInfoText(String text) {
81         infoText = text;
82         updateInfoText();
83     }
84 
getInfoText()85     public String getInfoText() {
86         return infoText;
87     }
88 
updateInfoText()89     public void updateInfoText() {
90         ProductInformation.setText(infoText);
91     }
92 
setTabOrder()93     public void setTabOrder() {
94         JScrollBar ScrollBar = ProductPane.getVerticalScrollBar();
95         if ( ScrollBar.isShowing() ) {
96             ProductInformation.setFocusable(true);
97         } else {
98             ProductInformation.setFocusable(false);
99         }
100     }
101 
setCaretPosition()102     public void setCaretPosition() {
103         ProductInformation.setCaretPosition(0);
104     }
105 
106 }
107