svn-gvsig-desktop / branches / v2_0_0_prep / build / distribution / IzPack / src / lib / com / izforge / izpack / panels / HelloPanel.java @ 23393
History | View | Annotate | Download (4.59 KB)
1 |
/*
|
---|---|
2 |
* $Id: HelloPanel.java 5819 2006-06-14 07:29:09Z cesar $
|
3 |
* IzPack
|
4 |
* Copyright (C) 2001-2004 Julien Ponge
|
5 |
*
|
6 |
* File : HelloPanel.java
|
7 |
* Description : A panel to welcome the user.
|
8 |
* Author's email : julien@izforge.com
|
9 |
* Author's Website : http://www.izforge.com
|
10 |
*
|
11 |
* Portions are Copyright (C) 2002 Jan Blok (jblok@profdata.nl - PDM - www.profdata.nl)
|
12 |
*
|
13 |
* This program is free software; you can redistribute it and/or
|
14 |
* modify it under the terms of the GNU General Public License
|
15 |
* as published by the Free Software Foundation; either version 2
|
16 |
* of the License, or any later version.
|
17 |
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
26 |
*/
|
27 |
package com.izforge.izpack.panels; |
28 |
|
29 |
import java.awt.GridBagConstraints; |
30 |
import java.awt.GridBagLayout; |
31 |
import java.awt.Insets; |
32 |
import java.util.ArrayList; |
33 |
|
34 |
import javax.swing.Box; |
35 |
import javax.swing.BoxLayout; |
36 |
import javax.swing.JLabel; |
37 |
import javax.swing.JPanel; |
38 |
|
39 |
import com.izforge.izpack.Info; |
40 |
import com.izforge.izpack.gui.LabelFactory; |
41 |
import com.izforge.izpack.installer.InstallData; |
42 |
import com.izforge.izpack.installer.InstallerFrame; |
43 |
import com.izforge.izpack.installer.IzPanel; |
44 |
|
45 |
/**
|
46 |
* The Hello panel class.
|
47 |
* @author Julien Ponge
|
48 |
*/
|
49 |
public class HelloPanel extends IzPanel |
50 |
{ |
51 |
/** The layout. */
|
52 |
private BoxLayout layout; |
53 |
|
54 |
/** The welcome label. */
|
55 |
private JLabel welcomeLabel; |
56 |
|
57 |
/** The application authors label. */
|
58 |
private JLabel appAuthorsLabel; |
59 |
|
60 |
/** The application URL label. */
|
61 |
private JLabel appURLLabel; |
62 |
|
63 |
/**
|
64 |
* The constructor.
|
65 |
*
|
66 |
* @param parent The parent.
|
67 |
* @param idata The installation data.
|
68 |
*/
|
69 |
public HelloPanel(InstallerFrame parent, InstallData idata)
|
70 |
{ |
71 |
super(parent, idata);
|
72 |
|
73 |
// The 'super' layout
|
74 |
GridBagLayout superLayout = new GridBagLayout(); |
75 |
setLayout(superLayout); |
76 |
GridBagConstraints gbConstraints = new GridBagConstraints(); |
77 |
gbConstraints.insets = new Insets(0, 0, 0, 0); |
78 |
gbConstraints.fill = GridBagConstraints.NONE;
|
79 |
gbConstraints.anchor = GridBagConstraints.CENTER;
|
80 |
|
81 |
// We initialize our 'real' layout
|
82 |
JPanel centerPanel = new JPanel(); |
83 |
layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); |
84 |
centerPanel.setLayout(layout); |
85 |
superLayout.addLayoutComponent(centerPanel, gbConstraints); |
86 |
add(centerPanel); |
87 |
|
88 |
// We create and put the labels
|
89 |
String str;
|
90 |
|
91 |
centerPanel.add(Box.createVerticalStrut(10)); |
92 |
|
93 |
str = |
94 |
parent.langpack.getString("HelloPanel.welcome1")
|
95 |
+ idata.info.getAppName() |
96 |
+ " "
|
97 |
+ idata.info.getAppVersion() |
98 |
+ parent.langpack.getString("HelloPanel.welcome2");
|
99 |
welcomeLabel = |
100 |
LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); |
101 |
centerPanel.add(welcomeLabel); |
102 |
|
103 |
centerPanel.add(Box.createVerticalStrut(20)); |
104 |
|
105 |
ArrayList authors = idata.info.getAuthors();
|
106 |
int size = authors.size();
|
107 |
if (size > 0) |
108 |
{ |
109 |
str = parent.langpack.getString("HelloPanel.authors");
|
110 |
appAuthorsLabel = |
111 |
LabelFactory.create( |
112 |
str, |
113 |
parent.icons.getImageIcon("information"),
|
114 |
JLabel.TRAILING);
|
115 |
centerPanel.add(appAuthorsLabel); |
116 |
|
117 |
JLabel label;
|
118 |
for (int i = 0; i < size; i++) |
119 |
{ |
120 |
Info.Author a = (Info.Author) authors.get(i); |
121 |
String email =
|
122 |
(a.getEmail() != null) ? (" <" + a.getEmail() + ">") : ""; |
123 |
label = |
124 |
LabelFactory.create( |
125 |
" - " + a.getName() + email,
|
126 |
parent.icons.getImageIcon("empty"),
|
127 |
JLabel.TRAILING);
|
128 |
centerPanel.add(label); |
129 |
} |
130 |
|
131 |
centerPanel.add(Box.createVerticalStrut(20)); |
132 |
} |
133 |
|
134 |
if (idata.info.getAppURL() != null) |
135 |
{ |
136 |
str = |
137 |
parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL();
|
138 |
appURLLabel = |
139 |
LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); |
140 |
centerPanel.add(appURLLabel); |
141 |
} |
142 |
} |
143 |
|
144 |
/**
|
145 |
* Indicates wether the panel has been validated or not.
|
146 |
*
|
147 |
* @return Always true.
|
148 |
*/
|
149 |
public boolean isValidated() |
150 |
{ |
151 |
return true; |
152 |
} |
153 |
} |