|
Re: Problem with databinding [message #763747 is a reply to message #763682] |
Sat, 10 December 2011 13:28   |
Eclipse User |
|
|
|
I'm sorry, but I know what kind of problem you are describing from your description. Please provide a complete test case and any relevant screen shots of what you are seeing.
|
|
|
Re: Problem with databinding [message #764358 is a reply to message #763747] |
Mon, 12 December 2011 02:37   |
Kai Hackemesser Messages: 6 Registered: July 2009 |
Junior Member |
|
|
package com.hackemesser.util.ui;
import org.eclipse.swt.SWT;
public class LoginDialog extends Dialog {
private LoginBean m_result = new LoginBean();
protected Shell shlLogin;
private Text username;
private Text password;
/**
* Create the dialog.
*
* @param parent
* @param style
*/
public LoginDialog(Shell parent, int style) {
super(parent, style);
setText("Login");
}
/**
* Open the dialog.
*
* @return the result
*/
public LoginBean open() {
createContents();
shlLogin.open();
shlLogin.layout();
Display display = getParent().getDisplay();
while (!shlLogin.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return m_result;
}
/**
* Create contents of the dialog.
*/
private void createContents() {
shlLogin = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shlLogin.setText("Login");
shlLogin.setMinimumSize(new Point(200, 50));
shlLogin.setSize(302, 212);
shlLogin.setLayout(new FormLayout());
Label lblUsername = new Label(shlLogin, SWT.NONE);
FormData fd_lblUsername = new FormData();
fd_lblUsername.top = new FormAttachment(0, 13);
fd_lblUsername.left = new FormAttachment(0, 10);
lblUsername.setLayoutData(fd_lblUsername);
lblUsername.setText("&Username:");
Label lblPassword = new Label(shlLogin, SWT.NONE);
FormData fd_lblPassword = new FormData();
fd_lblPassword.top = new FormAttachment(lblUsername, 12);
fd_lblPassword.right = new FormAttachment(lblUsername, 0, SWT.RIGHT);
lblPassword.setLayoutData(fd_lblPassword);
lblPassword.setText("&Password:");
username = new Text(shlLogin, SWT.BORDER);
FormData fd_username = new FormData();
fd_username.top = new FormAttachment(lblUsername, -3, SWT.TOP);
fd_username.left = new FormAttachment(lblUsername, 6);
username.setLayoutData(fd_username);
password = new Text(shlLogin, SWT.BORDER | SWT.PASSWORD);
fd_username.right = new FormAttachment(password, 0, SWT.RIGHT);
FormData fd_password = new FormData();
fd_password.right = new FormAttachment(100, -22);
fd_password.left = new FormAttachment(lblPassword, 6);
fd_password.top = new FormAttachment(lblPassword, -3, SWT.TOP);
password.setLayoutData(fd_password);
Button btnOk = new Button(shlLogin, SWT.NONE);
FormData fd_btnOk = new FormData();
fd_btnOk.left = new FormAttachment(0, 33);
btnOk.setLayoutData(fd_btnOk);
btnOk.setText("&Ok");
Button btnCancel = new Button(shlLogin, SWT.NONE);
fd_btnOk.top = new FormAttachment(btnCancel, 0, SWT.TOP);
fd_btnOk.right = new FormAttachment(btnCancel, -6);
FormData fd_btnCancel = new FormData();
fd_btnCancel.bottom = new FormAttachment(100, -10);
fd_btnCancel.right = new FormAttachment(username, 0, SWT.RIGHT);
fd_btnCancel.left = new FormAttachment(100, -157);
btnCancel.setLayoutData(fd_btnCancel);
btnCancel.setText("&Cancel");
Button btnStorePassword = new Button(shlLogin, SWT.CHECK);
FormData fd_btnStorePassword = new FormData();
fd_btnStorePassword.top = new FormAttachment(password, 6);
fd_btnStorePassword.left = new FormAttachment(username, 0, SWT.LEFT);
btnStorePassword.setLayoutData(fd_btnStorePassword);
btnStorePassword.setText("&Store Password");
shlLogin.setTabList(new Control[] { username, password, btnOk, btnCancel });
}
}
package com.hackemesser.util.ui;
public class LoginBean {
private String username;
private String password;
private boolean storePassword;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isStorePassword() {
return storePassword;
}
public void setStorePassword(boolean storePassword) {
this.storePassword = storePassword;
}
}
Displaying that code shows the following in the windowbuilder bindings view:

The bean/field m_result is missing in the bindings view.
I just need to change the type of m_result to 'Object' and it looks like this:

As you can see, m_object appears in the beans list.
See my problem?
Cheers,
Kai
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03853 seconds