Statistics
| Revision:

root / branches / v10 / extensions / extPublish / src / com / iver / cit / gvsig / publish / gui / view / DefaultPublicationPanel.java @ 13570

History | View | Annotate | Download (3.49 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.publish.gui.view;
42

    
43
import java.awt.BorderLayout;
44
import java.awt.event.ActionListener;
45
import java.util.EventListener;
46

    
47
import javax.swing.JPanel;
48
import javax.swing.JTree;
49
import javax.swing.event.TreeSelectionListener;
50

    
51
import com.iver.cit.gvsig.publish.serversModel.PublishException;
52

    
53

    
54
public class DefaultPublicationPanel extends PublishPanel{
55
        private DefaultPublicationJTreePanel treePanel=null;
56
        private PublishPanel paramsPanel=null;
57
        private EventListener listener=null;
58
        /**
59
         * Constructor
60
         */
61
        public DefaultPublicationPanel(){
62
                super();
63
                initialize();
64
        }
65
        
66
        public void setListener(EventListener listener){
67
                //getDefaultPublicationParamsPanel().setListener(listener);
68
                this.listener = listener;
69
                //getDefaultPublicationTree().setListener(listener);
70
                getDefaultPublicationTreePanel().setListener(listener);
71
        }
72
        private void initialize(){
73
                this.setLayout(new BorderLayout());
74
        this.setSize(new java.awt.Dimension(400,106));
75
        this.add(getDefaultPublicationTreePanel(), java.awt.BorderLayout.WEST);
76
        //this.add(getDefaultPublicationParamsPanel(), java.awt.BorderLayout.EAST);        
77
        }
78

    
79
        private DefaultPublicationJTreePanel getDefaultPublicationTreePanel(){
80
                if (treePanel==null){
81
                        treePanel = new DefaultPublicationJTreePanel();                        
82
                }                
83
                return treePanel;
84
        }
85
        private PublishPanel getParamsPanel(){
86
                return paramsPanel;
87
        }
88
        
89
        /**
90
         * @see IPublishView
91
         */
92
        public Object getModel() {                
93
                return treePanel.getModel();
94
        }
95
        /**
96
         *  
97
         * @see IPublishView
98
         */
99
        public void setModel(Object entityModel) {
100
                treePanel.setModel(entityModel);                
101
        }
102
        /**
103
         * Changes the params panel 
104
         * 
105
         * @param paramsView
106
         */
107
        public void setParamsPanel(PublishPanel paramsView){
108
                //if paramView is null the plugin controller has sent a null panel
109
                if(paramsView == null){
110
                        //throw new PublishException();
111
                        //TODO: I must throw an exception or show a message                        
112
                }
113
                //if the params panel already exists, remove it and add the new
114
                if(paramsPanel != null){
115
                        this.remove(paramsPanel);
116
                }
117
                paramsPanel = paramsView;
118
                //Each server controller set the listener in its panel
119
                //paramsPanel.setListener(listener);
120
                this.add(paramsPanel, java.awt.BorderLayout.EAST);
121
                //I don't know why I must do the following in order to show the new panel
122
                this.repaint();
123
                this.revalidate();
124
        }                
125
}