gvsig-desktop-customize / trunk / org.gvsig.customize.app / org.gvsig.customize.app.mainplugin / src / main / java / org / gvsig / customize / HttpProxyLoginDialog.java @ 1
History | View | Annotate | Download (2.34 KB)
1 |
|
---|---|
2 |
|
3 |
package org.gvsig.customize; |
4 |
|
5 |
import java.awt.event.ActionEvent; |
6 |
import java.awt.event.ActionListener; |
7 |
import org.gvsig.tools.ToolsLocator; |
8 |
import org.gvsig.tools.i18n.I18nManager; |
9 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
10 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
11 |
|
12 |
|
13 |
public class HttpProxyLoginDialog extends HttpProxyLoginDialogLayout { |
14 |
private boolean cancelled = true; |
15 |
|
16 |
public HttpProxyLoginDialog() {
|
17 |
initComponents(); |
18 |
} |
19 |
|
20 |
private void initComponents() { |
21 |
this.botLogin.addActionListener(new ActionListener() { |
22 |
public void actionPerformed(ActionEvent e) { |
23 |
doLogin(); |
24 |
} |
25 |
}); |
26 |
this.botCancel.addActionListener(new ActionListener() { |
27 |
public void actionPerformed(ActionEvent e) { |
28 |
doCancel(); |
29 |
} |
30 |
}); |
31 |
translate(); |
32 |
} |
33 |
|
34 |
protected void doLogin() { |
35 |
this.setVisible(false); |
36 |
this.cancelled = false; |
37 |
} |
38 |
|
39 |
protected void doCancel() { |
40 |
this.setVisible(false); |
41 |
this.cancelled = true; |
42 |
} |
43 |
|
44 |
public boolean login() { |
45 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
46 |
WindowManager winmanager = ToolsSwingLocator.getWindowManager(); |
47 |
winmanager.showWindow( |
48 |
this,
|
49 |
i18nManager.getTranslation("_Proxy_authentication"),
|
50 |
WindowManager.MODE.DIALOG |
51 |
); |
52 |
return ! this.cancelled; |
53 |
} |
54 |
|
55 |
public String getUserName() { |
56 |
return this.txtName.getText(); |
57 |
} |
58 |
|
59 |
public String getPassword() { |
60 |
return this.txtPassword.getText(); |
61 |
} |
62 |
|
63 |
public boolean canelled() { |
64 |
return this.cancelled; |
65 |
} |
66 |
|
67 |
void setUserName(String userName) { |
68 |
this.txtName.setText(userName);
|
69 |
} |
70 |
|
71 |
void setPassword(String password) { |
72 |
this.txtPassword.setText(password);
|
73 |
} |
74 |
|
75 |
private void translate() { |
76 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
77 |
lblTitle.setText(i18nManager.getTranslation("_User_information_to_access_internet"));
|
78 |
lblName.setText(i18nManager.getTranslation("_User_name")+":"); |
79 |
lblPassword.setText(i18nManager.getTranslation("_Password")+":"); |
80 |
botLogin.setText(i18nManager.getTranslation("_Accept"));
|
81 |
botCancel.setText(i18nManager.getTranslation("_Cancel"));
|
82 |
} |
83 |
} |