Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / panelGroup / samples / SampleInvisiblePanel.java @ 17544

History | View | Annotate | Download (4.45 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 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

    
20
package org.gvsig.gui.beans.panelGroup.samples;
21

    
22
import java.awt.Color;
23
import java.awt.Dimension;
24
import java.io.Serializable;
25

    
26
import javax.swing.JScrollPane;
27
import javax.swing.JTextArea;
28

    
29
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
30

    
31
/**
32
 * <p>Sample of {@link AbstractPanel AbstractPanel}.</p>
33
 * 
34
 * @version 10/12/2007
35
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
36
 */
37
public class SampleInvisiblePanel extends AbstractPanel implements Serializable {
38
        private static final long serialVersionUID = -1629511810619122126L;
39

    
40
        /**
41
         * <p>Element for the interface.</p>
42
         */
43
        private JTextArea jTextArea = null;
44
        
45
        /**
46
         * @see AbstractPanel#AbstractPanel()
47
         */
48
        public SampleInvisiblePanel() {
49
                super();
50
                initialize();
51
        }
52
        
53
        /**
54
         * @see AbstractPanel#AbstractPanel(String, String, String)
55
         */
56
        public SampleInvisiblePanel(String id, String label, String labelGroup) {
57
                super(id, label, labelGroup);
58
                initialize();
59
        }
60
        
61
        @Override
62
        protected void initialize() {
63
                add(new JScrollPane(getJTextArea()));
64
                setToolTipText(getID());
65
                
66
                setID(Samples_Data.PANELS1_IDS[0]);
67
                setLabel(Samples_Data.PANELS1_LABELS[0]);
68
                setLabelGroup(Samples_Data.PANELS1_LABELGROUPS[0]);
69
                setPreferredSize(new Dimension(Samples_Data.PANELS_DEFAULT_WIDTH, Samples_Data.PANELS_DEFAULT_HEIGHT));
70
                resetChangedStatus();
71
                setVisible(false);
72
        }
73
        
74
        /**
75
         * This method initializes jTextArea
76
         *
77
         * @return JTextArea
78
         */
79
        private JTextArea getJTextArea() {
80
                if (jTextArea == null) {
81
                        jTextArea = new JTextArea(5, 40);
82
                        jTextArea.setText("I\'m a JTextArea object in the \"Panel\" with:\n\nID: " + getID() + "\nLabel: " + getLabel() + "\nLabelGroup: " + getLabelGroup());
83
                        jTextArea.setEditable(false);
84
                        jTextArea.setBackground(Color.RED);
85
                }
86

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

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

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

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

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

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

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