use of com.haulmont.cuba.client.ClientConfig in project cuba by cuba-platform.
the class EditAction method setConfiguration.
@Inject
protected void setConfiguration(Configuration configuration) {
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
setShortcut(clientConfig.getTableEditShortcut());
}
use of com.haulmont.cuba.client.ClientConfig in project cuba by cuba-platform.
the class SystemInfoWindow method init.
@Override
public void init(Map<String, Object> params) {
super.init(params);
paramsDs.setInstance(item);
paramsDs.setInstanceMetaClass((MetaClass) params.get("metaClass"));
String cubaLogContentClass = "c-system-info-log-content";
String cubaCopyLogContentClass = cubaLogContentClass + "-" + UUID.randomUUID();
scriptArea.setStyleName(cubaLogContentClass);
scriptArea.addStyleName(cubaCopyLogContentClass);
paramsDs.refresh();
Companion companion = getCompanion();
if (companion != null) {
companion.initInfoTable(infoTable);
companion.addCopyButton(buttonsPanel, messages.getMainMessage("systemInfoWindow.copy"), messages.getMainMessage("systemInfoWindow.copingSuccessful"), messages.getMainMessage("systemInfoWindow.copingFailed"), cubaCopyLogContentClass, uiComponents);
}
infoTable.removeAllActions();
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
if (!clientConfig.getSystemInfoScriptsEnabled() || item == null || !metadata.getTools().isPersistent(item.getMetaClass())) {
buttonsPanel.setVisible(false);
}
}
use of com.haulmont.cuba.client.ClientConfig in project cuba by cuba-platform.
the class CreateAction method setConfiguration.
@Inject
protected void setConfiguration(Configuration configuration) {
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
setShortcut(clientConfig.getTableInsertShortcut());
}
use of com.haulmont.cuba.client.ClientConfig in project cuba by cuba-platform.
the class AbstractWindow method beforeClose.
@Order(Events.HIGHEST_PLATFORM_PRECEDENCE + 10)
@Subscribe
protected void beforeClose(Screen.BeforeCloseEvent event) {
CloseAction closeAction = event.getCloseAction();
boolean checkSavedChanges = !(closeAction instanceof ChangeTrackerCloseAction) || ((ChangeTrackerCloseAction) closeAction).isCheckForUnsavedChanges();
if (checkSavedChanges) {
String actionId = closeAction instanceof StandardCloseAction ? ((StandardCloseAction) closeAction).getActionId() : UNKNOWN_CLOSE_ACTION_ID;
boolean close = preClose(actionId);
if (!close) {
event.preventWindowClose();
}
}
if (!event.isClosePrevented()) {
if (closeAction instanceof ChangeTrackerCloseAction && ((ChangeTrackerCloseAction) closeAction).isCheckForUnsavedChanges() && hasUnsavedChanges()) {
Configuration configuration = getBeanLocator().get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.NAME);
UnknownOperationResult result = new UnknownOperationResult();
if (this instanceof Committable && clientConfig.getUseSaveConfirmation()) {
Committable committable = (Committable) this;
screenValidation.showSaveConfirmationDialog(this, closeAction).onCommit(committable::commitAndClose).onDiscard(() -> result.resolveWith(closeWithDiscard())).onCancel(result::fail);
} else {
screenValidation.showUnsavedChangesDialog(this, closeAction).onDiscard(() -> result.resolveWith(closeWithDiscard())).onCancel(result::fail);
}
event.preventWindowClose(result);
}
}
}
use of com.haulmont.cuba.client.ClientConfig in project cuba by cuba-platform.
the class AbstractFrame method showValidationErrors.
/**
* Show validation errors alert. Can be overridden in subclasses.
*
* @param errors the list of validation errors. Caller fills it by errors found during the default validation.
*/
public void showValidationErrors(ValidationErrors errors) {
StringBuilder buffer = new StringBuilder();
for (ValidationErrors.Item error : errors.getAll()) {
buffer.append(error.description).append("\n");
}
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
NotificationType notificationType = NotificationType.valueOf(clientConfig.getValidationNotificationType());
showNotification(messages.getMainMessage("validationFail.caption"), buffer.toString(), notificationType);
}
Aggregations