use of com.extjs.gxt.ui.client.widget.button.ButtonBar in project geo-platform by geosdi.
the class ViewportGridFieldSet method addComponents.
@Override
public void addComponents() {
store.addStoreListener(new StoreListener<GPClientViewport>() {
@Override
public void storeUpdate(StoreEvent<GPClientViewport> se) {
super.storeUpdate(se);
ViewportGridFieldSet.this.saveButton.enable();
}
});
this.add(createViewportFilter());
this.add(this.generateGrid(), new FormData("100%"));
ButtonBar buttonBar = new ButtonBar();
Button addEntryButton = new Button(MapModuleConstants.INSTANCE.ViewportGridFieldSet_buttonAddViewportText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.done()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
ViewportGridFieldSet.this.store.add(ViewportUtility.generateViewportFromMap(map));
viewportGrid.startEditing(store.getCount() - 1, 1);
ViewportGridFieldSet.this.saveButton.enable();
}
});
buttonBar.add(addEntryButton);
this.deleteViewportButton = new Button(MapModuleConstants.INSTANCE.ViewportGridFieldSet_buttonDeleteViewportText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.delete()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
final List<GPClientViewport> viewportList = viewportGrid.getSelectionModel().getSelectedItems();
if (viewportList != null) {
GeoPlatformMessage.confirmMessage(MapModuleConstants.INSTANCE.ViewportGridFieldSet_confirmDeleteViewportTitleText(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_confirmDeleteViewportBodyText(), new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
if (Dialog.YES.equals(be.getButtonClicked().getItemId())) {
for (GPClientViewport viewport : viewportList) {
store.remove(viewport);
ViewportGridFieldSet.this.saveButton.enable();
}
}
}
});
}
}
});
deleteViewportButton.setEnabled(Boolean.FALSE);
buttonBar.add(deleteViewportButton);
this.gotoViewportButton = new Button(MapModuleConstants.INSTANCE.ViewportGridFieldSet_buttonGoToViewportText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.gotoXY()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
final List<GPClientViewport> viewportList = viewportGrid.getSelectionModel().getSelectedItems();
if (viewportList != null && viewportList.size() == 1) {
ViewportUtility.gotoViewportLocation(map, viewportList.get(0));
} else {
GeoPlatformMessage.alertMessage(MapModuleConstants.INSTANCE.ViewportGridFieldSet_singleSelectionAlertTitleText(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_singleSelectionAlertBodyText());
}
}
});
gotoViewportButton.setEnabled(Boolean.FALSE);
buttonBar.add(gotoViewportButton);
this.setDefaultViewportButton = new Button(ButtonsConstants.INSTANCE.setDefautlText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.select()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
final List<GPClientViewport> viewportList = viewportGrid.getSelectionModel().getSelectedItems();
if (viewportList != null && viewportList.size() == 1) {
GPClientViewport selectedViewport = viewportList.get(0);
for (GPClientViewport viewport : ViewportGridFieldSet.this.store.getModels()) {
if (viewport.isDefault()) {
viewport.set(ViewportEnum.IS_DEFAULT.toString(), Boolean.FALSE);
store.update(viewport);
} else if (selectedViewport.equals(viewport)) {
viewport.set(ViewportEnum.IS_DEFAULT.toString(), Boolean.TRUE);
store.update(viewport);
}
}
} else {
GeoPlatformMessage.alertMessage(MapModuleConstants.INSTANCE.ViewportGridFieldSet_setDefaultViewportAlertTitleText(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_singleSelectionAlertBodyText());
}
}
});
setDefaultViewportButton.setEnabled(Boolean.FALSE);
buttonBar.add(setDefaultViewportButton);
SaveViewportAction saveViewportAction = new SaveViewportAction(GPTrustedLevel.LOW, this.store);
this.saveButton = new GPSecureButton(ButtonsConstants.INSTANCE.saveText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.save()), saveViewportAction);
buttonBar.add(this.saveButton);
this.add(buttonBar, new FormData("100%"));
}
use of com.extjs.gxt.ui.client.widget.button.ButtonBar in project geo-platform by geosdi.
the class FeatureWidgetBar method get.
@Override
public ButtonBar get() {
final ButtonBar featureWidgetBar = new ButtonBar();
featureWidgetBar.add(wfsGoToXYButton);
featureWidgetBar.add(new SeparatorToolItem());
featureWidgetBar.add(this.wfsUndoButton);
featureWidgetBar.add(this.wfsRedoButton);
return featureWidgetBar;
}
use of com.extjs.gxt.ui.client.widget.button.ButtonBar in project jahia by Jahia.
the class ContentPickerField method onTriggerClick.
@Override
protected void onTriggerClick(ComponentEvent ce) {
super.onTriggerClick(ce);
if (disabled || isReadOnly()) {
return;
}
if (configuration.equals("userpicker")) {
new UserGroupSelect(new UserPickerAdder(), UserGroupSelect.VIEW_USERS, JahiaGWTParameters.getSiteNode().getName(), !multiple);
} else if (configuration.equals("usergrouppicker")) {
new UserGroupSelect(new UserPickerAdder(), UserGroupSelect.VIEW_TABS, JahiaGWTParameters.getSiteNode().getName(), !multiple);
} else if (configuration.equals("custompicker")) {
JahiaContentManagementService.App.getInstance().getManagerConfiguration(selectorOptions.get("config"), null, new BaseAsyncCallback<GWTManagerConfiguration>() {
public void onSuccess(GWTManagerConfiguration config) {
PermissionsUtils.loadPermissions(config.getPermissions());
final Window w = new Window();
w.setLayout(new FitLayout());
w.setId("JahiaGxtCustomContentPickerWindow");
w.addStyleName("modal-" + configuration);
final CustomContentPicker contentPicker = new CustomContentPicker(config.getCustomPickerConfiguration(), getValue(), config.getSiteNode());
if (config.getTitle() != null) {
w.setHeadingHtml(config.getTitle());
} else {
w.setHeadingHtml(Messages.get("label." + config.getName(), config.getName()));
}
int windowHeight = com.google.gwt.user.client.Window.getClientHeight() - 10;
w.setModal(true);
w.setSize(900, windowHeight);
w.setResizable(true);
w.setMaximizable(true);
w.setBodyBorder(false);
final ButtonBar bar = new ButtonBar();
bar.setAlignment(Style.HorizontalAlignment.CENTER);
final Button ok = new Button(Messages.get("label.save"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
List<String> values = contentPicker.getValues();
JahiaContentManagementService.App.getInstance().getNodes(values, null, new BaseAsyncCallback<List<GWTJahiaNode>>() {
@Override
public void onSuccess(List<GWTJahiaNode> gwtJahiaNodes) {
setValue(gwtJahiaNodes);
w.hide();
}
});
}
});
ok.addStyleName("button-save");
ok.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonOK());
bar.add(ok);
if (getValue() == null || getValue().size() == 0) {
ok.setEnabled(false);
}
ok.setEnabled(true);
final Button cancel = new Button(Messages.get("label.cancel"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
w.hide();
}
});
cancel.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonCancel());
cancel.addStyleName("button-cancel");
bar.add(cancel);
w.add(contentPicker);
w.setBottomComponent(bar);
w.show();
contentPicker.loadData();
}
public void onApplicationFailure(Throwable throwable) {
Log.error("Error while loading user permission", throwable);
}
});
} else {
JahiaContentManagementService.App.getInstance().getManagerConfiguration(configuration, null, new BaseAsyncCallback<GWTManagerConfiguration>() {
public void onSuccess(GWTManagerConfiguration config) {
PermissionsUtils.loadPermissions(config.getPermissions());
final Window w = new Window();
w.setLayout(new FitLayout());
w.setId("JahiaGxtContentPickerWindow");
w.addStyleName("modal-" + configuration);
final ContentPicker contentPicker = new ContentPicker(selectorOptions, getValue(), types, filters, mimeTypes, config, multiple);
if (config.getTitle() != null) {
w.setHeadingHtml(config.getTitle());
} else {
w.setHeadingHtml(Messages.get("label." + config.getName(), config.getName()));
}
int windowHeight = com.google.gwt.user.client.Window.getClientHeight() - 10;
w.setModal(true);
w.setSize(900, windowHeight);
w.setResizable(true);
w.setMaximizable(true);
w.setBodyBorder(false);
final ButtonBar bar = new ButtonBar();
bar.setAlignment(Style.HorizontalAlignment.CENTER);
final Button ok = new Button(Messages.get("label.save"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
List<GWTJahiaNode> selection = contentPicker.getSelectedNodes();
setValue(selection);
w.hide();
}
});
ok.addStyleName("button-save");
ok.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonOK());
bar.add(ok);
contentPicker.setSaveButton(ok);
if (getValue() == null || getValue().size() == 0) {
ok.setEnabled(false);
}
final Button cancel = new Button(Messages.get("label.cancel"), new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
w.hide();
}
});
cancel.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonCancel());
cancel.addStyleName("button-cancel");
bar.add(cancel);
w.add(contentPicker);
w.setBottomComponent(bar);
w.show();
}
public void onApplicationFailure(Throwable throwable) {
Log.error("Error while loading user permission", throwable);
}
});
}
}
use of com.extjs.gxt.ui.client.widget.button.ButtonBar in project jahia by Jahia.
the class TranslateContentEngine method init.
protected void init() {
setLayout(new FitLayout());
setBodyBorder(false);
int windowHeight = com.google.gwt.user.client.Window.getClientHeight() - 10;
int windowWidth = com.google.gwt.user.client.Window.getClientWidth() - 10;
setSize(windowWidth, windowHeight);
setClosable(true);
setResizable(true);
setModal(true);
setMaximizable(true);
setHeadingHtml(Messages.get("label.translate", "Translate") + ": " + node.getName());
LayoutContainer panel = new LayoutContainer();
panel.setLayout(new BorderLayout());
sourceLangPropertiesEditor = new LangPropertiesEditor(node, Arrays.asList(GWTJahiaItemDefinition.CONTENT), false, srcLanguage, null, new LangPropertiesEditor.CallBack() {
@Override
public void execute() {
if (targetLangPropertiesEditor != null && targetLangPropertiesEditor.isNeedRefresh()) {
// target lang properties editor is waiting for the source lang properties editor to be fully loaded
// it's now the case, so refresh it.
targetLangPropertiesEditor.refresh();
}
}
});
targetLangPropertiesEditor = new LangPropertiesEditor(node, Arrays.asList(GWTJahiaItemDefinition.CONTENT), true, destLanguage, sourceLangPropertiesEditor, new LangPropertiesEditor.CallBack() {
@Override
public void execute() {
wipCheckbox.setValue(workInProgressByLocale.contains(targetLangPropertiesEditor.getDisplayedLocale().getLanguage()));
}
});
// Fill WIP infos
if (node.getWorkInProgressStatus() != null) {
// set languages
if (node.getWorkInProgressLanguages() != null) {
workInProgressByLocale.addAll(node.getWorkInProgressLanguages());
}
}
Button copyButton = new Button(Messages.get("label.translate.copy", "Copy to other language"));
copyButton.addStyleName("button-translatecopy");
sourceLangPropertiesEditor.getTopBar().add(copyButton);
copyButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
PropertiesEditor sourcePropertiesEditor = sourceLangPropertiesEditor.getPropertiesEditorByLang(sourceLangPropertiesEditor.getDisplayedLocale().getLanguage());
List<GWTJahiaNodeProperty> props = sourcePropertiesEditor.getProperties();
Map<String, PropertiesEditor.PropertyAdapterField> fieldsMap = targetLangPropertiesEditor.getPropertiesEditorByLang(targetLangPropertiesEditor.getDisplayedLocale().getLanguage()).getFieldsMap();
for (final GWTJahiaNodeProperty prop : props) {
if (sourcePropertiesEditor.getGWTJahiaItemDefinition(prop).isInternationalized()) {
final Field<?> f = fieldsMap.get(prop.getName()).getField();
FormFieldCreator.copyValue(prop, f);
}
}
}
});
panel.add(sourceLangPropertiesEditor, new BorderLayoutData(Style.LayoutRegion.WEST, windowWidth / 2));
panel.add(targetLangPropertiesEditor, new BorderLayoutData(Style.LayoutRegion.EAST, windowWidth / 2));
add(panel);
LayoutContainer buttonsPanel = new LayoutContainer();
buttonsPanel.setBorders(false);
buttonBar = new ButtonBar();
buttonBar.setAlignment(Style.HorizontalAlignment.CENTER);
initFooter();
buttonsPanel.add(buttonBar);
setBottomComponent(buttonsPanel);
setFooter(true);
layout();
}
use of com.extjs.gxt.ui.client.widget.button.ButtonBar in project jahia by Jahia.
the class VersioningTabItem method init.
/**
* Create the tab item
*/
@Override
public void init(final NodeHolder engine, final AsyncTabItem tab, String locale) {
if (!tab.isProcessed()) {
this.locale = locale;
JahiaContentManagementService.App.getInstance().getVersions(engine.getNode().getPath(), new BaseAsyncCallback<List<GWTJahiaNodeVersion>>() {
public void onSuccess(List<GWTJahiaNodeVersion> result) {
final ListStore<GWTJahiaNodeVersion> all = new ListStore<GWTJahiaNodeVersion>();
all.add(result);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("label");
column.setSortable(false);
column.setHeaderHtml("Name");
column.setWidth(100);
column.setRenderer(new GridCellRenderer() {
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore listStore, Grid grid) {
GWTJahiaNodeVersion version = (GWTJahiaNodeVersion) model;
String value = Messages.get("label.version", "Version") + " ";
if (version.getLabel() != null && !"".equals(version.getLabel())) {
String[] strings = version.getLabel().split("_at_");
if (strings.length == 2) {
String date = DateTimeFormat.getMediumDateTimeFormat().format(DateTimeFormat.getFormat("yyyy_MM_dd_HH_mm_ss").parse(strings[1]));
for (String versionKey : new String[] { "published", "uploaded" }) {
if (strings[0].contains(versionKey)) {
value = Messages.getWithArgs("label.version." + versionKey, "Compare staging version with the version " + versionKey + " at {0}", new Object[] { date });
break;
}
}
} else {
value = version.getLabel();
}
}
return value;
}
});
configs.add(column);
if (PermissionsUtils.isPermitted("jcr:write", engine.getNode()) && !engine.getNode().isLocked()) {
column = new ColumnConfig();
column.setSortable(false);
column.setHeaderHtml("Action");
column.setWidth(200);
column.setRenderer(new GridCellRenderer() {
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore listStore, Grid grid) {
ButtonBar buttonBar = new ButtonBar();
Button button = new Button(Messages.get("label.compare.with.staging.engine", "Compare With Staging"));
button.addStyleName("button-compare-staging");
button.setToolTip(Messages.get("label.compare.with.staging.engine", "Compare With Staging"));
final GWTJahiaNodeVersion version = (GWTJahiaNodeVersion) model;
button.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// add 30s to the date to be sure to display the right version
new CompareEngine(version.getNode().getUUID(), VersioningTabItem.this.locale, false, version.getNode().getPath(), new Date(version.getDate().getTime() + (30l * 1000l)), engine, version.getWorkspace(), version.getLabel()).show();
}
});
buttonBar.add(button);
return buttonBar;
}
});
configs.add(column);
}
Grid<GWTJahiaNodeVersion> grid = new Grid<GWTJahiaNodeVersion>(all, new ColumnModel(configs));
grid.setAutoExpandColumn("label");
tab.add(grid);
tab.layout();
tab.show();
}
});
tab.setProcessed(true);
}
}
Aggregations