svn-gvsig-desktop / tags / v1_1_Build_1010 / install / launcher / izpack-launcher-1.3 / src / failuredialog.cpp @ 12804
History | View | Annotate | Download (3.46 KB)
1 | 6028 | jmvivo | /* Copyright (c) 2004 Julien Ponge - All rights reserved.
|
---|---|---|---|
2 | *
|
||
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
4 | * of this software and associated documentation files (the "Software"), to
|
||
5 | * deal in the Software without restriction, including without limitation the
|
||
6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
7 | * sell copies of the Software, and to permit persons to whom the Software is
|
||
8 | * furnished to do so, subject to the following conditions:
|
||
9 | *
|
||
10 | * The above copyright notice and this permission notice shall be included in
|
||
11 | * all copies or substantial portions of the Software.
|
||
12 | *
|
||
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
19 | * IN THE SOFTWARE.
|
||
20 | */
|
||
21 | |||
22 | #include "failuredialog.h" |
||
23 | |||
24 | #ifndef __WINDOWS__
|
||
25 | #include "package.xpm" |
||
26 | #endif
|
||
27 | |||
28 | FailureDialog::FailureDialog(const bool &enableJREInstall, |
||
29 | const bool &enableNetDownload, const wxString &wxStringHeadline ) |
||
30 | : wxDialog(0, -1, _(wxStringHeadline), wxDefaultPosition, wxDefaultSize, |
||
31 | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) |
||
32 | { |
||
33 | userAction = INTERNET; |
||
34 | canInstallJRE = enableJREInstall; |
||
35 | canDownloadJRE = enableNetDownload; |
||
36 | |||
37 | buildUI(); |
||
38 | SetIcon(wxICON(package)); |
||
39 | } |
||
40 | |||
41 | FailureDialog::~FailureDialog() |
||
42 | { |
||
43 | |||
44 | } |
||
45 | |||
46 | void FailureDialog::buildUI()
|
||
47 | { |
||
48 | // Inits
|
||
49 | wxString explanationMsg = _("The software that you are trying to install "
|
||
50 | "requires a Java Runtime Environment.\n"
|
||
51 | "The Java Runtime Environment could not be "
|
||
52 | "detected on your computer but it can be "
|
||
53 | "installed for you.");
|
||
54 | sizer = new wxBoxSizer(wxVERTICAL);
|
||
55 | |||
56 | // Widgets
|
||
57 | |||
58 | explanationText = new wxStaticText(this, -1, explanationMsg, wxDefaultPosition); |
||
59 | sizer->Add(explanationText, 0, wxALIGN_LEFT | wxALL, 10); |
||
60 | |||
61 | wxString rlabels[] = { |
||
62 | _("install the Java Environment included with this software"),
|
||
63 | _("manually locate an already installed Java Runtime Environment"),
|
||
64 | _("download the latest version of the Java Runtime Environment from the "
|
||
65 | "Internet.")
|
||
66 | }; |
||
67 | optionsBox = new wxRadioBox(this, -1, |
||
68 | _("You have the following installation choices:"),
|
||
69 | wxDefaultPosition, wxDefaultSize, 3, rlabels, 1, |
||
70 | wxRA_SPECIFY_COLS); |
||
71 | if( canInstallJRE )
|
||
72 | { |
||
73 | optionsBox->SetSelection( 0 );
|
||
74 | } |
||
75 | else
|
||
76 | { |
||
77 | optionsBox->SetSelection( 1 );
|
||
78 | } |
||
79 | sizer->Add(optionsBox, 1, wxGROW | wxALL, 10); |
||
80 | |||
81 | okButton = new wxButton(this, wxID_OK, _("Continue")); |
||
82 | okButton->SetFocus(); |
||
83 | sizer->Add(okButton, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL
|
||
84 | | wxALL, 10);
|
||
85 | |||
86 | optionsBox->Enable(0, canInstallJRE);
|
||
87 | optionsBox->Enable(2, canDownloadJRE);
|
||
88 | |||
89 | // Sizer
|
||
90 | SetSizer(sizer); |
||
91 | sizer->SetSizeHints(this);
|
||
92 | } |
||
93 | |||
94 | bool FailureDialog::Validate()
|
||
95 | { |
||
96 | switch (optionsBox->GetSelection())
|
||
97 | { |
||
98 | case 0: userAction = PROVIDED; break; |
||
99 | case 1: userAction = MANUAL; break; |
||
100 | case 2: userAction = INTERNET; break; |
||
101 | default: break; |
||
102 | } |
||
103 | return true; |
||
104 | } |