use of cz.metacentrum.perun.webgui.json.registrarManager.UpdateApplicationMail in project perun by CESNET.
the class EditMailTabItem method draw.
public Widget draw() {
this.titleWidget.setText("Edit notification");
// languages
ArrayList<String> languages = appMail.getLocales();
if (!Utils.getNativeLanguage().isEmpty() && !languages.contains(Utils.getNativeLanguage().get(0))) {
languages.add(Utils.getNativeLanguage().get(0));
}
if (!languages.contains("en"))
languages.add(0, "en");
// vertical panel
VerticalPanel vp = new VerticalPanel();
vp.setWidth("500px");
vp.setHeight("350px");
// tab panel
tabPanel.addStyleName("smallTabPanel");
tabPanel.addStyleName("smallTabPanelWithBorder");
tabPanel.setHeight("350px");
// basic settings
tabPanel.add(basicInformationTab(), "Basic settings");
// for each locale add tab
for (String locale : languages) {
tabPanel.add(messageTab(locale), "Lang: " + locale);
}
tabPanel.add(availableTagsTab(), "Available tags");
// add menu
final TabItem tab = this;
TabMenu tabMenu = new TabMenu();
saveButton = TabMenu.getPredefinedButton(ButtonType.SAVE, ButtonTranslation.INSTANCE.saveEmailNotificationForApplication(), new ClickHandler() {
public void onClick(ClickEvent event) {
// values
boolean send = sendingEnabledCheckBox.getValue();
appMail.setSend(send);
// messages
for (Map.Entry<String, TextArea> entry : messagesTextAreas.entrySet()) {
String locale = entry.getKey();
String subject = messagesSubjects.get(entry.getKey()).getValue();
String text = entry.getValue().getText();
MailText mt = MailText.construct(locale, subject, text);
appMail.setMessage(locale, mt);
}
// request
UpdateApplicationMail req = new UpdateApplicationMail(JsonCallbackEvents.closeTabDisableButtonEvents(saveButton, tab, true));
req.updateMail(appMail);
}
});
tabMenu.addWidget(saveButton);
tabMenu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
session.getTabManager().closeTab(tab, isRefreshParentOnClose());
}
}));
// add tab panel to main panel
vp.add(tabPanel);
vp.setCellWidth(tabPanel, "500px");
vp.setCellHeight(tabPanel, "350px");
vp.add(tabMenu);
vp.setCellHeight(tabMenu, "30px");
vp.setCellHorizontalAlignment(tabMenu, HasHorizontalAlignment.ALIGN_RIGHT);
this.contentWidget.setWidget(vp);
return getWidget();
}
Aggregations