svn-gvsig-desktop / branches / v2_0_0_prep / libraries / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.impl / src / main / java / org / gvsig / exportto / swing / impl / panel / ProviderSelectionPanel.java @ 37887
History | View | Annotate | Download (3.65 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.exportto.swing.impl.panel; |
23 |
|
24 |
import java.awt.GridBagConstraints; |
25 |
import java.awt.GridBagLayout; |
26 |
|
27 |
import javax.swing.JList; |
28 |
import javax.swing.JScrollPane; |
29 |
import javax.swing.JTextArea; |
30 |
|
31 |
import org.gvsig.exportto.swing.impl.DefaultJExporttoServicePanel; |
32 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory; |
33 |
|
34 |
/**
|
35 |
* @author gvSIG Team
|
36 |
* @version $Id$
|
37 |
*
|
38 |
*/
|
39 |
public class ProviderSelectionPanel extends AbstractExporttoPanel { |
40 |
|
41 |
private static final long serialVersionUID = -5887438468358948411L; |
42 |
|
43 |
protected JList exporttoProviderList = null; |
44 |
private JScrollPane scrollPane = null; |
45 |
private JScrollPane descriptionScrollPane; |
46 |
protected JTextArea descriptionText; |
47 |
private int[] providerTypes; |
48 |
|
49 |
public ProviderSelectionPanel(
|
50 |
DefaultJExporttoServicePanel exporttoServicePanel, int[] providerTypes) { |
51 |
super(exporttoServicePanel);
|
52 |
this.providerTypes = providerTypes;
|
53 |
initializeComponents(); |
54 |
} |
55 |
|
56 |
private void initializeComponents() { |
57 |
GridBagConstraints gridBagConstraints;
|
58 |
this.setLayout(new GridBagLayout()); |
59 |
|
60 |
// Create the list
|
61 |
exporttoProviderList = new JList(); |
62 |
exporttoProviderList.setModel(new ExporterSelectionListModel(
|
63 |
providerTypes)); |
64 |
|
65 |
scrollPane = new JScrollPane(); |
66 |
scrollPane.setViewportView(exporttoProviderList); |
67 |
|
68 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
69 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
70 |
gridBagConstraints.weightx = 1.0;
|
71 |
gridBagConstraints.weighty = 1.0;
|
72 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 2); |
73 |
add(scrollPane, gridBagConstraints); |
74 |
|
75 |
// Create the description area
|
76 |
descriptionScrollPane = new javax.swing.JScrollPane();
|
77 |
descriptionText = new javax.swing.JTextArea();
|
78 |
|
79 |
descriptionText.setColumns(20);
|
80 |
descriptionText.setEditable(false);
|
81 |
descriptionText.setRows(5);
|
82 |
descriptionText.setLineWrap(true);
|
83 |
descriptionText.setBorder(null);
|
84 |
descriptionScrollPane.setBorder(null);
|
85 |
descriptionScrollPane.setViewportView(descriptionText); |
86 |
|
87 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
88 |
gridBagConstraints.gridx = 0;
|
89 |
gridBagConstraints.gridy = 1;
|
90 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
91 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; |
92 |
gridBagConstraints.weightx = 1.0;
|
93 |
gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2); |
94 |
add(descriptionScrollPane, gridBagConstraints); |
95 |
} |
96 |
|
97 |
protected ExporttoSwingProviderFactory getSelectedProvider() {
|
98 |
return (ExporttoSwingProviderFactory) exporttoProviderList
|
99 |
.getSelectedValue(); |
100 |
} |
101 |
} |