use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class DistributionServerWindow method onRender.
@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
addStyleName("distribution-server-window");
setLayout(new FitLayout());
setHeadingHtml(Messages.get("label.releaseModule.distributionServer", "Distribution server (Maven)"));
setModal(true);
setWidth(500);
setHeight(380);
VerticalPanel p = new VerticalPanel();
p.add(new Label(Messages.get("label.releaseModule.distributionServer.notProvided", "No target distribution server configured for this module yet.")));
p.add(new HTML("<br/>"));
p.add(new Label(Messages.get("label.releaseModule.distributionServer.purpose", "A target distribution server is a Maven repository," + " where built module artifacts (module JAR file)" + " are pushed to during module release process.")));
p.add(new Label(Messages.get("label.releaseModule.distributionServer.authentication", "If your distribution server requires authentication, please, provide the corresponding" + " <server/> section in your Maven's settings.xml file.")));
p.add(new HTML("<br/>"));
p.add(new Label(Messages.get("label.releaseModule.distributionServer.provideNow", "Would you like to configure the distribution server now?")));
final FormPanel formPanel = new FormPanel();
formPanel.setHeaderVisible(false);
formPanel.setLabelWidth(100);
formPanel.setFieldWidth(330);
formPanel.setButtonAlign(Style.HorizontalAlignment.CENTER);
formPanel.setBorders(false);
final ComboBox<GWTJahiaValueDisplayBean> combo = new ComboBox<GWTJahiaValueDisplayBean>();
combo.setFieldLabel("Repository type");
combo.setValueField("value");
combo.setDisplayField("display");
combo.setStore(new ListStore<GWTJahiaValueDisplayBean>());
combo.getStore().add(new GWTJahiaValueDisplayBean("forge", "Jahia Private App Store"));
combo.getStore().add(new GWTJahiaValueDisplayBean("maven", "Maven repository"));
combo.setForceSelection(true);
combo.setTypeAhead(false);
combo.setTriggerAction(ComboBox.TriggerAction.ALL);
formPanel.add(combo);
final FieldSet forgeFs = new FieldSet();
final FormLayout forgeFl = new FormLayout();
forgeFl.setLabelWidth(100);
forgeFl.setDefaultWidth(330);
forgeFs.setLayout(forgeFl);
final TextField<String> tfForgeUrl = new TextField<String>();
tfForgeUrl.setFieldLabel(Messages.get("label.url", "URL"));
String separator = tfForgeUrl.getLabelSeparator() != null ? tfForgeUrl.getLabelSeparator() : "";
tfForgeUrl.setLabelSeparator(separator + " <img width='16px' height='16px' src='" + JahiaGWTParameters.getContextPath() + "/modules/default/images/icons/information.png' title='" + Messages.get("label.releaseModule.distributionServer.url.help", "Copy URL displayed on the Private App Store home page").replace("'", " ") + "'/>");
tfForgeUrl.setAllowBlank(false);
if (info.getForgeUrl() != null) {
tfForgeUrl.setValue(info.getForgeUrl());
}
forgeFs.add(tfForgeUrl);
final TextField<String> tfUsername = new TextField<String>();
final TextField<String> tfPassword = new TextField<String>();
tfUsername.setFieldLabel(Messages.get("label.username", "Username"));
tfPassword.setFieldLabel(Messages.get("label.password", "Password"));
tfPassword.setPassword(true);
tfUsername.setValue(ForgeLoginWindow.username);
tfPassword.setValue(ForgeLoginWindow.password);
forgeFs.add(tfUsername);
forgeFs.add(tfPassword);
final FieldSet mavenFs = new FieldSet();
final FormLayout mavenfl = new FormLayout();
mavenfl.setLabelWidth(30);
mavenfl.setDefaultWidth(400);
mavenFs.setLayout(mavenfl);
final TextField<String> tfRepoId = new TextField<String>();
tfRepoId.setFieldLabel(Messages.get("label.id", "ID"));
tfRepoId.setAllowBlank(false);
if (info.getRepositoryId() != null) {
tfRepoId.setValue(info.getRepositoryId());
}
mavenFs.add(tfRepoId);
final TextField<String> tfRepoUrl = new TextField<String>();
tfRepoUrl.setFieldLabel(Messages.get("label.url", "URL"));
tfRepoUrl.setAllowBlank(false);
if (info.getRepositoryUrl() != null) {
tfRepoUrl.setValue(info.getRepositoryUrl());
}
mavenFs.add(tfRepoUrl);
formPanel.add(mavenFs);
if (info.getForgeUrl() == null && info.getRepositoryUrl() != null) {
combo.setValue(combo.getStore().getAt(1));
forgeFs.hide();
} else {
combo.setValue(combo.getStore().getAt(0));
mavenFs.hide();
}
formPanel.add(forgeFs);
combo.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaValueDisplayBean>() {
@Override
public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
if (se.getSelectedItem().getValue().equals("forge")) {
mavenFs.hide();
forgeFs.show();
} else {
forgeFs.hide();
mavenFs.show();
}
formPanel.layout();
}
});
final Window w = this;
Button button = new Button(Messages.get("label.save", "Save"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
w.hide();
if (combo.getValue().getValue().equals("forge")) {
info.setForgeUrl(tfForgeUrl.getValue());
info.setUsername(tfUsername.getValue());
info.setPassword(tfPassword.getValue());
ForgeLoginWindow.username = tfUsername.getValue();
ForgeLoginWindow.password = tfPassword.getValue();
} else {
info.setForgeUrl(null);
info.setRepositoryUrl(tfRepoUrl.getValue());
info.setRepositoryId(tfRepoId.getValue());
}
callback(info);
}
});
button.addStyleName("button-save");
formPanel.addButton(button);
Button skip = new Button(Messages.get("label.skip", "Skip"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
w.hide();
callback(null);
}
});
skip.addStyleName("button-skip");
formPanel.addButton(skip);
p.add(formPanel);
add(p, new MarginData(5));
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class ExecuteRemotePublicationActionItem method onComponentSelection.
@Override
public void onComponentSelection() {
if (wnd != null) {
wnd.show();
return;
}
wnd = new Window();
wnd.setWidth(550);
wnd.setHeight(showOptions ? 220 : 120);
wnd.setModal(true);
wnd.setBlinkModal(true);
wnd.setHeadingHtml(titleKey != null ? Messages.get(titleKey) : Messages.get("label.information", "Information"));
wnd.setLayout(new FitLayout());
final FormPanel form = new FormPanel();
form.setHeight(showOptions ? 180 : 80);
form.setHeaderVisible(false);
form.setFrame(false);
form.setLabelWidth(250);
VerticalPanel vpLabels = new VerticalPanel();
vpLabels.add(new Label(confirmationMessageKey != null ? Messages.get(confirmationMessageKey, "You are about to execute action " + action + ". Do you want to continue?") : "You are about to execute action " + action + ". Do you want to continue?"));
form.add(vpLabels);
if (showOptions) {
FieldSet fieldSet = new FieldSet();
fieldSet.setHeadingHtml(Messages.get("label.options", "Options"));
FormLayout layout = new FormLayout();
layout.setLabelWidth(250);
fieldSet.setLayout(layout);
fieldSet.setCollapsible(true);
fieldSet.collapse();
fieldSet.addListener(Events.Expand, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent componentEvent) {
wnd.setHeight(wnd.getHeight() + 70);
}
});
fieldSet.addListener(Events.Collapse, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent componentEvent) {
wnd.setHeight(wnd.getHeight() - 70);
}
});
calendarFieldStart = new CalendarField("yyyy-MM-dd HH:mm", true, false, "startDate", false, null);
calendarFieldStart.setFieldLabel(Messages.get("label.remotePublication.startDate", "Start time of the replication (optional)"));
calendarFieldStart.setAllowBlank(true);
fieldSet.add(calendarFieldStart);
calendarFieldEnd = new CalendarField("yyyy-MM-dd HH:mm", true, false, "endDate", false, null);
calendarFieldEnd.setFieldLabel(Messages.get("label.remotePublication.endDate", "End time of the replication (optional)"));
calendarFieldEnd.setAllowBlank(true);
fieldSet.add(calendarFieldEnd);
form.add(fieldSet);
}
Button btnSubmit = new Button(Messages.get("label.yes", "Yes"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
wnd.mask(Messages.get("label.executing", "Executing action..."));
doAction();
}
});
btnSubmit.addStyleName("button-yes");
form.addButton(btnSubmit);
Button btnCancel = new Button(Messages.get("label.no", "No"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
wnd.hide();
}
});
btnCancel.addStyleName("button-no");
form.addButton(btnCancel);
form.setButtonAlign(HorizontalAlignment.CENTER);
wnd.add(form);
wnd.layout();
wnd.show();
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class UpdateModuleActionItem method showUpdateResult.
private void showUpdateResult(String output, boolean isError) {
final Window wnd = new Window();
wnd.addStyleName("update-results-modal");
wnd.setWidth(450);
wnd.setHeight(250);
wnd.setModal(true);
wnd.setBlinkModal(true);
wnd.setHeadingHtml(Messages.get("label.updateModule", "Update module"));
wnd.setLayout(new FitLayout());
final FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setFrame(false);
form.setLabelAlign(LabelAlign.TOP);
form.setFieldWidth(415);
final TextArea message = new TextArea();
message.setName("status");
message.setFieldLabel(Messages.get("label.status", "Status") + " - " + (isError ? Messages.get("label.error", "Error") : Messages.get("label.sourceControl.module.updated", "Module updated")));
message.setHeight(120);
message.setValue(output);
message.setReadOnly(true);
form.add(message);
Button btnClose = new Button(Messages.get("label.close", "Close"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent event) {
wnd.hide();
}
});
btnClose.addStyleName("button-close");
form.addButton(btnClose);
form.setButtonAlign(Style.HorizontalAlignment.CENTER);
wnd.add(form);
wnd.layout();
wnd.setFocusWidget(message);
wnd.show();
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class CommitModuleActionItem method onComponentSelection.
@Override
public void onComponentSelection() {
final Window wnd = new Window();
wnd.addStyleName("commit-modal");
wnd.setWidth(450);
wnd.setHeight(200);
wnd.setModal(true);
wnd.setBlinkModal(true);
wnd.setHeadingHtml(Messages.get("label.commitModule", "Commit module"));
wnd.setLayout(new FitLayout());
final FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setFrame(false);
form.setLabelAlign(LabelAlign.TOP);
form.setFieldWidth(415);
final TextArea message = new TextArea();
message.setName("sources");
message.setFieldLabel(Messages.get("label.comment", "Comment"));
message.setHeight(80);
form.add(message);
Button btnSubmit = new Button(Messages.get("label.save", "Save"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent event) {
wnd.hide();
linker.loading(Messages.get("message.moduleSaving", "Saving module..."));
JahiaContentManagementService.App.getInstance().saveModule(JahiaGWTParameters.getSiteKey(), message.getValue(), new BaseAsyncCallback<Object>() {
@Override
public void onSuccess(Object result) {
linker.loaded();
Info.display(Messages.get("label.information", "Information"), Messages.get("message.moduleSaved", "Module saved"));
Map<String, Object> data = new HashMap<String, Object>();
data.put("event", "commit");
linker.refresh(data);
}
@Override
public void onApplicationFailure(Throwable caught) {
linker.loaded();
MessageBox.alert(Messages.get("label.error", "Error"), caught.getMessage(), null);
Map<String, Object> data = new HashMap<String, Object>();
data.put("event", "commit");
linker.refresh(data);
}
});
}
});
btnSubmit.addStyleName("button-submit");
form.addButton(btnSubmit);
Button btnCancel = new Button(Messages.get("label.cancel", "Cancel"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent event) {
wnd.hide();
}
});
btnCancel.addStyleName("button-cancel");
form.addButton(btnCancel);
form.setButtonAlign(Style.HorizontalAlignment.CENTER);
wnd.add(form);
wnd.layout();
wnd.setFocusWidget(message);
wnd.show();
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class ForgeLoginWindow method onRender.
@Override
protected void onRender(Element element, int index) {
super.onRender(element, index);
setLayout(new FitLayout());
setHeadingHtml(Messages.get("label.login", "Login"));
setModal(true);
setWidth(500);
setHeight(150);
final FormPanel formPanel = new FormPanel();
formPanel.setHeaderVisible(false);
formPanel.setLabelWidth(150);
formPanel.setButtonAlign(Style.HorizontalAlignment.CENTER);
final TextField<String> tfUsername = new TextField<String>();
tfUsername.setFieldLabel(Messages.get("label.username", "Username"));
tfUsername.setValue(username);
formPanel.add(tfUsername);
final TextField<String> tfPassword = new TextField<String>();
tfPassword.setFieldLabel(Messages.get("label.password", "Password"));
tfPassword.setValue(password);
tfPassword.setPassword(true);
formPanel.add(tfPassword);
Button b = new Button(Messages.get("label.login", "Login"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
ForgeLoginWindow.username = tfUsername.getValue();
ForgeLoginWindow.password = tfPassword.getValue();
callback.handle(tfUsername.getValue(), tfPassword.getValue());
}
});
b.addStyleName("button-login");
formPanel.addButton(b);
final Window w = this;
b = new Button(Messages.get("label.cancel", "Cancel"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
w.hide();
}
});
b.addStyleName("button-cancel");
formPanel.addButton(b);
add(formPanel);
}
Aggregations