Revision 6322

View differences:

trunk/libraries/libUI/src/org/gvsig/gui/beans/wizard/WizardAndami.java
1
package org.gvsig.gui.beans.wizard;
2

  
3
import java.awt.BorderLayout;
4

  
5
import javax.swing.ImageIcon;
6
import javax.swing.JPanel;
7

  
8
import jwizardcomponent.CancelAction;
9
import jwizardcomponent.DefaultJWizardComponents;
10
import jwizardcomponent.FinishAction;
11

  
12
import com.iver.andami.PluginServices;
13
import com.iver.andami.ui.mdiManager.View;
14
import com.iver.andami.ui.mdiManager.ViewInfo;
15

  
16
public class WizardAndami extends JPanel implements View {
17
	ViewInfo viewInfo = null;
18
	WizardPanelWithLogo wizardPanel;
19

  
20
	// No deber?an necesitarse un FinishAction y un CancelAction, pero bueno,
21
	// lo mantengo por ahora.
22
	private class CloseAction extends FinishAction
23
	{
24
		View v;
25
		public CloseAction(View view)
26
		{
27
			super(wizardPanel.getWizardComponents());
28
			v = view;
29
		}
30
		public void performAction() {
31
			PluginServices.getMDIManager().closeView(v);
32
		}
33

  
34
	}
35
	private class CloseAction2 extends CancelAction
36
	{
37

  
38
		View v;
39
		public CloseAction2(View view)
40
		{
41
			super(wizardPanel.getWizardComponents());
42
			v = view;
43
		}
44
		public void performAction() {
45
			PluginServices.getMDIManager().closeView(v);
46
		}
47

  
48
	}
49

  
50

  
51
	public WizardAndami(ImageIcon logo)
52
	{
53
		wizardPanel = new WizardPanelWithLogo(logo);
54
		CloseAction closeAction = new CloseAction(this);
55
		CloseAction2 closeAction2 = new CloseAction2(this);
56
		wizardPanel.getWizardComponents().setFinishAction(closeAction);
57
		wizardPanel.getWizardComponents().setCancelAction(closeAction2);
58

  
59
		this.setLayout(new BorderLayout());
60
		this.add(wizardPanel, BorderLayout.CENTER);
61
	}
62

  
63
	public DefaultJWizardComponents getWizardComponents()
64
	{
65
		return wizardPanel.getWizardComponents();
66
	}
67

  
68

  
69
	public ViewInfo getViewInfo() {
70
		if (viewInfo == null)
71
		{
72
			viewInfo = new ViewInfo(ViewInfo.MODALDIALOG|ViewInfo.RESIZABLE);
73
		}
74
		return viewInfo;
75
	}
76

  
77
}
0 78

  
trunk/libraries/libUI/src/org/gvsig/gui/beans/wizard/WizardPanelWithLogo.java
1
package org.gvsig.gui.beans.wizard;
2

  
3
import java.awt.BorderLayout;
4
import java.awt.Color;
5

  
6
import javax.swing.ImageIcon;
7
import javax.swing.JLabel;
8
import javax.swing.JPanel;
9
import javax.swing.JSeparator;
10

  
11
import jwizardcomponent.CancelAction;
12
import jwizardcomponent.DefaultJWizardComponents;
13
import jwizardcomponent.FinishAction;
14
import jwizardcomponent.frame.SimpleButtonPanel;
15

  
16
public class WizardPanelWithLogo extends JPanel {
17
	  DefaultJWizardComponents wizardComponents;
18

  
19
	  JPanel buttonPanel;
20
	  JLabel statusLabel = new JLabel();
21

  
22
	  ImageIcon logo;
23

  
24
	  public WizardPanelWithLogo(ImageIcon logo) {
25
	    this.logo = logo;
26
	    wizardComponents = new DefaultJWizardComponents();
27
	    init();
28
	  }
29

  
30
	  private void init() {
31
	    
32

  
33
	    JPanel logoPanel = new JPanel();
34

  
35
	    String fileString;
36
	    if (logo.toString().indexOf("file:") < 0 &&
37
	        logo.toString().indexOf("http:") < 0) {
38
	      fileString = "file:///" +System.getProperty("user.dir") +"/"
39
	                        +logo.toString();
40
	      fileString = fileString.replaceAll("\\\\", "/");
41
	    } else {
42
	      fileString = logo.toString();
43
	    }
44
	    logoPanel.add(new JLabel(logo));
45
	    logoPanel.setBackground(Color.WHITE);
46
	    this.setLayout(new BorderLayout());
47
	    this.add(logoPanel, BorderLayout.WEST);
48
	    this.add(wizardComponents.getWizardPanelsContainer(),
49
	    							BorderLayout.CENTER);
50

  
51
	    JPanel auxPanel = new JPanel(new BorderLayout());
52
	    auxPanel.add(new JSeparator(), BorderLayout.NORTH);
53

  
54
	    buttonPanel = new SimpleButtonPanel(wizardComponents);
55
	    auxPanel.add(buttonPanel);
56
	    this.add(auxPanel, BorderLayout.SOUTH);
57
	    
58

  
59
	    wizardComponents.setFinishAction(new FinishAction(wizardComponents) {
60
	      public void performAction() {
61
	        // dispose();
62
	      }
63
	    });
64
	    wizardComponents.setCancelAction(new CancelAction(wizardComponents) {
65
	      public void performAction() {
66
	        // dispose();
67
	      }
68
	    });
69
	  }
70

  
71
	  public DefaultJWizardComponents getWizardComponents(){
72
	    return wizardComponents;
73
	  }
74

  
75
	  public void setWizardComponents(DefaultJWizardComponents aWizardComponents){
76
	    wizardComponents = aWizardComponents;
77
	  }
78

  
79
	  public void show() {
80
	    wizardComponents.updateComponents();
81
	    super.setVisible(true);
82
	  }
83

  
84
}
0 85

  
trunk/libraries/libUI/src/org/gvsig/gui/beans/swing/GridBagLayoutPanel.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.3  2006-07-04 16:56:10  azabala
46
* Revision 1.4  2006-07-12 11:23:56  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.3  2006/07/04 16:56:10  azabala
47 50
* new method to add three componentes
48 51
*
49 52
* Revision 1.2  2006/07/03 09:29:09  jaume
......
163 166
		gridBag.setConstraints(comp2,cons);
164 167
		add(comp2);
165 168
	}
166
	
167
	
168
/**
169
 * AZABALA
170
 * Estoy viendo si no seria conveniente a?adir un Component[]
171
 * como parametro, para que pueda crecer hasta infinito y mas alla
172
 * 
173
 * 
174
 * @param comp1
175
 * @param comp2
176
 * @param comp3
177
 * @param fill
178
 */
179
public void addComponent(Component comp1, 
180
						Component comp2, 
181
						Component comp3,
182
						int fill)
183
{
184
	copyToolTips(comp1, comp2);
185
	copyToolTips(comp1, comp3);
186
	
187
	GridBagConstraints cons = new GridBagConstraints();
188
	cons.gridy = y++;
189
	cons.gridheight = 1;
190
	cons.gridwidth = 1;
191
	cons.weightx = 0.0f;
192
	cons.insets = new Insets(1,0,1,0);
193
	cons.fill = GridBagConstraints.BOTH;
194 169

  
195
	gridBag.setConstraints(comp1,cons);
196
	add(comp1);
197 170

  
198
	cons.gridx = 1;
199
	cons.weightx = 1.0f;
200
	gridBag.setConstraints(comp2,cons);
201
	add(comp2);
202
	
203
	//FIXME. REVISAR ESTO QUE SEGURAMENTE ESTE MAL (AZABALA)
204
	cons.fill = GridBagConstraints.NONE;
205
	cons.gridx = 2;
206
	cons.weightx = 1.0f;
207
	gridBag.setConstraints(comp3, cons);
208
	add(comp3);
209
}
210
	
211
	
212
	
213
	
214
	
171
	/**
172
	 * AZABALA
173
	 * Estoy viendo si no seria conveniente a?adir un Component[]
174
	 * como parametro, para que pueda crecer hasta infinito y mas alla
175
	 *
176
	 *
177
	 * @param comp1
178
	 * @param comp2
179
	 * @param comp3
180
	 * @param fill
181
	 */
182
	public void addComponent(Component comp1,
183
			Component comp2,
184
			Component comp3,
185
			int fill)
186
	{
187
		copyToolTips(comp1, comp2);
188
		copyToolTips(comp1, comp3);
215 189

  
190
		GridBagConstraints cons = new GridBagConstraints();
191
		cons.gridy = y++;
192
		cons.gridheight = 1;
193
		cons.gridwidth = 1;
194
		cons.weightx = 0.0f;
195
		cons.insets = new Insets(1,0,1,0);
196
		cons.fill = GridBagConstraints.BOTH;
197

  
198
		gridBag.setConstraints(comp1,cons);
199
		add(comp1);
200

  
201
		cons.gridx = 1;
202
		cons.weightx = 1.0f;
203
		gridBag.setConstraints(comp2,cons);
204
		add(comp2);
205

  
206
		//FIXME. REVISAR ESTO QUE SEGURAMENTE ESTE MAL (AZABALA)
207
		cons.fill = GridBagConstraints.NONE;
208
		cons.gridx = 2;
209
		cons.weightx = 1.0f;
210
		gridBag.setConstraints(comp3, cons);
211
		add(comp3);
212
	}
213

  
214

  
215
	public void addComponent(Component comp1,
216
			Component comp2,
217
			Component comp3) {
218
		addComponent(comp1, comp2, comp3, GridBagConstraints.BOTH);
219
	}
220

  
221

  
222

  
223

  
216 224
	/**
217 225
	 * Adds a component to the option pane. Components are
218 226
	 * added in a vertical fashion, one per row.

Also available in: Unified diff