Search in sources :

Example 1 with FormButtonBinding

use of com.extjs.gxt.ui.client.widget.form.FormButtonBinding in project jahia by Jahia.

the class CreateButtonItem method showNamePopup.

protected void showNamePopup(final AbstractContentEngine engine, final boolean closeAfterSave) {
    final Window popup = new Window();
    popup.addStyleName("set-name-modal");
    popup.setHeadingHtml(Messages.get("label.saveAs", "Save as ..."));
    popup.setHeight(120);
    popup.setWidth(350);
    popup.setModal(true);
    FormPanel f = new FormPanel();
    f.setHeaderVisible(false);
    f.setBorders(false);
    final TextField<String> name = new TextField<String>();
    name.setFieldLabel(Messages.get("label.name", "Name"));
    name.setMinLength(1);
    f.add(name);
    Button b = new Button(Messages.get("label.submit", "submit"));
    b.addStyleName("button-submit");
    f.addButton(b);
    b.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent buttonEvent) {
            continuePrepareAndSave(engine, closeAfterSave, name.getValue());
            popup.hide();
        }
    });
    Button c = new Button(Messages.get("label.cancel", "Cancel"));
    c.addStyleName("button-cancel");
    c.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent buttonEvent) {
            popup.hide();
        }
    });
    f.addButton(c);
    f.setButtonAlign(Style.HorizontalAlignment.CENTER);
    FormButtonBinding binding = new FormButtonBinding(f);
    binding.addButton(b);
    popup.add(f);
    popup.setFocusWidget(name);
    popup.show();
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) 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) FormButtonBinding(com.extjs.gxt.ui.client.widget.form.FormButtonBinding) TextField(com.extjs.gxt.ui.client.widget.form.TextField)

Example 2 with FormButtonBinding

use of com.extjs.gxt.ui.client.widget.form.FormButtonBinding in project jahia by Jahia.

the class CreateResourceButtonItem method create.

@Override
public BoxComponent create(final AbstractContentEngine engine) {
    Button button = new Button(Messages.get("label.save", "Save"));
    button.setHeight(BUTTON_HEIGHT);
    button.addStyleName("button-save");
    button.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonOK());
    button.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent event) {
            GWTJahiaNode node = engine.getNode();
            if (node == null) {
                node = engine.getTargetNode();
            }
            final String nodePath = node.getPath();
            final Window popup = new Window();
            popup.addStyleName("create-resource-save-modal");
            popup.setHeadingHtml(Messages.get("label.saveAs", "Save as..."));
            popup.setHeight(120);
            popup.setWidth(350);
            popup.setModal(true);
            FormPanel f = new FormPanel();
            f.setHeaderVisible(false);
            f.setBorders(false);
            final TextField<String> name = new TextField<String>();
            name.setFieldLabel(Messages.get("label.name", "Name"));
            name.setMinLength(1);
            f.add(name);
            Button b = new Button(Messages.get("label.submit", "submit"));
            b.addStyleName("button-submit");
            f.addButton(b);
            b.addSelectionListener(new SelectionListener<ButtonEvent>() {

                @Override
                public void componentSelected(ButtonEvent buttonEvent) {
                    Map<String, String> parentNodesType = new LinkedHashMap<String, String>();
                    parentNodesType.put(nodePath, "jnt:folder");
                    String finalName = name.getValue();
                    if (fileExtension != null && !finalName.endsWith("." + fileExtension)) {
                        finalName += "." + fileExtension;
                    }
                    prepareAndSave(nodePath, finalName, parentNodesType, (CreateContentEngine) engine);
                    popup.hide();
                }
            });
            Button c = new Button(Messages.get("label.cancel", "Cancel"));
            c.addStyleName("button-cancel");
            c.addSelectionListener(new SelectionListener<ButtonEvent>() {

                @Override
                public void componentSelected(ButtonEvent buttonEvent) {
                    popup.hide();
                }
            });
            f.addButton(c);
            f.setButtonAlign(Style.HorizontalAlignment.CENTER);
            FormButtonBinding binding = new FormButtonBinding(f);
            binding.addButton(b);
            popup.add(f);
            popup.setFocusWidget(name);
            popup.show();
        }
    });
    return button;
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) FormButtonBinding(com.extjs.gxt.ui.client.widget.form.FormButtonBinding) 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) TextField(com.extjs.gxt.ui.client.widget.form.TextField) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Example 3 with FormButtonBinding

use of com.extjs.gxt.ui.client.widget.form.FormButtonBinding in project geo-platform by geosdi.

the class ProjectBindingWidget method addButtons.

private void addButtons() {
    getFormPanel().setButtonAlign(HorizontalAlignment.RIGHT);
    this.save = new GPSecureButton(ButtonsConstants.INSTANCE.saveText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.save()), new AddProjectAction(GPTrustedLevel.HIGH, this));
    getFormPanel().addButton(save);
    buttonBinding = new FormButtonBinding(getFormPanel());
    buttonBinding.addButton(save);
    this.cancel = new Button(ButtonsConstants.INSTANCE.cancelText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.cancel()), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            storeRejectChanges();
            hide();
        }
    });
    getFormPanel().addButton(cancel);
}
Also used : AddProjectAction(org.geosdi.geoplatform.gui.client.action.projects.AddProjectAction) GPSecureButton(org.geosdi.geoplatform.gui.action.button.GPSecureButton) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) FormButtonBinding(com.extjs.gxt.ui.client.widget.form.FormButtonBinding) GPSecureButton(org.geosdi.geoplatform.gui.action.button.GPSecureButton) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Example 4 with FormButtonBinding

use of com.extjs.gxt.ui.client.widget.form.FormButtonBinding in project geo-platform by geosdi.

the class FeatureAttributesWindow method addComponent.

@Override
public void addComponent() {
    VerticalPanel vp = new VerticalPanel();
    this.attributesFormPanel = new FormPanel();
    this.attributesFormPanel.setWidth(340);
    this.attributesFormPanel.setFieldWidth(180);
    this.attributesFormPanel.setHeaderVisible(false);
    Button saveButton = new Button(ButtonsConstants.INSTANCE.saveText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.save()), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            bindValues();
        }
    });
    Button resetButton = new Button(ButtonsConstants.INSTANCE.resetText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.reset()), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            resetFields();
        }
    });
    super.addButton(saveButton);
    super.addButton(resetButton);
    super.setButtonAlign(Style.HorizontalAlignment.CENTER);
    FormButtonBinding formButtonBinding = new FormButtonBinding(attributesFormPanel);
    formButtonBinding.addButton(saveButton);
    vp.add(this.attributesFormPanel);
    super.add(vp);
}
Also used : VerticalPanel(com.extjs.gxt.ui.client.widget.VerticalPanel) 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) FormButtonBinding(com.extjs.gxt.ui.client.widget.form.FormButtonBinding)

Example 5 with FormButtonBinding

use of com.extjs.gxt.ui.client.widget.form.FormButtonBinding in project jahia by Jahia.

the class SaveAsReferencesMenuActionItem method onComponentSelection.

@Override
public void onComponentSelection() {
    JahiaContentManagementService.App.getInstance().getPortalNodes(targetName.getValue(), new BaseAsyncCallback<List<GWTJahiaNode>>() {

        @Override
        public void onSuccess(List<GWTJahiaNode> result) {
            if (result == null || result.size() == 0) {
                MessageBox.alert(Messages.get("label.saveAsPortalComponent"), Messages.get("label.saveAsPortalComponent.portalComponents.nonedeclared", "There is no Portal Components folder declared. The component can not be saved"), null);
            } else if (result.size() == 1) {
                saveInPortalNode(result.get(0));
            } else {
                final Window popup = new Window();
                popup.addStyleName("save-as-reference-modal");
                popup.setHeadingHtml(Messages.get("label.saveAsPortalComponent.portalComponents.select", "Select a Portal Components folder"));
                popup.setWidth(500);
                popup.setAutoHeight(true);
                popup.setModal(true);
                FormPanel f = new FormPanel();
                f.setHeaderVisible(false);
                final ComboBox<GWTJahiaNode> portalNodesCombo = new ComboBox<GWTJahiaNode>();
                portalNodesCombo.setStore(new ListStore<GWTJahiaNode>());
                portalNodesCombo.setDisplayField(GWTJahiaNode.PATH);
                portalNodesCombo.setTriggerAction(ComboBox.TriggerAction.ALL);
                portalNodesCombo.setForceSelection(true);
                portalNodesCombo.getStore().add(result);
                ContentPanel p = new ContentPanel();
                p.setLayout(new FitLayout());
                p.setCollapsible(false);
                p.setFrame(false);
                p.setAnimCollapse(false);
                p.setBorders(false);
                p.setBodyBorder(false);
                p.setHeaderVisible(false);
                p.add(portalNodesCombo);
                f.add(p);
                Button b = new Button(Messages.get("label.save", "Save"));
                f.addButton(b);
                b.addSelectionListener(new SelectionListener<ButtonEvent>() {

                    @Override
                    public void componentSelected(ButtonEvent buttonEvent) {
                        GWTJahiaNode portalNode = portalNodesCombo.getValue();
                        if (portalNode != null) {
                            saveInPortalNode(portalNode);
                        }
                        popup.hide();
                    }
                });
                b.addStyleName("button-save");
                Button c = new Button(Messages.get("label.cancel", "Cancel"));
                c.addSelectionListener(new SelectionListener<ButtonEvent>() {

                    @Override
                    public void componentSelected(ButtonEvent buttonEvent) {
                        popup.hide();
                    }
                });
                c.addStyleName("button-cancel");
                f.addButton(c);
                f.setButtonAlign(Style.HorizontalAlignment.CENTER);
                FormButtonBinding binding = new FormButtonBinding(f);
                binding.addButton(b);
                popup.add(f);
                popup.show();
            }
        }

        @Override
        public void onApplicationFailure(Throwable caught) {
            Info.display(Messages.get("label.saveAsPortalComponent"), Messages.get("label.saveAsPortalComponent.cannotGetPortalNodes"));
        }
    });
}
Also used : Window(com.extjs.gxt.ui.client.widget.Window) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) FormButtonBinding(com.extjs.gxt.ui.client.widget.form.FormButtonBinding) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel) 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) List(java.util.List) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Aggregations

ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)5 Button (com.extjs.gxt.ui.client.widget.button.Button)5 FormButtonBinding (com.extjs.gxt.ui.client.widget.form.FormButtonBinding)5 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)4 Window (com.extjs.gxt.ui.client.widget.Window)3 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)2 TextField (com.extjs.gxt.ui.client.widget.form.TextField)2 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)2 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)1 VerticalPanel (com.extjs.gxt.ui.client.widget.VerticalPanel)1 ComboBox (com.extjs.gxt.ui.client.widget.form.ComboBox)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1 List (java.util.List)1 GPSecureButton (org.geosdi.geoplatform.gui.action.button.GPSecureButton)1 AddProjectAction (org.geosdi.geoplatform.gui.client.action.projects.AddProjectAction)1