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