Search in sources :

Example 6 with Window

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));
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) Window(com.extjs.gxt.ui.client.widget.Window) Label(com.extjs.gxt.ui.client.widget.Label) HTML(com.google.gwt.user.client.ui.HTML) MarginData(com.extjs.gxt.ui.client.widget.layout.MarginData) VerticalPanel(com.extjs.gxt.ui.client.widget.VerticalPanel) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) GWTJahiaValueDisplayBean(org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 7 with Window

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();
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) CalendarField(org.jahia.ajax.gwt.client.widget.form.CalendarField) Label(com.extjs.gxt.ui.client.widget.Label) VerticalPanel(com.extjs.gxt.ui.client.widget.VerticalPanel) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 8 with Window

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();
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) Button(com.extjs.gxt.ui.client.widget.button.Button) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 9 with Window

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();
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) HashMap(java.util.HashMap) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) BaseAsyncCallback(org.jahia.ajax.gwt.client.core.BaseAsyncCallback) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 10 with Window

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);
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) Button(com.extjs.gxt.ui.client.widget.button.Button) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Aggregations

Window (com.extjs.gxt.ui.client.widget.Window)19 Button (com.extjs.gxt.ui.client.widget.button.Button)14 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)12 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)11 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)9 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)7 List (java.util.List)6 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)5 ArrayList (java.util.ArrayList)5 RpcProxy (com.extjs.gxt.ui.client.data.RpcProxy)4 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)4 Label (com.extjs.gxt.ui.client.widget.Label)4 VerticalPanel (com.extjs.gxt.ui.client.widget.VerticalPanel)4 BaseAsyncCallback (org.jahia.ajax.gwt.client.core.BaseAsyncCallback)4 ListStore (com.extjs.gxt.ui.client.store.ListStore)3 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)3 ButtonBar (com.extjs.gxt.ui.client.widget.button.ButtonBar)3 FormButtonBinding (com.extjs.gxt.ui.client.widget.form.FormButtonBinding)3 TextField (com.extjs.gxt.ui.client.widget.form.TextField)3 CenterLayout (com.extjs.gxt.ui.client.widget.layout.CenterLayout)3