svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / Tag.java @ 596
History | View | Annotate | Download (2.72 KB)
1 |
package com.iver.cit.gvsig.gui.layout; |
---|---|
2 |
|
3 |
import javax.swing.JButton; |
4 |
import javax.swing.JLabel; |
5 |
import javax.swing.JPanel; |
6 |
import javax.swing.JTextField; |
7 |
|
8 |
import com.iver.andami.PluginServices; |
9 |
import com.iver.andami.Utilities; |
10 |
import com.iver.andami.ui.mdiManager.View; |
11 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
12 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame; |
13 |
public class Tag extends JPanel implements View{ |
14 |
|
15 |
private JTextField jTextField = null; |
16 |
private JLabel jLabel = null; |
17 |
private JButton jButton = null; |
18 |
private JButton jButton1 = null; |
19 |
private IFFrame fframe=null; |
20 |
/**
|
21 |
* This method initializes jTextField
|
22 |
*
|
23 |
* @return javax.swing.JTextField
|
24 |
*/
|
25 |
private JTextField getJTextField() { |
26 |
if (jTextField == null) { |
27 |
jTextField = new JTextField(); |
28 |
if (fframe.getTag()!=null){ |
29 |
jTextField.setText(fframe.getTag()); |
30 |
} |
31 |
jTextField.setPreferredSize(new java.awt.Dimension(200,20)); |
32 |
} |
33 |
return jTextField;
|
34 |
} |
35 |
/**
|
36 |
* This method initializes jButton
|
37 |
*
|
38 |
* @return javax.swing.JButton
|
39 |
*/
|
40 |
private JButton getJButton() { |
41 |
if (jButton == null) { |
42 |
jButton = new JButton(); |
43 |
jButton.setText("Aceptar");
|
44 |
jButton.addActionListener(new java.awt.event.ActionListener() {
|
45 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
46 |
if (getJTextField().getText().compareTo("")==0){ |
47 |
fframe.setTag(null);
|
48 |
}else{
|
49 |
fframe.setTag(getJTextField().getText()); |
50 |
} |
51 |
PluginServices.getMDIManager().closeView(Tag.this); |
52 |
} |
53 |
}); |
54 |
} |
55 |
return jButton;
|
56 |
} |
57 |
/**
|
58 |
* This method initializes jButton1
|
59 |
*
|
60 |
* @return javax.swing.JButton
|
61 |
*/
|
62 |
private JButton getJButton1() { |
63 |
if (jButton1 == null) { |
64 |
jButton1 = new JButton(); |
65 |
jButton1.setText("Cancelar");
|
66 |
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
67 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
68 |
PluginServices.getMDIManager().closeView(Tag.this); |
69 |
} |
70 |
}); |
71 |
} |
72 |
return jButton1;
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* This is the default constructor
|
77 |
*/
|
78 |
public Tag(IFFrame f) {
|
79 |
super();
|
80 |
fframe=f; |
81 |
initialize(); |
82 |
} |
83 |
/**
|
84 |
* This method initializes this
|
85 |
*
|
86 |
* @return void
|
87 |
*/
|
88 |
private void initialize() { |
89 |
jLabel = new JLabel(); |
90 |
this.setSize(267, 72); |
91 |
jLabel.setText("tag");
|
92 |
this.add(jLabel, null); |
93 |
this.add(getJTextField(), null); |
94 |
this.add(getJButton(), null); |
95 |
this.add(getJButton1(), null); |
96 |
} |
97 |
/**
|
98 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
99 |
*/
|
100 |
public ViewInfo getViewInfo() {
|
101 |
ViewInfo m_viewinfo=new ViewInfo();
|
102 |
m_viewinfo.setTitle(PluginServices.getText(this, "tag")); |
103 |
return m_viewinfo;
|
104 |
} |
105 |
/**
|
106 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
107 |
*/
|
108 |
public void viewActivated() { |
109 |
} |
110 |
} // @jve:decl-index=0:visual-constraint="20,10"
|