use of au.com.vaadinutils.editors.InputFormDialog in project VaadinUtils by rlsutton1.
the class DashBoardView method createRenameButton.
private Button createRenameButton() {
Button rename = new Button(FontAwesome.EDIT);
rename.setDescription("Rename Dashboard");
rename.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
rename.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1058348590862935257L;
@Override
public void buttonClick(ClickEvent event) {
Tblportallayout portalLayout = (Tblportallayout) dashBoardSelector.getValue();
if (portalLayout == null) {
Notification.show("You must select a dashboard first", Type.ERROR_MESSAGE);
return;
}
final TextField primaryFocusField = new TextField("New Dashboard Name");
AbstractLayout form = new FormLayout();
form.setSizeFull();
form.addComponent(primaryFocusField);
InputFormDialogRecipient recipient = new InputFormDialogRecipient() {
@Override
public boolean onOK() {
Tblportallayout portalLayout = (Tblportallayout) dashBoardSelector.getValue();
container.removeItem(portalLayout);
portalLayout = JpaBaseDao.getGenericDao(Tblportallayout.class).findById(portalLayout.getId());
portalLayout.setName(primaryFocusField.getValue());
container.addBean(portalLayout);
dashBoardSelector.select(portalLayout);
dashboardsSlider.setCaption("Dashboards: " + portalLayout.getName());
return true;
}
@Override
public boolean onCancel() {
return true;
}
};
new InputFormDialog(UI.getCurrent(), "Rename " + portalLayout.getName() + " to:", primaryFocusField, form, recipient);
}
});
return rename;
}
Aggregations