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 org.openoffice.setup.SetupActionListener; 30 import java.awt.BorderLayout; 31 import java.awt.ComponentOrientation; 32 import java.awt.Container; 33 import java.awt.Insets; 34 import javax.swing.Box; 35 import javax.swing.JButton; 36 import javax.swing.JPanel; 37 import javax.swing.JProgressBar; 38 import javax.swing.border.EmptyBorder; 39 import org.openoffice.setup.InstallData; 40 41 public class UninstallationOngoing extends JPanel { 42 43 private PanelLabel currentProgress; 44 private JProgressBar progressBar; 45 private JButton mStopButton; 46 UninstallationOngoing()47 public UninstallationOngoing() { 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_UninstallationOngoing1"); 55 PanelTitle titlebox = new PanelTitle(titleText); 56 titlebox.addVerticalStrut(20); 57 add(titlebox, BorderLayout.NORTH); 58 59 Container contentbox = Box.createVerticalBox(); 60 if ( data.useRtl() ) { contentbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 61 62 // String progressText = ResourceManager.getString("String_UninstallationOngoing2"); 63 String progressText = ""; 64 currentProgress = new PanelLabel(progressText); 65 66 Container innerbox = Box.createHorizontalBox(); 67 if ( data.useRtl() ) { innerbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 68 69 progressBar = new JProgressBar(0, 100); 70 if ( data.useRtl() ) { progressBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 71 mStopButton = new JButton(); 72 if ( data.useRtl() ) { mStopButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 73 String progressButtonText = ResourceManager.getString("String_InstallationOngoing3"); 74 mStopButton.setText(progressButtonText); 75 mStopButton.setEnabled(true); 76 77 innerbox.add(progressBar); 78 innerbox.add(Box.createHorizontalStrut(10)); 79 innerbox.add(mStopButton); 80 81 contentbox.add(currentProgress); 82 contentbox.add(Box.createVerticalStrut(10)); 83 contentbox.add(innerbox); 84 contentbox.add(Box.createVerticalStrut(20)); 85 86 add(contentbox, BorderLayout.SOUTH); 87 } 88 setProgressText(String s)89 public void setProgressText(String s) { 90 currentProgress.setText(s); 91 } 92 setProgressValue(int i)93 public void setProgressValue(int i) { 94 progressBar.setValue(i); 95 } 96 setStopButtonActionCommand(String actionCommand)97 public void setStopButtonActionCommand(String actionCommand) { 98 mStopButton.setActionCommand(actionCommand); 99 } 100 addStopButtonActionListener(SetupActionListener actionListener)101 public void addStopButtonActionListener(SetupActionListener actionListener) { 102 mStopButton.addActionListener(actionListener); 103 } 104 105 } 106