Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / test / java / org / gvsig / app / panelGroup / samples / SampleBandSetupPanel.java @ 40558

History | View | Annotate | Download (4.55 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.app.panelGroup.samples;
25

    
26
import java.awt.Color;
27
import java.awt.Dimension;
28
import java.awt.event.MouseAdapter;
29
import java.awt.event.MouseEvent;
30
import java.io.Serializable;
31

    
32
import javax.swing.JScrollPane;
33
import javax.swing.JTextArea;
34

    
35
import org.gvsig.gui.beans.panelGroup.AbstractPanelGroup;
36
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
37

    
38
/**
39
 * <p>Sample of {@link AbstractPanel AbstractPanel}.</p>
40
 * 
41
 * @version 16/10/2007
42
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
43
 */
44
public class SampleBandSetupPanel extends AbstractPanel implements Serializable {
45
        private static final long serialVersionUID = 40652963597544670L;
46

    
47
        /**
48
         * <p>Element for the interface.</p>
49
         */
50
        private JTextArea jTextArea = null;
51

    
52
        /**
53
         * @see AbstractPanel#AbstractPanel()
54
         */
55
        public SampleBandSetupPanel() {
56
                super();
57
                initialize();
58
        }
59

    
60
        /**
61
         * @see AbstractPanel#AbstractPanel(String, String, String)
62
         */
63
        public SampleBandSetupPanel(String id, String label, String labelGroup) {
64
                super(id, label, labelGroup);
65
                initialize();
66
        }
67

    
68
        @Override
69
        protected void initialize() {
70
                add(new JScrollPane(getJTextArea()));
71
                setToolTipText(getID());
72
                
73
                setID(Samples_ExtensionPointsOfIPanels.PANELS1_IDS[1]);
74
                setLabel(Samples_ExtensionPointsOfIPanels.PANELS1_LABELS[1]);
75
                setLabelGroup(Samples_ExtensionPointsOfIPanels.PANELS1_LABELGROUPS[1]);
76
                setPreferredSize(new Dimension(Samples_ExtensionPointsOfIPanels.PANELS_DEFAULT_WIDTH, Samples_ExtensionPointsOfIPanels.PANELS_DEFAULT_HEIGHT));
77
                resetChangedStatus();
78
        }
79
        
80
        /**
81
         * This method initializes jTextArea
82
         *
83
         * @return JTextArea
84
         */
85
        private JTextArea getJTextArea() {
86
                if (jTextArea == null) {
87
                        jTextArea = new JTextArea(5, 40);
88
                        jTextArea.setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
89
                        jTextArea.setEditable(false);
90
                        jTextArea.setBackground(Color.GREEN);
91
                        
92
                        jTextArea.addMouseListener(new MouseAdapter() {
93
                                
94
                                public void mouseClicked(MouseEvent e) {
95
                                        if (getPanelGroup() != null) {
96
                                                getPanelGroup().setEnabledAcceptButton(! getPanelGroup().isEnabledAcceptButton());
97
                                                getPanelGroup().setEnabledApplyButton(! getPanelGroup().isEnabledApplyButton());
98
                                                getPanelGroup().setEnabledCancelButton(! getPanelGroup().isEnabledCancelButton());
99
                                        }        
100
                                }
101
                        });
102
                }
103

    
104
                return jTextArea;
105
        }
106

    
107
        @Override
108
        public void setID(String id) {
109
                super.setID(id);
110

    
111
                setToolTipText(getID());
112
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
113
        }
114

    
115
        @Override
116
        public void setLabel(String label) {
117
                super.setLabel(label);
118
                
119
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
120
        }
121

    
122
        @Override
123
        public void setLabelGroup(String labelGroup) {
124
                super.setLabelGroup(labelGroup);
125
                
126
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
127
        }
128

    
129
        public void accept() {
130
        }
131

    
132
        public void apply() {
133
        }
134

    
135
        public void cancel() {
136
        }
137

    
138
        public void selected() {
139
                System.out.println("I'm the IPanel: " + toString() + "\n and I've been selected. My information is: " +
140
                                 "\n\tID: " + getID() + "\n\tLABEL_GROUP: " + getLabelGroup() + "\n\tLABEL: " + getLabel() + "\n\tCLASS: " + getClass() +
141
                                 "\n\tMy Preferred Size: " + getPreferredSize() + "\n\tAnd My size: " + getSize());
142
        }
143

    
144
        public void setPanelGroup(AbstractPanelGroup panelGroup) {
145
                super.setPanelGroup(panelGroup);
146
        }
147
}