svn-gvsig-desktop / import / ext3D / branches / ext3D_v1.1 / extAnimationGUI / src / com / iver / ai2 / animationgui / gui / toc / AnimationDateModePanel.java @ 15463
History | View | Annotate | Download (6.33 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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 Ib??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.ai2.animationgui.gui.toc; |
42 |
|
43 |
import java.awt.Choice; |
44 |
import java.awt.Dimension; |
45 |
import java.awt.GridBagConstraints; |
46 |
import java.awt.GridBagLayout; |
47 |
import java.awt.Insets; |
48 |
import java.awt.event.ActionListener; |
49 |
import java.awt.event.ItemEvent; |
50 |
import java.awt.event.ItemListener; |
51 |
import java.awt.event.KeyListener; |
52 |
import java.util.Dictionary; |
53 |
import java.util.Hashtable; |
54 |
|
55 |
import javax.swing.BorderFactory; |
56 |
import javax.swing.JLabel; |
57 |
import javax.swing.JPanel; |
58 |
import javax.swing.JSlider; |
59 |
import javax.swing.event.ChangeEvent; |
60 |
import javax.swing.event.ChangeListener; |
61 |
|
62 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
63 |
import org.gvsig.gui.beans.swing.JButton; |
64 |
|
65 |
import com.iver.ai2.gvsig3d.ProjectView3D; |
66 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
67 |
import com.iver.andami.PluginServices; |
68 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
69 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
70 |
import com.iver.cit.gvsig.animation.AnimationPlayer; |
71 |
import com.iver.cit.gvsig.animation.IAnimationType; |
72 |
import com.iver.cit.gvsig.animation.date.AnimationDate3D; |
73 |
import com.iver.cit.gvsig.animation.dateFilter.DateFilter; |
74 |
import com.iver.cit.gvsig.fmap.MapContext; |
75 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
76 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
77 |
|
78 |
/**
|
79 |
* Dialogo donde se muestran las propiedades de una vista
|
80 |
*
|
81 |
* @author Fernando Gonz?lez Cort?s
|
82 |
*/
|
83 |
public class AnimationDateModePanel extends GridBagLayoutPanel implements |
84 |
SingletonWindow, ItemListener{
|
85 |
|
86 |
|
87 |
private int width = 250; |
88 |
|
89 |
private int height = 100; |
90 |
|
91 |
private GridBagLayoutPanel okCancelPanel;
|
92 |
|
93 |
private JButton okButton; |
94 |
|
95 |
private Choice choice = null; |
96 |
|
97 |
private int animationMode; |
98 |
|
99 |
private int operation; |
100 |
|
101 |
private AnimationDate3D animationDay;
|
102 |
|
103 |
/**
|
104 |
* This is the default constructor
|
105 |
* @param animationType
|
106 |
*
|
107 |
* @param f
|
108 |
* Frame padre del dialogo
|
109 |
* @param v
|
110 |
* Vista que se representa
|
111 |
*/
|
112 |
public AnimationDateModePanel(IAnimationType animationType) {
|
113 |
|
114 |
animationDay = (AnimationDate3D)animationType; |
115 |
initialize(); |
116 |
|
117 |
} |
118 |
|
119 |
/**
|
120 |
* This method initializes this
|
121 |
*/
|
122 |
private void initialize() { |
123 |
|
124 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
125 |
gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
|
126 |
gridBagConstraints1.gridy = 2;
|
127 |
gridBagConstraints1.weightx = 1.0;
|
128 |
gridBagConstraints1.gridx = 1;
|
129 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
130 |
gridBagConstraints.gridx = 1;
|
131 |
gridBagConstraints.gridheight = 2;
|
132 |
gridBagConstraints.gridwidth = 2;
|
133 |
gridBagConstraints.insets = new Insets(15, 0, 0, 0); |
134 |
gridBagConstraints.gridy = 3;
|
135 |
|
136 |
this.add(getChoiceValue(), gridBagConstraints1);
|
137 |
this.add(getOkCancelPanel(),gridBagConstraints);
|
138 |
|
139 |
// Inicialize component
|
140 |
setName(PluginServices.getText(this, "Transparency")); |
141 |
this.setPreferredSize(new Dimension(width, height)); |
142 |
this.setSize(new Dimension(width, height)); |
143 |
|
144 |
} |
145 |
|
146 |
|
147 |
private Choice getChoiceValue() { |
148 |
// TODO Auto-generated method stub
|
149 |
if (choice == null) { |
150 |
choice = new Choice(); |
151 |
// choice.addItem( textopru );
|
152 |
choice.addItem("Intervalo");
|
153 |
choice.addItem("Incremental");
|
154 |
choice.addItem("Decremental");
|
155 |
// choice.addItem( "modo3" );
|
156 |
// choice.addItem( "modo4" );
|
157 |
choice.addItemListener(this);
|
158 |
} |
159 |
return choice;
|
160 |
} |
161 |
|
162 |
|
163 |
private GridBagLayoutPanel getOkCancelPanel() {
|
164 |
if (okCancelPanel == null) { |
165 |
ActionListener okAction, cancelAction, applyAction;
|
166 |
okAction = new java.awt.event.ActionListener() {
|
167 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
168 |
|
169 |
//TODO settin animation mode
|
170 |
|
171 |
animationDay.setFilterMode(animationMode); |
172 |
PluginServices.getMDIManager().closeWindow( |
173 |
AnimationDateModePanel.this); |
174 |
} |
175 |
}; |
176 |
okCancelPanel = new GridBagLayoutPanel();
|
177 |
okCancelPanel.setAlignmentX(GridBagLayoutPanel.RIGHT_ALIGNMENT); |
178 |
okButton = new JButton(); |
179 |
okButton.setText("Aceptar");
|
180 |
okButton.addActionListener(okAction); |
181 |
|
182 |
okCancelPanel.addComponent(okButton); |
183 |
} |
184 |
return okCancelPanel;
|
185 |
} |
186 |
|
187 |
|
188 |
public WindowInfo getWindowInfo() {
|
189 |
WindowInfo m_viewinfo = new WindowInfo();
|
190 |
m_viewinfo.setTitle(PluginServices.getText(this, "Transparency")); |
191 |
m_viewinfo.setHeight(height); |
192 |
m_viewinfo.setWidth(width); |
193 |
return m_viewinfo;
|
194 |
} |
195 |
|
196 |
public Object getWindowModel() { |
197 |
// TODO Auto-generated method stub
|
198 |
return null; |
199 |
} |
200 |
|
201 |
public void itemStateChanged(ItemEvent event) { |
202 |
// TODO Auto-generated method stub
|
203 |
Object obj = event.getSource();
|
204 |
if (obj == choice) {
|
205 |
operation = choice.getSelectedIndex(); // get select item.
|
206 |
getMensaje(operation); |
207 |
} |
208 |
|
209 |
} |
210 |
private void getMensaje(int option) { |
211 |
// TODO Auto-generated method stub
|
212 |
String mode = choice.getItem(option);
|
213 |
if (mode.equals("Intervalo")) { |
214 |
animationMode = DateFilter.BOTH; |
215 |
} else if (mode.equals("Incremental")) { |
216 |
animationMode = DateFilter.BEFORE_BEGIN; |
217 |
} else if (mode.equals("Decremental")) { |
218 |
animationMode = DateFilter.AFTER_END; |
219 |
} |
220 |
System.out.println("opcion: " + mode); |
221 |
} |
222 |
|
223 |
|
224 |
} |