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();
}
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;
}
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);
}
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);
}
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"));
}
});
}
Aggregations