Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.app / org.gvsig.raster.wmts.app.wmtsclient / src / main / java / org / gvsig / raster / wmts / app / wmtsclient / gui / panel / layer / LayersSelectedPanel.java @ 1174

History | View | Annotate | Download (4.64 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.raster.wmts.app.wmtsclient.gui.panel.layer;
23

    
24
import java.awt.Dimension;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27

    
28
import javax.swing.JButton;
29
import javax.swing.JPanel;
30
import javax.swing.JScrollPane;
31

    
32
import org.gvsig.andami.IconThemeHelper;
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
35

    
36
/**
37
 * Layer list panel
38
 *
39
 * @author Nacho Brodin (nachobrodin@gmail.com)
40
 */
41
public class LayersSelectedPanel extends JPanel {
42
        private static final long      serialVersionUID           = 1L;
43
        private JButton                btnUp                      = null;
44
        private JButton                btnDown                    = null;
45
        private LayerList              lstSelectedLayers          = null;
46
        private JPanel                 jPanelControlLayers        = null;
47
        private JScrollPane            jScrollPanel               = null;
48
        
49
        public LayersSelectedPanel() {
50
                init();
51
        }
52
        
53
        public void init() {
54
                setLayout(new GridBagLayout());
55
                
56
                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
57
                //gridBagConstraints1.fill = GridBagConstraints.BOTH;
58
                gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
59
                gridBagConstraints1.weightx = 1.0;
60
                //gridBagConstraints1.weighty = 1.0;
61
                gridBagConstraints1.insets = new java.awt.Insets(2, 0, 2, 0);
62
                add(getJScrollPane(), gridBagConstraints1);
63
                
64
                //Esto solo si es una lista
65
                
66
                /*gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
67
                gridBagConstraints1.gridx = 1;
68
                gridBagConstraints1.weightx = 0.0;
69
                add(getJPanelControlLayers(), gridBagConstraints1);*/
70
        }
71
        
72
        /**
73
         * This method initializes jScrollPane5
74
         *
75
         * @return ScrollPane
76
         */
77
        private JScrollPane getJScrollPane() {
78
                if (jScrollPanel == null) {
79
                        jScrollPanel = new JScrollPane();
80
                        jScrollPanel.setViewportView(getLstSelectedLayers());
81
                        jScrollPanel.setPreferredSize(new java.awt.Dimension(205, 32));
82
                }
83
                return jScrollPanel;
84
        }
85
        
86
        /**
87
         * This method initializes lstSelectedLayers
88
         * @return List
89
         */
90
        public LayerList getLstSelectedLayers() {
91
                if (lstSelectedLayers == null) {
92
                        lstSelectedLayers = new LayerList();
93
                        lstSelectedLayers.setModel(new JDnDListModel());
94
                        lstSelectedLayers.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
95
                }
96
                return lstSelectedLayers;
97
        }
98
        
99
        /**
100
         * This method initializes jPanel2
101
         * @return Panel
102
         */
103
        @SuppressWarnings("unused")
104
        private JPanel getJPanelControlLayers() {
105
                if (jPanelControlLayers == null) {
106
                        jPanelControlLayers = new JPanel();
107
                        jPanelControlLayers.setLayout(new GridBagLayout());
108
                        
109
                        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
110
                        gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
111
                        gridBagConstraints1.anchor = GridBagConstraints.CENTER;
112
                        gridBagConstraints1.weighty = 0.0;
113
                        gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2);
114
                        
115
                        jPanelControlLayers.add(getBtnUp(), gridBagConstraints1);
116
                        
117
                        gridBagConstraints1.gridy = 1;
118
                        jPanelControlLayers.add(getBtnDown(), gridBagConstraints1);
119
                }
120
                return jPanelControlLayers;
121
        }
122
        
123
        /**
124
         * This method initializes btnUp
125
         * @return Button
126
         */
127
        public JButton getBtnUp() {
128
                if (btnUp == null) {
129
                        btnUp = new JButton();
130
                        btnUp.setPreferredSize(new Dimension(30, 30));
131
                        btnUp.setToolTipText(PluginServices.getText(this, "move_layer_up"));
132
                        btnUp.setIcon(IconThemeHelper.getImageIcon("aplication-preferences-uparrow"));
133
                }
134
                return btnUp;
135
        }
136

    
137
        /**
138
         * This method initializes btnDown
139
         * @return Button
140
         */
141
        public JButton getBtnDown() {
142
                if (btnDown == null) {
143
                        btnDown = new JButton();
144
                        btnDown.setPreferredSize(new Dimension(30, 30));
145
                        btnDown.setToolTipText(PluginServices.getText(this, "move_layer_down"));
146
                        btnDown.setIcon(IconThemeHelper.getImageIcon("aplication-preferences-downarrow"));
147
                }
148
                return btnDown;
149
        }
150

    
151
}