Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004  * 
005  * Copyright 2008 by Sun Microsystems, Inc.
006  *
007  * OpenOffice.org - a multi-platform office productivity suite
008  *
009  * $RCSfile: SetupActionListener.java,v $
010  * $Revision: 1.4 $
011  *
012  * This file is part of OpenOffice.org.
013  *
014  * OpenOffice.org is free software: you can redistribute it and/or modify
015  * it under the terms of the GNU Lesser General Public License version 3
016  * only, as published by the Free Software Foundation.
017  *
018  * OpenOffice.org is distributed in the hope that it will be useful,
019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021  * GNU Lesser General Public License version 3 for more details
022  * (a copy is included in the LICENSE file that accompanied this code).
023  *
024  * You should have received a copy of the GNU Lesser General Public License
025  * version 3 along with OpenOffice.org.  If not, see
026  * <http://www.openoffice.org/license.html>
027  * for a copy of the LGPLv3 License.
028  *
029  ************************************************************************/
030 
031 package org.openoffice.setup;
032 
033 import org.openoffice.setup.Dialogs.DetailsDialog;
034 import org.openoffice.setup.Dialogs.HelpDialog;
035 import org.openoffice.setup.Util.AbortInstaller;
036 import java.awt.Dimension;
037 import java.awt.event.ActionListener;
038 import javax.swing.JDialog;
039 import javax.swing.JOptionPane;
040 
041 public class SetupActionListener implements ActionListener {
042     
043     private SetupFrame setupFrame;
044     
045     public SetupActionListener(SetupFrame setup) {
046         setupFrame = setup;
047     }
048 
049     public void actionPerformed (java.awt.event.ActionEvent evt) {
050         if (evt.getActionCommand().equals(SetupFrame.ACTION_CANCEL)) {
051             String StringCancelDialog;
052             String StringCancelDialogTitle;
053             InstallData data = InstallData.getInstance();
054             if ( data.isInstallationMode() ) {
055                 StringCancelDialog = ResourceManager.getString("String_Cancel_Dialog");
056             } else {
057                 StringCancelDialog = ResourceManager.getString("String_Cancel_Dialog_Uninstallation");
058             }
059             StringCancelDialogTitle = ResourceManager.getString("String_Cancel_Dialog_Title");            
060             JDialog dialog = setupFrame.getDialog();
061             int n = JOptionPane.showConfirmDialog(dialog, StringCancelDialog, StringCancelDialogTitle,
062                                                       JOptionPane.YES_NO_OPTION);
063             if ( n == 0 ) {
064                 setupFrame.close(SetupFrame.CODE_CANCEL);
065             }
066             setupFrame.setButtonSelected(setupFrame.BUTTON_CANCEL);
067         } else if (evt.getActionCommand().equals(SetupFrame.ACTION_STOP)) {
068             String StringStopDialog;
069             String StringStopDialogTitle;
070             InstallData data = InstallData.getInstance();
071             if ( data.isInstallationMode() ) {
072                 StringStopDialog = ResourceManager.getString("String_Stop_Dialog");
073                 StringStopDialogTitle = ResourceManager.getString("String_Stop_Dialog_Title");
074             } else {
075                 StringStopDialog = ResourceManager.getString("String_Stop_Dialog_Uninstallation");
076                 StringStopDialogTitle = ResourceManager.getString("String_Stop_Dialog_Title_Uninstallation");                
077             }
078             JDialog dialog = setupFrame.getDialog();
079             int n = JOptionPane.showConfirmDialog(dialog, StringStopDialog, StringStopDialogTitle,
080                                                       JOptionPane.YES_NO_OPTION);
081             if ( n == 0 ) {
082                 AbortInstaller.abortInstallProcess();
083             }
084             // setting focus on help button, if not aborted
085             setupFrame.setButtonSelected(setupFrame.BUTTON_HELP);
086             // PanelController panel = setupFrame.getCurrentPanel();
087             // panel.setStopButtonSelected();
088         } else if (evt.getActionCommand().equals(SetupFrame.ACTION_PREVIOUS)) {
089             PanelController panel = setupFrame.getCurrentPanel();
090             String previous = panel.getPrevious();        
091             setupFrame.setCurrentPanel(previous, true, false);
092         } else if (evt.getActionCommand().equals(SetupFrame.ACTION_NEXT)) {
093             PanelController panel = setupFrame.getCurrentPanel();
094             String next = panel.getNext();        
095             if (next == null) { 
096                 setupFrame.close(SetupFrame.CODE_OK);
097             } else { 
098                 setupFrame.setCurrentPanel(next, false, true);
099             }
100         } else if (evt.getActionCommand().equals(SetupFrame.ACTION_DETAILS)) {
101             JDialog dialog = setupFrame.getDialog();
102             DetailsDialog detailsdialog = new DetailsDialog(setupFrame);
103             detailsdialog.setModal(true);
104             detailsdialog.setSize(new Dimension(600, 300));
105             detailsdialog.setLocationRelativeTo(dialog);
106             detailsdialog.setVisible(true);
107             // setting focus on next button, if details dialog is closed
108             setupFrame.setButtonSelected(setupFrame.BUTTON_NEXT);
109         } else if (evt.getActionCommand().equals(SetupFrame.ACTION_HELP)) {
110             JDialog dialog = setupFrame.getDialog();
111             HelpDialog helpdialog = new HelpDialog(setupFrame);
112             helpdialog.setModal(true);
113             helpdialog.setSize(new Dimension(400, 300));
114             helpdialog.setLocationRelativeTo(dialog);
115             helpdialog.setVisible(true);
116             setupFrame.setButtonSelected(setupFrame.BUTTON_HELP);
117         }
118     }
119 }

source navigation ] diff markup ] identifier search ] general search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!