Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / panelGroup / samples / SampleTransparencyPanel.java @ 40561

History | View | Annotate | Download (4.54 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.gui.beans.panelGroup.samples;
25

    
26
import java.awt.Color;
27
import java.awt.Dimension;
28
import java.io.Serializable;
29

    
30
import javax.swing.JScrollPane;
31
import javax.swing.JTextArea;
32

    
33
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
34

    
35

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

    
45
        /**
46
         * <p>Element for the interface.</p>
47
         */
48
        private JTextArea jTextArea = null;
49
        
50
        /**
51
         * @see AbstractPanel#AbstractPanel()
52
         */
53
        public SampleTransparencyPanel() {
54
                super();
55
                initialize();
56
        }
57
        
58
        /**
59
         * @see AbstractPanel#AbstractPanel(String, String, String)
60
         */
61
        public SampleTransparencyPanel(String id, String label, String labelGroup) {
62
                super(id, label, labelGroup);
63
                initialize();
64
        }
65
        
66
        @Override
67
        protected void initialize() {
68
                add(new JScrollPane(getJTextArea()));
69
                setToolTipText(getID());
70

    
71
                setID(Samples_Data.PANELS1_IDS[2]);
72
                setLabel(Samples_Data.PANELS1_LABELS[2]);
73
                setLabelGroup(Samples_Data.PANELS1_LABELGROUPS[2]);
74
                setPreferredSize(new Dimension(Samples_Data.PANELS_DEFAULT_WIDTH, Samples_Data.PANELS_DEFAULT_HEIGHT));
75
                resetChangedStatus();
76
        }
77
        
78
        /**
79
         * This method initializes jTextArea
80
         *
81
         * @return JTextArea
82
         */
83
        private JTextArea getJTextArea() {
84
                if (jTextArea == null) {
85
                        jTextArea = new JTextArea(5, 40);
86
                        jTextArea.setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
87
                        jTextArea.setEditable(false);
88
                        jTextArea.setBackground(Color.BLUE);
89
                }
90

    
91
                return jTextArea;
92
        }
93
        
94
        @Override
95
        public void setID(String id) {
96
                super.setID(id);
97
                
98
                setToolTipText(getID());
99
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
100
                hasChanged = true;
101
        }
102

    
103
        @Override
104
        public void setLabel(String label) {
105
                super.setLabel(label);
106
                
107
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
108
                hasChanged = true;
109
        }
110

    
111
        @Override
112
        public void setLabelGroup(String labelGroup) {
113
                super.setLabelGroup(labelGroup);
114
                
115
                getJTextArea().setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
116
                hasChanged = true;
117
        }
118

    
119
        /*
120
         * (non-Javadoc)
121
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#accept()
122
         */
123
        public void accept() {
124
                System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing an 'accept' method.");
125
        }
126

    
127
        /*
128
         * (non-Javadoc)
129
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#apply()
130
         */
131
        public void apply() {
132
                System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing an 'apply' method.");
133
        }
134

    
135
        /*
136
         * (non-Javadoc)
137
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#cancel()
138
         */
139
        public void cancel() {
140
                System.out.println("I'm the IPanel: " + toString() + "\n and I'm executing a 'cancel' method.");
141
        }
142

    
143
        /*
144
         * (non-Javadoc)
145
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#selected()
146
         */
147
        public void selected() {
148
                System.out.println("I'm the IPanel: " + toString() + "\n and I've been selected. My information is: " +
149
                                 "\n\tID: " + getID() + "\n\tLABEL_GROUP: " + getLabelGroup() + "\n\tLABEL: " + getLabel() + "\n\tCLASS: " + getClass() +
150
                                 "\n\tMy Preferred Size: " + getPreferredSize() + "\n\tAnd My size: " + getSize());
151
        }
152
}