O objeto que quero editar pelo @form se relaciona com outro que tem de ser alterado junto
public class Server {
private String name;
private Authentication authentication;
}
public class Authentication {
private String user;
private String pass;
}
@Form(Server.class)
public class AddServer extends JFrame {
@Bindable(field = "name")
private JTextField name;
@Bindable(field = "usuario")
private JTextField usuario;
private Binder binder;
public AddServer() {
super("ServerForm");
name = new JTextField(20);
usuario = new JTextField(20);
JButton add = new JButton("Add");
JButton load = new JButton("Load");
setLayout(new GridLayout(3, 2));
add(new JLabel("Servidor:"));
add(name);
add(new JLabel("Usuário:"));
add(usuario);
add(add);
add(load);
load.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Authentication authentication = new Authentication();
authentication.setUser("sa");
authentication.setPass("g07#02#bdç");
Server server = new Server();
server.setName("g07mscp02\\bd03");
server.setAuthentication(authentication);
binder.updateView(server);
}
});
add.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Server server = new Server();
binder.updateModel(server);
//person.printAttrs();
}
});
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
binder = new AnnotatedBinder(this);
}
public static void main(String[] args) {
new AddServer().setVisible(true);
}
Erro:
com.towel.el.NotResolvableFieldException: Field 'usuario' can't be resolved for class: java.lang.Object.
at java.lang.Class.getDeclaredField(Class.java:2070)
at com.towel.el.handler.FieldHandler.getAcessibleField(FieldHandler.java:87)
at com.towel.el.handler.FieldHandler.getAcessibleField(FieldHandler.java:96)
at com.towel.el.handler.FieldHandler.addField(FieldHandler.java:79)
at com.towel.el.handler.FieldHandler.resolveField(FieldHandler.java:37)
at com.towel.el.FieldResolver.<init>(FieldResolver.java:74)
at com.towel.el.FieldResolver.<init>(FieldResolver.java:56)
at com.towel.bind.annotation.AnnotatedBinder.<init>(AnnotatedBinder.java:84)
at com.krismorte.safetydb.swing.AddServer.<init>(AddServer.java:70)
at com.krismorte.safetydb.swing.AddServer.main(AddServer.java:74)
------------------------------------------------------------------------
O objeto que quero editar pelo @form se relaciona com outro que tem de ser alterado junto
Erro:
A annotation vai conseguir tratar essa relação?