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 / SampleUndefinedPreferredSizeExceptionPanel.java @ 40558

History | View | Annotate | Download (4.46 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.io.Serializable;
28

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

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

    
34
/**
35
 * 
36
 * @version 30/11/2007
37
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
38
 */
39
public class SampleUndefinedPreferredSizeExceptionPanel extends AbstractPanel implements Serializable {
40
        private static final long serialVersionUID = 1210497562221898739L;
41

    
42
        /**
43
         * <p>Element for the interface.</p>
44
         */
45
        private JTextArea jTextArea = null;
46
        
47
        /**
48
         * @see AbstractPanel#AbstractPanel()
49
         */
50
        public SampleUndefinedPreferredSizeExceptionPanel() {
51
                super();
52
                initialize();
53
        }
54
        
55
        /**
56
         * @see AbstractPanel#AbstractPanel(String, String, String)
57
         */
58
        public SampleUndefinedPreferredSizeExceptionPanel(String id, String label, String labelGroup) {
59
                super(id, label, labelGroup);
60
                initialize();
61
        }
62
        
63
        @Override
64
        protected void initialize() {
65
                add(new JScrollPane(getJTextArea()));
66
                setToolTipText(getID());
67
                
68
                setID(Samples_ExtensionPointsOfIPanels.PANELS1_IDS[0]);
69
                setLabel(Samples_ExtensionPointsOfIPanels.PANELS1_LABELS[0]);
70
                setLabelGroup(Samples_ExtensionPointsOfIPanels.PANELS1_LABELGROUPS[0]);
71
                resetChangedStatus();
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
}