root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / FOpenDialog.java @ 600
History | View | Annotate | Download (4.82 KB)
1 |
/*
|
---|---|
2 |
* Created on 23-abr-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
package com.iver.cit.gvsig.gui; |
8 |
|
9 |
import java.awt.BorderLayout; |
10 |
import java.awt.FlowLayout; |
11 |
|
12 |
import javax.swing.DefaultListModel; |
13 |
import javax.swing.JButton; |
14 |
import javax.swing.JDialog; |
15 |
import javax.swing.JFileChooser; |
16 |
import javax.swing.JPanel; |
17 |
|
18 |
import com.iver.andami.PluginServices; |
19 |
import com.iver.andami.Utilities; |
20 |
import com.iver.andami.ui.mdiManager.View; |
21 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
22 |
/**
|
23 |
* Di?logo para cargar las dieferentes capas a la vista.
|
24 |
*
|
25 |
* @author Vicente Caballero Navarro
|
26 |
*/
|
27 |
public class FOpenDialog extends JPanel implements com.iver.andami.ui.mdiManager.View { |
28 |
//private javax.swing.JDialog jDialog = null; // @jve:visual-info decl-index=0 visual-constraint="19,27"
|
29 |
private javax.swing.JTabbedPane jTabbedPane = null; |
30 |
private javax.swing.JPanel psegundo = null; |
31 |
private DefaultListModel m_lstModel; |
32 |
private JFileChooser fileChooser; |
33 |
|
34 |
private JPanel jPanel = null; |
35 |
private JButton btnAceptar = null; |
36 |
private JButton jButton = null; |
37 |
|
38 |
private boolean accepted = false; |
39 |
/**
|
40 |
* Creates a new FOpenDialog object.
|
41 |
*
|
42 |
* @param view Vista que vamos a refrescar
|
43 |
* @param mapControl MapControl que recibe la capa (te puede interesar
|
44 |
* a?adirla al principal o al Overview.
|
45 |
*/
|
46 |
public FOpenDialog() {
|
47 |
initialize(); |
48 |
|
49 |
// Cada vez que se abre, se borran las capas que pudiera haber.
|
50 |
m_lstModel = new DefaultListModel(); |
51 |
} |
52 |
|
53 |
/**
|
54 |
* This method initializes this
|
55 |
*/
|
56 |
private void initialize() { |
57 |
this.setLayout(new BorderLayout()); |
58 |
this.setSize(523, 369); |
59 |
this.setPreferredSize(new java.awt.Dimension(523, 369)); |
60 |
this.add(getJTabbedPane(), BorderLayout.CENTER); |
61 |
this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
|
62 |
} |
63 |
|
64 |
/**
|
65 |
* This method initializes jTabbedPane
|
66 |
*
|
67 |
* @return javax.swing.JTabbedPane
|
68 |
*/
|
69 |
private javax.swing.JTabbedPane getJTabbedPane() {
|
70 |
if (jTabbedPane == null) { |
71 |
jTabbedPane = new javax.swing.JTabbedPane();
|
72 |
jTabbedPane.setBounds(0, 0, 519, 352); |
73 |
} |
74 |
|
75 |
return jTabbedPane;
|
76 |
} |
77 |
|
78 |
public void addTab(String title, JPanel panel){ |
79 |
getJTabbedPane().addTab(title, panel); |
80 |
} |
81 |
|
82 |
public JPanel getSelectedTab(){ |
83 |
return (JPanel) getJTabbedPane().getSelectedComponent(); |
84 |
} |
85 |
|
86 |
public ViewInfo getViewInfo() {
|
87 |
ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
88 |
m_viewinfo.setTitle(PluginServices.getText(this,"Abrir_una_capa")); |
89 |
return m_viewinfo;
|
90 |
} |
91 |
|
92 |
/**
|
93 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
94 |
*/
|
95 |
public void viewActivated() { |
96 |
} |
97 |
|
98 |
/**
|
99 |
* This method initializes jPanel
|
100 |
*
|
101 |
* @return javax.swing.JPanel
|
102 |
*/
|
103 |
private JPanel getJPanel() { |
104 |
if (jPanel == null) { |
105 |
FlowLayout flowLayout1 = new FlowLayout(); |
106 |
jPanel = new JPanel(); |
107 |
jPanel.setLayout(flowLayout1); |
108 |
flowLayout1.setHgap(30);
|
109 |
jPanel.add(getBtnAceptar(), null);
|
110 |
jPanel.add(getJButton(), null);
|
111 |
} |
112 |
return jPanel;
|
113 |
} |
114 |
/**
|
115 |
* This method initializes btnAceptar
|
116 |
*
|
117 |
* @return javax.swing.JButton
|
118 |
*/
|
119 |
private JButton getBtnAceptar() { |
120 |
if (btnAceptar == null) { |
121 |
btnAceptar = new JButton(); |
122 |
btnAceptar.setText("Aceptar");
|
123 |
btnAceptar.addActionListener(new java.awt.event.ActionListener() {
|
124 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
125 |
accepted = true;
|
126 |
if (PluginServices.getMainFrame() == null) { |
127 |
((JDialog) (getParent().getParent().getParent()
|
128 |
.getParent())).dispose(); |
129 |
} else {
|
130 |
PluginServices.getMDIManager().closeView((View) FOpenDialog.this);
|
131 |
} |
132 |
} |
133 |
}); |
134 |
} |
135 |
return btnAceptar;
|
136 |
} |
137 |
/**
|
138 |
* This method initializes jButton
|
139 |
*
|
140 |
* @return javax.swing.JButton
|
141 |
*/
|
142 |
private JButton getJButton() { |
143 |
if (jButton == null) { |
144 |
jButton = new JButton(); |
145 |
jButton.setText("Cancelar");
|
146 |
jButton.addActionListener(new java.awt.event.ActionListener() {
|
147 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
148 |
if (PluginServices.getMDIManager() != null) { |
149 |
PluginServices.getMDIManager().closeView((View) FOpenDialog.this);
|
150 |
} else {
|
151 |
((JDialog) (getParent().getParent().getParent()
|
152 |
.getParent())).dispose(); |
153 |
} |
154 |
} |
155 |
}); |
156 |
} |
157 |
return jButton;
|
158 |
} |
159 |
public boolean isAccepted() { |
160 |
return accepted;
|
161 |
} |
162 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
163 |
// @jve:visual-info decl-index=0 visual-constraint="10,10"
|
164 |
// @jve:visual-info decl-index=0 visual-constraint="10,10"
|