use of org.apache.openmeetings.web.common.UploadableProfileImagePanel in project openmeetings by apache.
the class ProfileForm method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(passwd.setLabel(Model.of(getString("current.password"))).setRequired(true));
add(new FormSaveRefreshPanel<User>("buttons", this) {
private static final long serialVersionUID = 1L;
private void refreshUser() {
User u = getModelObject();
if (u.getId() != null) {
u = userDao.get(u.getId());
} else {
u = new User();
}
setModelObject(u);
}
@Override
protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
try {
userDao.update(getModelObject(), null, getUserId());
} catch (Exception e) {
error(e.getMessage());
}
refreshUser();
target.add(ProfileForm.this);
}
@Override
protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
refreshUser();
target.add(ProfileForm.this);
}
});
add(new WebMarkupContainer("changePwd").add(new ButtonBehavior("#changePwd"), new AjaxEventBehavior(EVT_CLICK) {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
chPwdDlg.open(target);
}
}));
add(userForm);
add(new UploadableProfileImagePanel("img", getUserId()));
add(new ComunityUserForm("comunity", getModel()));
// attach an ajax validation behavior to all form component's keydown
// event and throttle it down to once per second
add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND));
}
Aggregations