1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package org.openoffice.setup.Panel; 29 30 import org.openoffice.setup.PanelHelper.PanelLabel; 31 import org.openoffice.setup.PanelHelper.PanelTitle; 32 import org.openoffice.setup.ResourceManager; 33 import org.openoffice.setup.SetupActionListener; 34 import java.awt.BorderLayout; 35 import java.awt.ComponentOrientation; 36 import java.awt.Container; 37 import java.awt.Insets; 38 import javax.swing.Box; 39 import javax.swing.JButton; 40 import javax.swing.JPanel; 41 import javax.swing.JProgressBar; 42 import javax.swing.border.EmptyBorder; 43 import org.openoffice.setup.InstallData; 44 45 public class InstallationOngoing extends JPanel { 46 47 private PanelLabel currentProgress; 48 private JProgressBar progressBar; 49 private JButton mStopButton; 50 private String mTitle = ""; 51 private PanelTitle mTitlebox; 52 53 public InstallationOngoing() { 54 55 InstallData data = InstallData.getInstance(); 56 57 setLayout(new java.awt.BorderLayout()); 58 setBorder(new EmptyBorder(new Insets(10, 10, 10, 10))); 59 60 // String titleText = ResourceManager.getString("String_InstallationOngoing1"); 61 // PanelTitle titlebox = new PanelTitle(titleText); 62 // PanelTitle titlebox = new PanelTitle(mTitle); 63 mTitlebox = new PanelTitle(mTitle); 64 mTitlebox.addVerticalStrut(20); 65 add(mTitlebox, BorderLayout.NORTH); 66 67 Container contentbox = Box.createVerticalBox(); 68 if ( data.useRtl() ) { contentbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 69 70 // String progressText = ResourceManager.getString("String_InstallationOngoing2"); 71 String progressText = ""; 72 currentProgress = new PanelLabel(progressText); 73 74 Container innerbox = Box.createHorizontalBox(); 75 if ( data.useRtl() ) { innerbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 76 progressBar = new JProgressBar(0, 100); 77 if ( data.useRtl() ) { progressBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 78 mStopButton = new JButton(); 79 String progressButtonText = ResourceManager.getString("String_InstallationOngoing3"); 80 mStopButton.setText(progressButtonText); 81 mStopButton.setEnabled(true); 82 if ( data.useRtl() ) { mStopButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 83 84 innerbox.add(progressBar); 85 innerbox.add(Box.createHorizontalStrut(10)); 86 innerbox.add(mStopButton); 87 88 contentbox.add(currentProgress); 89 contentbox.add(Box.createVerticalStrut(10)); 90 contentbox.add(innerbox); 91 contentbox.add(Box.createVerticalStrut(20)); 92 93 add(contentbox, BorderLayout.SOUTH); 94 } 95 96 public void setProgressText(String s) { 97 currentProgress.setText(s); 98 } 99 100 public void setProgressValue(int i) { 101 progressBar.setValue(i); 102 } 103 104 public void setTitle(String title) { 105 mTitlebox.setTitle(title); 106 mTitle = title; 107 } 108 109 public void setStopButtonActionCommand(String actionCommand) { 110 mStopButton.setActionCommand(actionCommand); 111 } 112 113 public void addStopButtonActionListener(SetupActionListener actionListener) { 114 mStopButton.addActionListener(actionListener); 115 } 116 117 public void setStopButtonEnabled(boolean enabled) { 118 mStopButton.setEnabled(enabled); 119 } 120 121 } 122