Get rid of AppBeans get(Class<T> beanType) in Platform code #PL-4342

This commit is contained in:
Yuriy Artamonov 2014-09-23 13:06:28 +00:00
parent 6b31839e96
commit 7ed9f545ac
257 changed files with 807 additions and 583 deletions

View File

@ -63,7 +63,8 @@ public class MetaClassRepresentation {
}
public String getDescription() {
String result = AppBeans.get(MessageTools.class).getEntityCaption(meta);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
String result = messageTools.getEntityCaption(meta);
return result == null ? "" : result;
}
@ -110,7 +111,8 @@ public class MetaClassRepresentation {
}
public String getDescription() {
String result = AppBeans.get(MessageTools.class).getPropertyCaption(property);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
String result = messageTools.getPropertyCaption(property);
return result == null ? "" : result;
}
@ -133,7 +135,8 @@ public class MetaClassRepresentation {
SimpleHash wrappedEnumElement = new SimpleHash();
try {
wrappedEnumElement.put("idObj", ObjectWrapper.BEANS_WRAPPER.wrap(enumItem)); //Some enums don't implement EnumClass interface so we'll get id field here via reflection.
wrappedEnumElement.put("name", AppBeans.get(Messages.class).getMessage(enumItem));
Messages messages = AppBeans.get(Messages.NAME);
wrappedEnumElement.put("name", messages.getMessage(enumItem));
values.add(wrappedEnumElement);
} catch (TemplateModelException e) {
throw new RuntimeException(e);
@ -187,7 +190,8 @@ public class MetaClassRepresentation {
}
public boolean isPersistent() {
return AppBeans.get(MetadataTools.class).isPersistent(property);
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
return metadataTools.isPersistent(property);
}
}
@ -211,7 +215,7 @@ public class MetaClassRepresentation {
}
private static MetaClass getMetaClass(Class clazz) {
Metadata metadata = AppBeans.get(Metadata.class);
Metadata metadata = AppBeans.get(Metadata.NAME);
return metadata.getExtendedEntities().getEffectiveMetaClass(metadata.getClassNN(clazz));
}

View File

@ -86,7 +86,8 @@ public class EntityManagerImpl implements EntityManager {
entity = delegate.merge(entity);
}
if (entity instanceof SoftDelete && softDeletion) {
((SoftDelete) entity).setDeleteTs(AppBeans.get(TimeSource.class).currentTimestamp());
TimeSource timeSource = AppBeans.get(TimeSource.NAME);
((SoftDelete) entity).setDeleteTs(timeSource.currentTimestamp());
((SoftDelete) entity).setDeletedBy(userSession != null ? userSession.getUser().getLogin() : "<unknown>");
} else {
delegate.remove(entity);

View File

@ -94,7 +94,8 @@ public class RemotingServlet extends DispatcherServlet {
protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
if (!checkCompleted) {
// Check correctness of some configuration parameters and log the warning if necesary
GlobalConfig config = AppBeans.get(Configuration.class).getConfig(GlobalConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
GlobalConfig config = configuration.getConfig(GlobalConfig.class);
StringBuilder sb = new StringBuilder();
if (!request.getServerName().equals(config.getWebHostName())) {
sb.append("***** cuba.webHostName=").append(config.getWebHostName())

View File

@ -121,8 +121,8 @@ public class EntityLog implements EntityLogAPI {
private void loadEntities() {
log.debug("Loading entities");
entitiesManual = new HashMap<String, Set<String>>();
entitiesAuto = new HashMap<String, Set<String>>();
entitiesManual = new HashMap<>();
entitiesAuto = new HashMap<>();
Transaction tx = persistence.createTransaction();
try {
EntityManager em = persistence.getEntityManager();
@ -266,7 +266,8 @@ public class EntityLog implements EntityLogAPI {
if (valueId != null)
properties.setProperty(attr + EntityLogAttr.VALUE_ID_SUFFIX, valueId.toString());
String mp = AppBeans.get(MessageTools.class).inferMessagePack(attr, entity);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
String mp = messageTools.inferMessagePack(attr, entity);
if (mp != null)
properties.setProperty(attr + EntityLogAttr.MP_SUFFIX, mp);
}

View File

@ -124,8 +124,8 @@ public class App implements ConnectionListener {
DesktopAppContextLoader contextLoader = new DesktopAppContextLoader(getDefaultAppPropertiesConfig(), args);
contextLoader.load();
messages = AppBeans.get(Messages.class);
configuration = AppBeans.get(Configuration.class);
messages = AppBeans.get(Messages.NAME);
configuration = AppBeans.get(Configuration.NAME);
initTheme();
initLookAndFeelDefaults();
@ -229,7 +229,8 @@ public class App implements ConnectionListener {
protected void initTheme() throws Exception {
DesktopConfig config = configuration.getConfig(DesktopConfig.class);
String themeName = config.getTheme();
theme = AppBeans.get(DesktopThemeLoader.class).loadTheme(themeName);
DesktopThemeLoader desktopThemeLoader = AppBeans.get(DesktopThemeLoader.NAME);
theme = desktopThemeLoader.loadTheme(themeName);
theme.init();
ThemeConstantsRepository themeRepository = AppBeans.get(ThemeConstantsRepository.NAME);
@ -609,7 +610,8 @@ public class App implements ConnectionListener {
}
private void checkSessions() {
Map<String, Object> info = AppBeans.get(UserSessionService.class).getLicenseInfo();
UserSessionService userSessionService = AppBeans.get(UserSessionService.NAME);
Map<String, Object> info = userSessionService.getLicenseInfo();
Integer licensed = (Integer) info.get("licensedSessions");
if (licensed < 0) {
mainFrame.showNotification("Invalid CUBA platform license", IFrame.NotificationType.WARNING);
@ -635,7 +637,8 @@ public class App implements ConnectionListener {
for (Window window : wm.getOpenWindows())
window.setEnabled(false);
WindowInfo changePasswordDialog = AppBeans.get(WindowConfig.class).getWindowInfo("sec$User.changePassw");
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
WindowInfo changePasswordDialog = windowConfig.getWindowInfo("sec$User.changePassw");
wm.getDialogParams().setCloseable(false);
Map<String, Object> params = Collections.singletonMap("cancelEnabled", (Object) Boolean.FALSE);
Window changePasswordWindow = wm.openEditor(changePasswordDialog, user, WindowManager.OpenType.DIALOG, params);

View File

@ -35,8 +35,8 @@ public class LoginDialog extends JDialog {
protected Connection connection;
protected Map<String,Locale> locales;
protected Messages messages = AppBeans.get(Messages.class);
protected PasswordEncryption passwordEncryption = AppBeans.get(PasswordEncryption.class);
protected Messages messages = AppBeans.get(Messages.NAME);
protected PasswordEncryption passwordEncryption = AppBeans.get(PasswordEncryption.NAME);
protected JTextField nameField;
protected JTextField passwordField;
@ -48,7 +48,7 @@ public class LoginDialog extends JDialog {
super(owner);
this.connection = connection;
this.loginProperties = new LoginProperties();
Configuration configuration = AppBeans.get(Configuration.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
this.locales = configuration.getConfig(GlobalConfig.class).getAvailableLocales();
addWindowListener(
@ -95,7 +95,7 @@ public class LoginDialog extends JDialog {
passwordField.setText(defaultPassword);
panel.add(passwordField, "width 150!, wrap");
Configuration configuration = AppBeans.get(Configuration.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
localeCombo = new JComboBox<>();
initLocales(localeCombo);

View File

@ -145,7 +145,8 @@ public class TopLevelFrame extends JFrame {
}
public void showNotification(String caption, String description, IFrame.NotificationType type) {
DesktopConfig config = AppBeans.get(Configuration.class).getConfig(DesktopConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
DesktopConfig config = configuration.getConfig(DesktopConfig.class);
caption = Strings.nullToEmpty(ComponentsHelper.preprocessHtmlMessage(
IFrame.NotificationType.isHTML(type) ? caption : StringEscapeUtils.escapeHtml(caption)));
@ -165,12 +166,13 @@ public class TopLevelFrame extends JFrame {
}
protected void showNotificationDialog(String caption, String description, IFrame.NotificationType type) {
String title = AppBeans.get(Messages.class).getMessage(AppConfig.getMessagesPack(), "notification.title." + type);
Messages messages = AppBeans.get(Messages.NAME);
String title = messages.getMessage(AppConfig.getMessagesPack(), "notification.title." + type);
String text = preparePopupText(caption, description);
int messageType = DesktopComponentsHelper.convertNotificationType(type);
String closeText = AppBeans.get(Messages.class).getMainMessage("actions.Close");
String closeText = messages.getMainMessage("actions.Close");
JButton option = new JButton(closeText);
option.setPreferredSize(new Dimension(80, DesktopComponentsHelper.BUTTON_HEIGHT));

View File

@ -28,7 +28,7 @@ public class ChangePasswordLauncher implements Runnable {
WindowManager windowManager = App.getInstance().getMainFrame().getWindowManager();
WindowConfig windowConfig = AppBeans.get(WindowConfig.class);
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
WindowInfo windowInfo = windowConfig.getWindowInfo("sec$User.changePassw");
windowManager.openEditor(windowInfo, user, WindowManager.OpenType.DIALOG,

View File

@ -96,7 +96,7 @@ public class DefaultExceptionHandler implements ExceptionHandler {
if (guiDevException.getFrameId() != null) {
params.put("Frame ID", guiDevException.getFrameId());
try {
WindowConfig windowConfig = AppBeans.get(WindowConfig.class);
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
params.put("XML descriptor",
windowConfig.getWindowInfo(guiDevException.getFrameId()).getTemplate());
} catch (Exception e) {
@ -130,6 +130,7 @@ public class DefaultExceptionHandler implements ExceptionHandler {
}
protected String getMessage(String key) {
return AppBeans.get(Messages.class).getMainMessage(key, App.getInstance().getLocale());
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMainMessage(key, App.getInstance().getLocale());
}
}

View File

@ -16,9 +16,8 @@ import javax.annotation.Nullable;
/**
* Handles {@link NoSuchScreenException}.
*
* <p>$Id$</p>
*
* @author devyatkin
* @version $Id$
*/
public class NoSuchScreenHandler extends AbstractExceptionHandler {
@ -28,7 +27,8 @@ public class NoSuchScreenHandler extends AbstractExceptionHandler {
@Override
protected void doHandle(Thread thread, String className, String message, @Nullable Throwable throwable) {
String msg = AppBeans.get(Messages.class).getMessage(getClass(), "noSuchScreen.message");
Messages messages = AppBeans.get(Messages.NAME);
String msg = messages.getMessage(getClass(), "noSuchScreen.message");
App.getInstance().getMainFrame().showNotification(msg, throwable != null ? throwable.getMessage() : null,
IFrame.NotificationType.ERROR);
}

View File

@ -53,7 +53,8 @@ public class NoUserSessionHandler extends AbstractExceptionHandler {
}
protected String getMessage(String key) {
return AppBeans.get(Messages.class).getMainMessage(key, App.getInstance().getLocale());
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMainMessage(key, App.getInstance().getLocale());
}
private class LoginAction extends DialogAction {
@ -61,6 +62,7 @@ public class NoUserSessionHandler extends AbstractExceptionHandler {
super(DialogAction.Type.OK);
}
@Override
public void actionPerform(Component component) {
App app = App.getInstance();
app.getConnection().logout();

View File

@ -33,7 +33,8 @@ public class NumericOverflowExceptionHandler extends AbstractExceptionHandler {
@Override
protected void doHandle(Thread thread, String className, String message, @Nullable Throwable throwable) {
String msg = AppBeans.get(Messages.class).getMainMessage("numericFieldOverflow.message");
Messages messages = AppBeans.get(Messages.NAME);
String msg = messages.getMainMessage("numericFieldOverflow.message");
App.getInstance().getMainFrame().showNotification(msg, IFrame.NotificationType.ERROR);
}
}

View File

@ -135,7 +135,7 @@ public abstract class AbstractFieldFactory implements FieldFactory {
dateFormat = "msg://dateTimeFormat";
}
}
Messages messages = AppBeans.get(Messages.class);
Messages messages = AppBeans.get(Messages.NAME);
if (!StringUtils.isEmpty(dateFormat)) {
if (dateFormat.startsWith("msg://")) {

View File

@ -108,7 +108,7 @@ public abstract class DesktopAbstractTable<C extends JXTable>
protected Map<Table.Column, String> requiredColumns = new HashMap<>();
protected Security security = AppBeans.get(Security.class);
protected Security security = AppBeans.get(Security.NAME);
protected boolean columnAdjustRequired = false;
@ -197,7 +197,7 @@ public abstract class DesktopAbstractTable<C extends JXTable>
}
});
Messages messages = AppBeans.get(Messages.class);
Messages messages = AppBeans.get(Messages.NAME);
// localize default column control actions
for (Object actionKey : impl.getActionMap().allKeys()) {
if ("column.packAll".equals(actionKey)) {
@ -498,7 +498,7 @@ public abstract class DesktopAbstractTable<C extends JXTable>
@Override
public void setDatasource(final CollectionDatasource datasource) {
MetadataTools metadataTools = AppBeans.get(MetadataTools.class);
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
final Collection<Object> properties;
if (this.columns.isEmpty()) {
@ -508,7 +508,8 @@ public abstract class DesktopAbstractTable<C extends JXTable>
if (!property.getRange().getCardinality().isMany() && !metadataTools.isSystem(property)) {
Table.Column column = new Table.Column(metaPropertyPath);
column.setCaption(AppBeans.get(MessageTools.class).getPropertyCaption(property));
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
column.setCaption(messageTools.getPropertyCaption(property));
column.setType(metaPropertyPath.getRangeJavaClass());
Element element = DocumentHelper.createElement("column");
@ -609,7 +610,7 @@ public abstract class DesktopAbstractTable<C extends JXTable>
setVisibleColumns(columnsOrder);
if (AppBeans.get(UserSessionSource.class).getUserSession().isSpecificPermitted(ShowInfoAction.ACTION_PERMISSION)) {
if (security.isSpecificPermitted(ShowInfoAction.ACTION_PERMISSION)) {
ShowInfoAction action = (ShowInfoAction) getAction(ShowInfoAction.ACTION_ID);
if (action == null) {
action = new ShowInfoAction();

View File

@ -58,7 +58,7 @@ public abstract class DesktopAbstractTextField<T extends JTextComponent> extends
protected String caption;
protected Locale locale = AppBeans.get(UserSessionSource.class).getLocale();
protected Locale locale = AppBeans.<UserSessionSource>get(UserSessionSource.NAME).getLocale();
protected DefaultValueFormatter valueFormatter;
protected DesktopAbstractTextField() {
@ -266,8 +266,9 @@ public abstract class DesktopAbstractTextField<T extends JTextComponent> extends
}
protected void showValidationMessage() {
Messages messages = AppBeans.get(Messages.NAME);
DesktopComponentsHelper.getTopLevelFrame(this).showNotification(
AppBeans.get(Messages.class).getMessage(AppConfig.getMessagesPack(), "validationFail"),
messages.getMessage(AppConfig.getMessagesPack(), "validationFail"),
IFrame.NotificationType.TRAY
);
}

View File

@ -73,7 +73,8 @@ public class DesktopDateField extends DesktopAbstractField<JPanel> implements Da
initComponentParts();
setResolution(Resolution.MIN);
Locale locale = AppBeans.get(UserSessionSource.class).getLocale();
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
Locale locale = sessionSource.getLocale();
setDateFormat(Datatypes.getFormatStringsNN(locale).getDateTimeFormat());
DesktopComponentsHelper.adjustDateFieldSize(impl);
}
@ -415,7 +416,8 @@ public class DesktopDateField extends DesktopAbstractField<JPanel> implements Da
if (datePickerDate == null) {
return null;
}
Locale locale = AppBeans.get(UserSessionSource.class).getLocale();
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
Locale locale = sessionSource.getLocale();
Calendar c = Calendar.getInstance(locale);
c.setTime(datePickerDate);

View File

@ -611,7 +611,8 @@ public class DesktopFieldGroup extends DesktopAbstractComponent<JPanel> implemen
if (caption == null) {
MetaPropertyPath propertyPath = ds != null ? ds.getMetaClass().getPropertyPath(fieldConf.getId()) : null;
if (propertyPath != null) {
caption = AppBeans.get(MessageTools.class).getPropertyCaption(propertyPath.getMetaClass(), fieldConf.getId());
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
caption = messageTools.getPropertyCaption(propertyPath.getMetaClass(), fieldConf.getId());
}
}

View File

@ -45,7 +45,8 @@ public class DesktopFileMultiUploadField extends DesktopAbstractComponent<JButto
fileChooser.setMultiSelectionEnabled(true);
DesktopResources resources = App.getInstance().getResources();
String caption = AppBeans.get(Messages.class).getMessage(getClass(), "upload.selectFiles");
Messages messages = AppBeans.get(Messages.NAME);
String caption = messages.getMessage(getClass(), "upload.selectFiles");
impl = new JButton();
impl.setAction(new AbstractAction(caption, resources.getIcon(DEFAULT_ICON)) {
@Override
@ -86,7 +87,8 @@ public class DesktopFileMultiUploadField extends DesktopAbstractComponent<JButto
}
protected boolean checkFiles(File[] files) {
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
final long maxUploadSizeMb = clientConfig.getMaxUploadSizeMb();
final long maxSize = maxUploadSizeMb * BYTES_IN_MEGABYTE;
@ -120,7 +122,7 @@ public class DesktopFileMultiUploadField extends DesktopAbstractComponent<JButto
}
protected void notifyFileSizeExceedLimit(File file) {
Messages messages = AppBeans.get(Messages.class);
Messages messages = AppBeans.get(Messages.NAME);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);

View File

@ -52,7 +52,7 @@ public class DesktopFileUploadField extends DesktopAbstractComponent<JButton> im
public DesktopFileUploadField() {
fileUploading = AppBeans.get(FileUploadingAPI.NAME);
messages = AppBeans.get(Messages.class);
messages = AppBeans.get(Messages.NAME);
final JFileChooser fileChooser = new JFileChooser();
String caption = messages.getMessage(getClass(), "export.selectFile");
@ -68,7 +68,8 @@ public class DesktopFileUploadField extends DesktopAbstractComponent<JButton> im
}
protected void uploadFile(File file) {
final long maxUploadSizeMb = AppBeans.get(Configuration.class).getConfig(ClientConfig.class).getMaxUploadSizeMb();
Configuration configuration = AppBeans.get(Configuration.NAME);
final long maxUploadSizeMb = configuration.getConfig(ClientConfig.class).getMaxUploadSizeMb();
final long maxSize = maxUploadSizeMb * BYTES_IN_MEGABYTE;
if (file.length() > maxSize) {

View File

@ -48,7 +48,7 @@ public class DesktopFrame
private List<DetachListener> detachListeners = new ArrayList<>();
private WindowConfig windowConfig = AppBeans.get(WindowConfig.class);
private WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
private DesktopFrameActionsHolder actionsHolder;

View File

@ -57,7 +57,8 @@ public class DesktopLabel extends DesktopAbstractComponent<JLabel> implements La
impl.setFocusable(false);
setAlignment(Alignment.MIDDLE_LEFT);
Locale locale = AppBeans.get(UserSessionSource.class).getLocale();
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
Locale locale = sessionSource.getLocale();
valueFormatter = new DefaultValueFormatter(locale);
}

View File

@ -152,7 +152,8 @@ public class DesktopLookupField
textField = new JTextField();
textField.setEditable(false);
valueFormatter = new DefaultValueFormatter(AppBeans.get(UserSessionSource.class).getLocale());
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
valueFormatter = new DefaultValueFormatter(sessionSource.getLocale());
composition.add(comboBox, BorderLayout.CENTER);
impl = comboBox;

View File

@ -166,7 +166,8 @@ public class DesktopPickerField extends DesktopAbstractField<Picker> implements
}
protected void initModifiersMask() {
ClientConfig config = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig config = configuration.getConfig(ClientConfig.class);
String[] strModifiers = StringUtils.split(config.getPickerShortcutModifiers().toUpperCase(), "-");
for (String strModifier : strModifiers) {

View File

@ -174,10 +174,11 @@ public class DesktopRowsCount extends DesktopAbstractComponent<DesktopRowsCount.
}
String messagesPack = AppConfig.getMessagesPack();
impl.getLabel().setText(AppBeans.get(Messages.class).formatMessage(messagesPack, msgKey, countValue));
Messages messages = AppBeans.get(Messages.NAME);
impl.getLabel().setText(messages.formatMessage(messagesPack, msgKey, countValue));
if (impl.getCountButton().isVisible() && !refreshing) {
impl.getCountButton().setText(AppBeans.get(Messages.class).getMessage(messagesPack, "table.rowsCount.msg3"));
impl.getCountButton().setText(messages.getMessage(messagesPack, "table.rowsCount.msg3"));
}
impl.repaint();
impl.revalidate();

View File

@ -223,7 +223,8 @@ public class DesktopSearchField extends DesktopAbstractOptionsField<JComponent>
textField = new JTextField();
textField.setEditable(false);
valueFormatter = new DefaultValueFormatter(AppBeans.get(UserSessionSource.class).getLocale());
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
valueFormatter = new DefaultValueFormatter(sessionSource.getLocale());
composition.add(comboBox, BorderLayout.CENTER);
impl = comboBox;

View File

@ -92,8 +92,9 @@ public class DesktopTimeField extends DesktopAbstractField<JFormattedTextField>
}
private void showValidationMessage() {
Messages messages = AppBeans.get(Messages.NAME);
DesktopComponentsHelper.getTopLevelFrame(this).showNotification(
AppBeans.get(Messages.class).getMessage(AppConfig.getMessagesPack(), "validationFail"),
messages.getMessage(AppConfig.getMessagesPack(), "validationFail"),
IFrame.NotificationType.TRAY
);
}

View File

@ -74,7 +74,8 @@ public class DesktopTokenList extends DesktopAbstractField<DesktopTokenList.Toke
public DesktopTokenList() {
impl = new TokenListImpl();
addButton = new DesktopButton();
addButton.setCaption(AppBeans.get(Messages.class).getMessage(TokenList.class, "actions.Add"));
Messages messages = AppBeans.get(Messages.NAME);
addButton.setCaption(messages.getMessage(TokenList.class, "actions.Add"));
lookupPickerField = new DesktopLookupPickerField();

View File

@ -202,7 +202,7 @@ public class DesktopTree extends DesktopAbstractActionsHolderComponent<JTree> im
impl.addTreeSelectionListener(new SelectionListener());
UserSessionSource uss = AppBeans.get(UserSessionSource.class);
UserSessionSource uss = AppBeans.get(UserSessionSource.NAME);
if (uss.getUserSession().isSpecificPermitted(ShowInfoAction.ACTION_PERMISSION)) {
ShowInfoAction action = (ShowInfoAction) getAction(ShowInfoAction.ACTION_ID);
if (action == null) {

View File

@ -97,8 +97,8 @@ public class DesktopWindow implements Window, Component.Disposable,
protected DesktopWindowManager windowManager;
protected Configuration configuration = AppBeans.get(Configuration.class);
protected Messages messages = AppBeans.get(Messages.class);
protected Configuration configuration = AppBeans.get(Configuration.NAME);
protected Messages messages = AppBeans.get(Messages.NAME);
protected ComponentSize widthSize;
protected ComponentSize heightSize;

View File

@ -227,7 +227,8 @@ public class SwingXTableSettings implements TableSettings {
return;
}
DesktopConfig desktopConfig = AppBeans.get(Configuration.class).getConfig(DesktopConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
DesktopConfig desktopConfig = configuration.getConfig(DesktopConfig.class);
int sizeIndex = desktopConfig.getAvailableFontSizes().indexOf(size);
if (sizeIndex < 0) {

View File

@ -6,13 +6,9 @@
package com.haulmont.cuba.desktop.gui.components.filter;
import com.haulmont.chile.core.model.MetaClass;
import com.haulmont.chile.core.model.MetaProperty;
import com.haulmont.cuba.client.ClientConfig;
import com.haulmont.cuba.core.entity.CategorizedEntity;
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.core.global.Configuration;
import com.haulmont.cuba.core.global.Messages;
import com.haulmont.cuba.core.global.UserSessionSource;
import com.haulmont.cuba.core.global.*;
import com.haulmont.cuba.desktop.TopLevelFrame;
import com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper;
import com.haulmont.cuba.desktop.sys.DesktopWindowManager;
@ -106,7 +102,8 @@ public class AddConditionDlg extends JDialog {
add(cancelBtn);
cancelBtn.addActionListener(cancelAction);
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
KeyCombination close = KeyCombination.create(clientConfig.getCloseShortcut());
KeyCombination commit = KeyCombination.create(clientConfig.getCommitShortcut());
@ -204,7 +201,8 @@ public class AddConditionDlg extends JDialog {
rootModelItems.add(new RootRuntimePropertiesModelItem(descriptorBuilder));
}
if (AppBeans.get(UserSessionSource.class).getUserSession().isSpecificPermitted("cuba.gui.filter.customConditions")) {
Security security = AppBeans.get(Security.NAME);
if (security.isSpecificPermitted("cuba.gui.filter.customConditions")) {
rootModelItems.add(new NewCustomConditionModelItem(descriptorBuilder));
}

View File

@ -21,7 +21,8 @@ public class ConditionCreator extends AbstractConditionDescriptor {
public ConditionCreator(String filterComponentName, CollectionDatasource datasource) {
super("creator", filterComponentName, datasource);
locCaption = AppBeans.get(Messages.class).getMessage(MESSAGES_PACK, "conditionCreator");
Messages messages = AppBeans.get(Messages.NAME);
locCaption = messages.getMessage(MESSAGES_PACK, "conditionCreator");
showImmediately = true;
}

View File

@ -62,7 +62,8 @@ public class CustomConditionEditDlg extends AbstractCustomConditionEditDlg<JDial
}
protected void initShortcuts() {
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
KeyCombination close = KeyCombination.create(clientConfig.getCloseShortcut());
KeyCombination commit = KeyCombination.create(clientConfig.getCommitShortcut());
@ -119,7 +120,7 @@ public class CustomConditionEditDlg extends AbstractCustomConditionEditDlg<JDial
setResizable(false);
setTitle(condition.getLocCaption());
Messages messages = AppBeans.get(Messages.class);
Messages messages = AppBeans.get(Messages.NAME);
MigLayout layout = new MigLayout("wrap 1");
setLayout(layout);

View File

@ -8,7 +8,9 @@ package com.haulmont.cuba.desktop.gui.components.filter;
import com.haulmont.bali.datastruct.Node;
import com.haulmont.cuba.client.ClientConfig;
import com.haulmont.cuba.core.entity.CategorizedEntity;
import com.haulmont.cuba.core.global.*;
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.core.global.Configuration;
import com.haulmont.cuba.core.global.Security;
import com.haulmont.cuba.desktop.App;
import com.haulmont.cuba.desktop.TopLevelFrame;
import com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper;
@ -23,7 +25,6 @@ import com.haulmont.cuba.gui.data.CollectionDatasource;
import com.haulmont.cuba.gui.data.Datasource;
import com.haulmont.cuba.security.entity.EntityOp;
import com.haulmont.cuba.security.entity.FilterEntity;
import com.haulmont.cuba.security.global.UserSession;
import net.miginfocom.layout.CC;
import net.miginfocom.layout.LC;
import net.miginfocom.swing.MigLayout;
@ -74,9 +75,7 @@ public class FilterEditor extends AbstractFilterEditor {
protected JCheckBox defaultCb;
protected JCheckBox applyDefaultCb;
protected UserSession userSession = AppBeans.get(UserSessionSource.class).getUserSession();
protected Security security = AppBeans.get(Security.class);
protected Security security = AppBeans.get(Security.NAME);
public FilterEditor(final DesktopFilter desktopFilter, FilterEntity filterEntity,
Element filterDescriptor, List<String> existingNames) {
@ -175,7 +174,7 @@ public class FilterEditor extends AbstractFilterEditor {
globalCb = new JCheckBox(getMessage("FilterEditor.global"));
globalCb.setSelected(filterEntity.getUser() == null);
globalCb.setEnabled(userSession.isSpecificPermitted("cuba.gui.filter.global"));
globalCb.setEnabled(security.isSpecificPermitted("cuba.gui.filter.global"));
checkBoxes.add(globalCb, new CC().hideMode(3));
@ -288,7 +287,7 @@ public class FilterEditor extends AbstractFilterEditor {
GroupCreator orGroupCreator = new GroupCreator(GroupType.OR, filterComponentName, datasource);
addSelect.addItem(new ItemWrapper<AbstractConditionDescriptor>(orGroupCreator, orGroupCreator.getLocCaption()));
if (userSession.isSpecificPermitted("cuba.gui.filter.customConditions")) {
if (security.isSpecificPermitted("cuba.gui.filter.customConditions")) {
ConditionCreator conditionCreator = new ConditionCreator(filterComponentName, datasource);
addSelect.addItem(new ItemWrapper<AbstractConditionDescriptor>(conditionCreator, conditionCreator.getLocCaption()));
}

View File

@ -58,10 +58,10 @@ public class ListEditComponent extends Picker {
protected List<ValueListener> listeners = new ArrayList<>();
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
public ListEditComponent(Class itemClass) {
messages = AppBeans.get(Messages.class);
messages = AppBeans.get(Messages.NAME);
setOpaque(false);
contentPanel.setOpaque(false);
actionsPanel.setOpaque(false);

View File

@ -20,6 +20,7 @@ public class NewCustomCondition extends CustomCondition {
super(descriptor, where, join, entityAlias);
name = RandomStringUtils.randomAlphabetic(10);
locCaption = AppBeans.get(Messages.class).getMessage(MESSAGES_PACK, "newCustomCondition");
Messages messages = AppBeans.get(Messages.NAME);
locCaption = messages.getMessage(MESSAGES_PACK, "newCustomCondition");
}
}

View File

@ -342,7 +342,8 @@ public class Param extends AbstractParam<ParamEditorComponent> {
}
protected ParamEditorComponent createEntityLookup() {
MetaClass metaClass = AppBeans.get(Metadata.class).getSession().getClass(javaClass);
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass metaClass = metadata.getSession().getClass(javaClass);
PersistenceManagerService persistenceManager = AppBeans.get(PersistenceManagerService.NAME);
boolean useLookupScreen = persistenceManager.useLookupScreen(metaClass.getName());

View File

@ -67,7 +67,8 @@ public class RuntimePropConditionEditDlg extends AbstractRuntimePropConditionEdi
}
protected void initShortcuts() {
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
KeyCombination close = KeyCombination.create(clientConfig.getCloseShortcut());
KeyCombination commit = KeyCombination.create(clientConfig.getCommitShortcut());

View File

@ -37,7 +37,7 @@ public class TableModelAdapter extends AbstractTableModel implements AnyTableMod
protected boolean autoRefresh;
protected List<DataChangeListener> changeListeners = new ArrayList<>();
protected MetadataTools metadataTools = AppBeans.get(MetadataTools.class);
protected MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
public TableModelAdapter(CollectionDatasource datasource, List<Table.Column> columns, boolean autoRefresh) {

View File

@ -74,7 +74,8 @@ public class DesktopBackgroundWorker implements BackgroundWorker {
private DesktopTaskExecutor(BackgroundTask<T, V> runnableTask) {
this.runnableTask = runnableTask;
userId = AppBeans.get(UserSessionSource.class).getUserSession().getId();
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
userId = sessionSource.getUserSession().getId();
//noinspection unchecked
this.params = runnableTask.getParams();

View File

@ -64,7 +64,8 @@ public class DesktopAppContextLoader extends AbstractAppContextLoader {
}
protected void initEnvironment() {
String tempPath = AppBeans.get(Configuration.class).getConfig(GlobalConfig.class).getTempDir();
Configuration configuration = AppBeans.get(Configuration.NAME);
String tempPath = configuration.getConfig(GlobalConfig.class).getTempDir();
File tempDir = new File(tempPath);
if (!tempDir.exists()) {
try {

View File

@ -1238,7 +1238,8 @@ public class DesktopWindowManager extends WindowManager {
if (isMainWindowManager) {
// Stop background tasks
AppBeans.get(WatchDog.class).stopTasks();
WatchDog watchDog = AppBeans.get(WatchDog.NAME);
watchDog.stopTasks();
}
// Dispose windows

View File

@ -92,7 +92,8 @@ public class FontDialog extends JDialog {
}
private void initUI() {
DesktopConfig desktopConfig = AppBeans.get(Configuration.class).getConfig(DesktopConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
DesktopConfig desktopConfig = configuration.getConfig(DesktopConfig.class);
setIconImage(null);
setIconImages(null);

View File

@ -40,7 +40,7 @@ public class MenuBuilder {
public MenuBuilder(UserSession userSession, JMenuBar menuBar) {
this.userSession = userSession;
this.menuBar = menuBar;
menuConfig = AppBeans.get(MenuConfig.class);
menuConfig = AppBeans.get(MenuConfig.NAME);
}
public void build() {
@ -85,9 +85,10 @@ public class MenuBuilder {
}
private void assignCommand(final JMenuItem jMenuItem, MenuItem item) {
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
WindowInfo windowInfo;
try {
windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo(item.getId());
windowInfo = windowConfig.getWindowInfo(item.getId());
} catch (NoSuchScreenException e) {
return;
}

View File

@ -263,7 +263,7 @@ public final class InstanceUtils {
values[i] = getInstanceName((Instance) value);
} else if (value instanceof EnumClass) {
if (messages == null) {
messages = AppBeans.get(Messages.class);
messages = AppBeans.get(Messages.NAME);
}
values[i] = messages.getMessage((Enum)value);

View File

@ -13,7 +13,6 @@ import com.haulmont.cuba.core.global.UuidProvider;
import com.haulmont.cuba.core.sys.CubaEnhanced;
import org.apache.commons.lang.ObjectUtils;
import javax.persistence.MappedSuperclass;
import java.util.UUID;
/**
@ -40,7 +39,8 @@ public abstract class AbstractNotPersistentEntity extends AbstractInstance imple
@Override
public MetaClass getMetaClass() {
return AppBeans.get(Metadata.class).getSession().getClass(getClass());
Metadata metadata = AppBeans.get(Metadata.NAME);
return metadata.getSession().getClass(getClass());
}
@MetaProperty

View File

@ -11,6 +11,10 @@ import com.haulmont.cuba.core.global.Messages;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
/**
* @author krivopustov
* @version $Id$
*/
@MappedSuperclass
@SystemLevel
public abstract class AbstractSearchFolder extends Folder {
@ -65,7 +69,7 @@ public abstract class AbstractSearchFolder extends Folder {
}
public String getLocName() {
return AppBeans.get(Messages.class).getMainMessage(name);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMainMessage(name);
}
}
}

View File

@ -78,7 +78,8 @@ public abstract class BaseUuidEntity extends AbstractInstance implements BaseEnt
@Override
public MetaClass getMetaClass() {
return AppBeans.get(Metadata.class).getSession().getClassNN(getClass());
Metadata metadata = AppBeans.get(Metadata.NAME);
return metadata.getSession().getClassNN(getClass());
}
@Override

View File

@ -79,7 +79,8 @@ public class EntityBasicPropertyDiff extends EntityPropertyDiff {
private String getEnumItemName(Object enumItem) {
String nameKey = enumItem.getClass().getSimpleName() + "." + enumItem.toString();
return AppBeans.get(Messages.class).getMessage(enumItem.getClass(), nameKey);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(enumItem.getClass(), nameKey);
}
@Override

View File

@ -17,9 +17,9 @@ import java.io.Serializable;
/**
* Diff between properties in entity snapshots
* <p>$Id$</p>
*
* @author artamonov
* @version $Id$
*/
@MetaClass(name = "sys$EntityPropertyDiff")
@SystemLevel
@ -43,7 +43,8 @@ public abstract class EntityPropertyDiff extends AbstractNotPersistentEntity imp
protected EntityPropertyDiff(ViewProperty viewProperty, com.haulmont.chile.core.model.MetaProperty metaProperty) {
this.viewProperty = viewProperty;
this.propertyCaption = AppBeans.get(MessageTools.class).getPropertyCaption(metaProperty);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
this.propertyCaption = messageTools.getPropertyCaption(metaProperty);
this.metaClassName = metaProperty.getDomain().getFullName();
}

View File

@ -71,7 +71,8 @@ public class EntityLoadInfo {
public static EntityLoadInfo create(Entity entity, @Nullable String viewName) {
Objects.requireNonNull(entity, "entity is null");
MetaClass metaClass = AppBeans.get(Metadata.class).getSession().getClassNN(entity.getClass());
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass metaClass = metadata.getSession().getClassNN(entity.getClass());
return new EntityLoadInfo((UUID) entity.getId(), metaClass, viewName);
}
@ -100,7 +101,8 @@ public class EntityLoadInfo {
int idDashPos = str.indexOf('-');
String entityName = str.substring(0, idDashPos);
MetaClass metaClass = AppBeans.get(Metadata.class).getSession().getClass(entityName);
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass metaClass = metadata.getSession().getClass(entityName);
if (metaClass == null) {
return null;
}
@ -139,7 +141,8 @@ public class EntityLoadInfo {
int dashPos = str.indexOf('-');
String entityName = str.substring(dashPos + 1);
MetaClass metaClass = AppBeans.get(Metadata.class).getSession().getClass(entityName);
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass metaClass = metadata.getSession().getClass(entityName);
if (metaClass == null) {
return null;
}

View File

@ -41,7 +41,8 @@ public class LoadContext implements Serializable {
* @param javaClass class of the loaded entities
*/
public LoadContext(Class javaClass) {
this.metaClass = AppBeans.get(Metadata.class).getSession().getClassNN(javaClass).getName();
Metadata metadata = AppBeans.get(Metadata.NAME);
this.metaClass = metadata.getSession().getClassNN(javaClass).getName();
}
/**
@ -96,7 +97,7 @@ public class LoadContext implements Serializable {
* @return this instance for chaining
*/
public LoadContext setView(String viewName) {
Metadata metadata = AppBeans.get(Metadata.class);
Metadata metadata = AppBeans.get(Metadata.NAME);
this.view = metadata.getViewRepository().getView(metadata.getSession().getClass(metaClass), viewName);
return this;
}

View File

@ -32,7 +32,8 @@ public class LockInfo extends AbstractNotPersistentEntity {
public LockInfo(User user, String entityName, String entityId) {
this.entityName = entityName;
this.entityId = entityId;
this.since = AppBeans.get(TimeSource.class).currentTimestamp();
TimeSource timeSource = AppBeans.get(TimeSource.NAME);
this.since = timeSource.currentTimestamp();
this.user = user;
}

View File

@ -17,7 +17,7 @@ import org.antlr.runtime.RecognitionException;
*/
public class QueryTransformerFactory {
private static boolean useAst = AppBeans.get(Configuration.class)
private static boolean useAst = AppBeans.<Configuration>get(Configuration.NAME)
.getConfig(GlobalConfig.class).getUseAstBasedJpqlTransformer();
private static volatile DomainModel domainModel;
@ -26,8 +26,9 @@ public class QueryTransformerFactory {
if (useAst) {
try {
if (domainModel == null) {
DomainModelBuilder builder = new DomainModelBuilder(
AppBeans.get(MetadataTools.class), AppBeans.get(MessageTools.class));
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
DomainModelBuilder builder = new DomainModelBuilder(metadataTools, messageTools);
domainModel = builder.produce();
}
return new QueryTransformerAstBased(domainModel, query, targetEntity);

View File

@ -20,7 +20,8 @@ import javax.annotation.ManagedBean;
public class NodeIdentifierImpl implements NodeIdentifier {
@Override
public String getNodeName() {
GlobalConfig globalConfig = AppBeans.get(Configuration.class).getConfig(GlobalConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
return globalConfig.getWebHostName() + ":" + globalConfig.getWebPort();
}
}

View File

@ -54,7 +54,8 @@ public class JmxLogControl implements JmxLogControlMBean {
// check log file exists
logControl.getLogFile(fileName);
GlobalConfig globalConfig = AppBeans.get(Configuration.class).getConfig(GlobalConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
String encodedFileName;
try {

View File

@ -84,8 +84,8 @@ public class EntityLogAttr extends AbstractNotPersistentEntity {
return getValue();
} else if (property.getRange().isEnum()) {
String nameKey = property.getRange().asEnumeration().getJavaClass().getSimpleName() + "." + getValue();
return AppBeans.get(Messages.class).getMessage(
entityName.substring(0, entityName.lastIndexOf(".")), nameKey);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(entityName.substring(0, entityName.lastIndexOf(".")), nameKey);
} else {
return getValue();
}
@ -116,10 +116,11 @@ public class EntityLogAttr extends AbstractNotPersistentEntity {
@MetaProperty
public String getDisplayName() {
String entityName = getLogItem().getEntity();
String message = null;
String message;
com.haulmont.chile.core.model.MetaClass metaClass = getClassFromEntityName(entityName);
if (metaClass != null) {
message = AppBeans.get(Messages.class).getTools().getPropertyCaption(metaClass, getName());
Messages messages = AppBeans.get(Messages.NAME);
message = messages.getTools().getPropertyCaption(metaClass, getName());
} else {
return getName();
}
@ -127,7 +128,7 @@ public class EntityLogAttr extends AbstractNotPersistentEntity {
}
private com.haulmont.chile.core.model.MetaClass getClassFromEntityName(String entityName) {
Metadata metadata = AppBeans.get(Metadata.class);
Metadata metadata = AppBeans.get(Metadata.NAME);
com.haulmont.chile.core.model.MetaClass metaClass = metadata.getSession().getClass(entityName);
return metaClass == null ? null : metadata.getExtendedEntities().getEffectiveMetaClass(metaClass);
}
@ -135,7 +136,8 @@ public class EntityLogAttr extends AbstractNotPersistentEntity {
@MetaProperty
public String getLocValue() {
if (!StringUtils.isBlank(messagesPack)) {
return AppBeans.get(Messages.class).getMessage(messagesPack, value);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(messagesPack, value);
} else {
return value;
}

View File

@ -43,7 +43,8 @@ public class SearchFolder extends AbstractSearchFolder {
public void copyFrom(AbstractSearchFolder srcFolder) {
super.copyFrom(srcFolder);
setUser(AppBeans.get(UserSessionSource.class).getUserSession().getUser());
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
setUser(sessionSource.getUserSession().getUser());
}
public User getUser() {
@ -69,7 +70,8 @@ public class SearchFolder extends AbstractSearchFolder {
@Override
public String getCaption() {
return AppBeans.get(Messages.class).getMainMessage(name);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMainMessage(name);
}
public Boolean getIsSet(){

View File

@ -66,6 +66,7 @@ public class SessionAttribute extends StandardEntity {
@MetaProperty
public String getDatatypeCaption() {
return AppBeans.get(Messages.class).getMainMessage("Datatype." + datatype);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMainMessage("Datatype." + datatype);
}
}

View File

@ -52,7 +52,8 @@ public abstract class AppConfig {
* <p/> To obtain a message from the main message pack use {@link com.haulmont.cuba.core.global.Messages#getMainMessage(String)}.
*/
public static String getMessagesPack() {
return AppBeans.get(Messages.class).getMainMessagePack();
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMainMessagePack();
}
/**
@ -89,6 +90,6 @@ public abstract class AppConfig {
* @return ComponentsFactory instance
*/
public static ComponentsFactory getFactory() {
return AppBeans.get(ComponentsFactory.class);
return AppBeans.get(ComponentsFactory.NAME);
}
}
}

View File

@ -181,7 +181,8 @@ public class CompanionDependencyInjector {
} else if (Config.class.isAssignableFrom(type)) {
//noinspection unchecked
return AppBeans.get(Configuration.class).getConfig((Class<? extends Config>) type);
Configuration configuration = AppBeans.get(Configuration.NAME);
return configuration.getConfig((Class<? extends Config>) type);
} else {
Object instance;

View File

@ -191,7 +191,8 @@ public class ControllerDependencyInjector {
} else if (Config.class.isAssignableFrom(type)) {
//noinspection unchecked
return AppBeans.get(Configuration.class).getConfig((Class<? extends Config>) type);
Configuration configuration = AppBeans.get(Configuration.NAME);
return configuration.getConfig((Class<? extends Config>) type);
} else {
Object instance;

View File

@ -40,10 +40,10 @@ public class ScreenHistorySupport {
protected Configuration configuration;
public ScreenHistorySupport() {
metadata = AppBeans.get(Metadata.class);
messages = AppBeans.get(Messages.class);
uss = AppBeans.get(UserSessionSource.class);
configuration = AppBeans.get(Configuration.class);
metadata = AppBeans.get(Metadata.NAME);
messages = AppBeans.get(Messages.NAME);
uss = AppBeans.get(UserSessionSource.NAME);
configuration = AppBeans.get(Configuration.NAME);
String property = configuration.getConfig(ClientConfig.class).getScreenIdsToSaveHistory();
if (StringUtils.isNotBlank(property)) {
@ -60,7 +60,8 @@ public class ScreenHistorySupport {
}
public void saveScreenHistory(Window window, WindowManager.OpenType openType) {
if (AppBeans.get(Security.class).isEntityOpPermitted(ScreenHistoryEntity.class, EntityOp.CREATE)
Security security = AppBeans.get(Security.NAME);
if (security.isEntityOpPermitted(ScreenHistoryEntity.class, EntityOp.CREATE)
&& window.getFrame() != null
&& (window.getFrame() instanceof Window.Editor)
&& !openType.equals(WindowManager.OpenType.DIALOG)
@ -89,7 +90,8 @@ public class ScreenHistorySupport {
addAdditionalFields(screenHistoryEntity, entity);
CommitContext cc = new CommitContext(Collections.singleton(screenHistoryEntity));
AppBeans.get(DataService.class).commit(cc);
DataService dataService = AppBeans.get(DataService.NAME);
dataService.commit(cc);
}
}

View File

@ -53,7 +53,8 @@ public final class WindowCreationHelper {
return;
}
UserSession userSession = AppBeans.get(UserSessionSource.class).getUserSession();
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
UserSession userSession = sessionSource.getUserSession();
String screenId = window.getId();
Map<String, Integer> uiPermissions = userSession.getPermissionsByType(PermissionType.UI);
@ -150,7 +151,8 @@ public final class WindowCreationHelper {
AbstractViewRepository viewRepository = AppBeans.get(ViewRepository.NAME);
for (Element fileEl : Dom4j.elements(metadataContextEl, "deployViews")) {
String resource = fileEl.attributeValue("name");
InputStream resourceInputStream = AppBeans.get(Resources.class).getResourceAsStream(resource);
Resources resources = AppBeans.get(Resources.NAME);
InputStream resourceInputStream = resources.getResourceAsStream(resource);
if (resourceInputStream == null)
throw new RuntimeException("View resource not found: " + resource);

View File

@ -89,7 +89,7 @@ public abstract class WindowManager {
protected Resources resources = AppBeans.get(Resources.NAME);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
private DialogParams dialogParams;
@ -169,7 +169,8 @@ public abstract class WindowManager {
componentLoaderContext.setFrame(windowWrapper);
componentLoaderContext.executePostInitTasks();
if (AppBeans.get(Configuration.class).getConfig(GlobalConfig.class).getTestMode()) {
Configuration configuration = AppBeans.get(Configuration.NAME);
if (configuration.getConfig(GlobalConfig.class).getTestMode()) {
initDebugIds(window);
}

View File

@ -28,7 +28,7 @@ public class LinkColumnHelper {
public static void initColumn(Table table, final String propertyName, final Handler handler) {
final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.class);
final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);
table.addGeneratedColumn(propertyName, new Table.ColumnGenerator() {
@Override
@ -57,7 +57,8 @@ public class LinkColumnHelper {
String str;
Datatype datatype = Datatypes.get(value.getClass());
if (datatype != null) {
str = datatype.format(value, AppBeans.get(UserSessionSource.class).getLocale());
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
str = datatype.format(value, sessionSource.getLocale());
} else {
str = value.toString();
}

View File

@ -17,7 +17,6 @@ import com.haulmont.cuba.gui.data.Datasource;
import com.haulmont.cuba.gui.xml.layout.ComponentsFactory;
import javax.annotation.Nullable;
import javax.persistence.TemporalType;
import java.util.HashMap;
import java.util.Map;
@ -28,7 +27,7 @@ import java.util.Map;
public class BulkEditorFieldFactory {
protected ComponentsFactory componentsFactory = AppConfig.getFactory();
protected Messages messages = AppBeans.get(Messages.class);
protected Messages messages = AppBeans.get(Messages.NAME);
protected static final int MAX_TEXTFIELD_STRING_LENGTH = 255;

View File

@ -44,7 +44,8 @@ public class CreditsLoader {
String[] locations = tokenizer.getTokenArray();
for (String location : locations) {
String xml = AppBeans.get(Resources.class).getResourceAsString(location);
Resources resources = AppBeans.get(Resources.NAME);
String xml = resources.getResourceAsString(location);
if (xml == null) {
log.debug("Resource " + location + " not found, ignore it");
continue;

View File

@ -355,7 +355,8 @@ public class EntityLogBrowser extends AbstractWindow {
}
public void setDateFieldTime() {
Date date = AppBeans.get(TimeSource.class).currentTimestamp();
TimeSource timeSource = AppBeans.get(TimeSource.NAME);
Date date = timeSource.currentTimestamp();
fromDateField.setValue(DateUtils.addDays(date, -1));
tillDateField.setValue(DateUtils.addMinutes(date, 1));
}

View File

@ -37,8 +37,9 @@ public class FileDownloadHelper {
public static String makeUrl(FileDescriptor fd, boolean attachment) {
StringBuilder sb = new StringBuilder();
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
sb.append("dispatch/download?")
.append("s=").append(AppBeans.get(UserSessionSource.class).getUserSession().getId()).append("&")
.append("s=").append(sessionSource.getUserSession().getId()).append("&")
.append("f=").append(fd.getId());
if (attachment)
sb.append("&a=true");
@ -46,8 +47,8 @@ public class FileDownloadHelper {
}
public static void initGeneratedColumn(final Table table) {
final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.class);
final ExportDisplay exportDisplay = AppBeans.get(ExportDisplay.class);
final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);
final ExportDisplay exportDisplay = AppBeans.get(ExportDisplay.NAME);
table.addGeneratedColumn("name", new Table.ColumnGenerator<FileDescriptor>() {
@Override
@ -81,8 +82,8 @@ public class FileDownloadHelper {
}
public static void initGeneratedColumn(final Table table, final String fileProperty) {
final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.class);
final ExportDisplay exportDisplay = AppBeans.get(ExportDisplay.class);
final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);
final ExportDisplay exportDisplay = AppBeans.get(ExportDisplay.NAME);
table.addGeneratedColumn(fileProperty + ".name", new Table.ColumnGenerator() {
@Override

View File

@ -16,9 +16,10 @@ import com.haulmont.cuba.gui.components.Formatter;
*/
public class LockNameFormatter implements Formatter<String> {
protected Metadata metadata = AppBeans.get(Metadata.class);
protected MessageTools messageTools = AppBeans.get(MessageTools.class);
protected Metadata metadata = AppBeans.get(Metadata.NAME);
protected MessageTools messageTools = AppBeans.get(MessageTools.NAME);
@Override
public String format(String value) {
MetaClass mc = metadata.getSession().getClass(value);
if (mc != null) {
@ -26,4 +27,4 @@ public class LockNameFormatter implements Formatter<String> {
} else
return value;
}
}
}

View File

@ -30,7 +30,7 @@ public class EntityParamsDatasource extends CollectionDatasourceImpl<KeyValueEnt
protected Messages messages;
public EntityParamsDatasource() {
messages = AppBeans.get(Messages.class);
messages = AppBeans.get(Messages.NAME);
}
@Override

View File

@ -93,7 +93,7 @@ public class UiPermissionsFrame extends AbstractFrame {
public void init(Map<String, Object> params) {
super.init(params);
WindowConfig windowConfig = AppBeans.get(WindowConfig.class);
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
Collection<WindowInfo> windows = sortWindowInfos(windowConfig.getWindows());
Map<String, Object> screens = new LinkedHashMap<>();
for (WindowInfo windowInfo : windows) {

View File

@ -298,7 +298,7 @@ public class UserEditor extends AbstractEditor<User> {
super("add");
icon = "icons/add.png";
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
setShortcut(clientConfig.getTableAddShortcut());
}
@ -442,7 +442,7 @@ public class UserEditor extends AbstractEditor<User> {
super("add");
icon = "icons/add.png";
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
setShortcut(clientConfig.getTableAddShortcut());
}

View File

@ -46,8 +46,9 @@ public class JpqlSuggestionFactory {
public static List<Suggestion> requestHint(String query, int queryPosition, AutoCompleteSupport sender,
int senderCursorPosition) {
DomainModelBuilder builder = new DomainModelBuilder(
AppBeans.get(MetadataTools.class), AppBeans.get(MessageTools.class));
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
DomainModelBuilder builder = new DomainModelBuilder(metadataTools, messageTools);
DomainModel domainModel = builder.produce();
HintProvider provider = new HintProvider(domainModel);

View File

@ -23,7 +23,7 @@ public class LocalizedTaskWrapper<T, V> extends BackgroundTask<T, V> {
protected BackgroundTask<T, V> wrappedTask;
protected Window window;
protected Messages messages = AppBeans.get(Messages.class);
protected Messages messages = AppBeans.get(Messages.NAME);
protected LocalizedTaskWrapper(BackgroundTask<T, V> wrappedTask, Window window) {
super(wrappedTask.getTimeoutSeconds(), window);

View File

@ -48,8 +48,9 @@ public abstract class AbstractAction implements Action {
protected AbstractAction(String id) {
this.id = id;
messages = AppBeans.get(Messages.class);
userSession = AppBeans.get(UserSessionSource.class).getUserSession();
messages = AppBeans.get(Messages.NAME);
UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
userSession = sessionSource.getUserSession();
}
protected AbstractAction(String id, @Nullable String shortcut) {

View File

@ -4,9 +4,10 @@
*/
package com.haulmont.cuba.gui.components;
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.core.global.Messages;
/**
* @author krivopustov
* @version $Id$
*/
public class DialogAction extends AbstractAction {
public enum Type {
@ -36,7 +37,7 @@ public class DialogAction extends AbstractAction {
@Override
public String getCaption() {
return AppBeans.get(Messages.class).getMainMessage(type.msgKey);
return messages.getMainMessage(type.msgKey);
}
@Override
@ -48,6 +49,7 @@ public class DialogAction extends AbstractAction {
return type;
}
@Override
public void actionPerform(Component component) {
}
}
}

View File

@ -38,11 +38,11 @@ public class EditorWindowDelegate extends WindowDelegate {
protected boolean commitAndCloseButtonExists;
protected boolean readOnly;
protected Metadata metadata = AppBeans.get(Metadata.class);
protected Messages messages = AppBeans.get(Messages.class);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class);
protected LockService lockService = AppBeans.get(LockService.class);
protected Configuration configuration = AppBeans.get(Configuration.class);
protected Metadata metadata = AppBeans.get(Metadata.NAME);
protected Messages messages = AppBeans.get(Messages.NAME);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
protected LockService lockService = AppBeans.get(LockService.NAME);
protected Configuration configuration = AppBeans.get(Configuration.NAME);
public EditorWindowDelegate(Window window) {
super(window);

View File

@ -106,13 +106,11 @@ public interface PickerField extends Field, Component.ActionsHolder {
public abstract Action createAction(PickerField pickerField);
}
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
public static abstract class StandardAction extends AbstractAction {
protected PickerField pickerField;
protected ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
protected ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class);
public StandardAction(String id, PickerField pickerField) {
super(id);

View File

@ -26,9 +26,8 @@ import java.util.Map;
import java.util.UUID;
/**
* <p>$Id$</p>
*
* @author krivopustov
* @version $Id$
*/
public class WindowDelegate {
@ -40,7 +39,7 @@ public class WindowDelegate {
protected Window wrapper;
protected Settings settings;
protected WindowConfig windowConfig = AppBeans.get(WindowConfig.class);
protected WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
private Log log = LogFactory.getLog(getClass());

View File

@ -88,7 +88,8 @@ public class AddAction extends AbstractAction implements Action.HasOpenType {
this.openType = openType;
this.caption = messages.getMainMessage("actions.Add");
this.icon = "icons/add.png";
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
setShortcut(clientConfig.getTableAddShortcut());
refreshState();
@ -182,7 +183,7 @@ public class AddAction extends AbstractAction implements Action.HasOpenType {
if (windowId != null) {
return windowId;
} else {
WindowConfig windowConfig = AppBeans.get(WindowConfig.class);
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
MetaClass metaClass = owner.getDatasource().getMetaClass();
return windowConfig.getAvailableLookupScreenId(metaClass);
@ -230,7 +231,7 @@ public class AddAction extends AbstractAction implements Action.HasOpenType {
return;
}
Metadata metadata = AppBeans.get(Metadata.class);
Metadata metadata = AppBeans.get(Metadata.NAME);
ExtendedEntities extendedEntities = metadata.getExtendedEntities();
ds.suspendListeners();

View File

@ -75,7 +75,8 @@ public class CreateAction extends AbstractAction implements Action.HasOpenType {
this.caption = messages.getMainMessage("actions.Create");
this.icon = "icons/create.png";
this.metadata = AppBeans.get(Metadata.NAME);
ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
setShortcut(clientConfig.getTableInsertShortcut());
refreshState();

View File

@ -79,7 +79,8 @@ public class EditAction extends ItemTrackingAction implements Action.HasOpenType
this.owner = owner;
this.openType = openType;
this.icon = "icons/edit.png";
ClientConfig config = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig config = configuration.getConfig(ClientConfig.class);
setShortcut(config.getTableEditShortcut());
refreshState();

View File

@ -77,7 +77,8 @@ public class RemoveAction extends ItemTrackingAction {
this.security = AppBeans.get(Security.NAME);
ClientConfig config = AppBeans.get(Configuration.class).getConfig(ClientConfig.class);
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig config = configuration.getConfig(ClientConfig.class);
setShortcut(config.getTableRemoveShortcut());
refreshState();

View File

@ -28,10 +28,12 @@ public abstract class AbstractCustomCondition<T extends AbstractParam> extends A
public AbstractCustomCondition(Element element, String messagesPack, String filterComponentName, Datasource datasource) {
super(element, filterComponentName, datasource);
if (isBlank(caption))
if (isBlank(caption)) {
locCaption = element.attributeValue("locCaption");
else
locCaption = AppBeans.get(MessageTools.class).loadString(messagesPack, caption);
} else {
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
locCaption = messageTools.loadString(messagesPack, caption);
}
entityAlias = element.attributeValue("entityAlias");
text = element.getText();
@ -82,10 +84,12 @@ public abstract class AbstractCustomCondition<T extends AbstractParam> extends A
if (res != null)
return res;
if (param == null)
return locCaption + ": " + AppBeans.get(Messages.class).getMessage(MESSAGES_PACK, "CustomCondition.paramNotDefined");
else
if (param == null) {
Messages messages = AppBeans.get(Messages.NAME);
return locCaption + ": " + messages.getMessage(MESSAGES_PACK, "CustomCondition.paramNotDefined");
} else {
return null;
}
}
public String getJoin() {

View File

@ -25,7 +25,8 @@ public abstract class AbstractCustomConditionDescriptor<T extends AbstractParam>
this.caption = element.attributeValue("caption");
if (this.caption != null) {
this.locCaption = AppBeans.get(MessageTools.class).loadString(messagesPack, this.caption);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
this.locCaption = messageTools.loadString(messagesPack, this.caption);
}
inExpr = Boolean.valueOf(element.attributeValue("inExpr"));
@ -41,7 +42,8 @@ public abstract class AbstractCustomConditionDescriptor<T extends AbstractParam>
if (className == null) {
return null;
} else {
return AppBeans.get(Scripting.class).loadClass(element.attributeValue("paramClass"));
Scripting scripting = AppBeans.get(Scripting.NAME);
return scripting.loadClass(element.attributeValue("paramClass"));
}
}

View File

@ -66,7 +66,7 @@ public abstract class AbstractCustomConditionEditDlg<T> {
public AbstractCustomConditionEditDlg(final AbstractCustomCondition condition) {
this.condition = condition;
this.messagesPack = AppConfig.getMessagesPack();
this.messages = AppBeans.get(Messages.class);
this.messages = AppBeans.get(Messages.NAME);
ThemeConstantsManager themeManager = AppBeans.get(ThemeConstantsManager.NAME);
ThemeConstants theme = themeManager.getConstants();
@ -324,8 +324,8 @@ public abstract class AbstractCustomConditionEditDlg<T> {
if (!entitySelect.isEnabled())
return;
MetadataTools metadataTools = AppBeans.get(MetadataTools.class);
MessageTools messageTools = AppBeans.get(MessageTools.class);
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
Map<String, Object> items = new TreeMap<>();
Object selectedItem = null;
@ -338,7 +338,8 @@ public abstract class AbstractCustomConditionEditDlg<T> {
if (param != null && AbstractParam.Type.ENTITY.equals(param.getType())) {
Class javaClass = param.getJavaClass();
selectedItem = AppBeans.get(Metadata.class).getClass(javaClass);
Metadata metadata = AppBeans.get(Metadata.NAME);
selectedItem = metadata.getClass(javaClass);
}
entitySelect.setOptionsMap(items);
entitySelect.setValue(selectedItem);

View File

@ -64,9 +64,10 @@ public abstract class AbstractFilterEditor {
this.metaClass = datasource.getMetaClass();
this.existingNames = existingNames;
Configuration configuration = AppBeans.get(Configuration.NAME);
this.manualApplyRequired = filter.getManualApplyRequired() != null ?
filter.getManualApplyRequired() :
AppBeans.get(Configuration.class).getConfig(ClientConfig.class).getGenericFilterManualApplyRequired();
configuration.getConfig(ClientConfig.class).getGenericFilterManualApplyRequired();
String[] strings = ValuePathHelper.parse(filterEntity.getComponentId());
this.filterComponentName = ValuePathHelper.format(Arrays.copyOfRange(strings, 1, strings.length));

View File

@ -52,8 +52,8 @@ public abstract class AbstractParam<T> {
protected List<String> runtimeEnum;
protected UUID categoryAttrId;
protected Messages messages = AppBeans.get(Messages.class);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class);
protected Messages messages = AppBeans.get(Messages.NAME);
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
private List<ValueListener> listeners = new ArrayList<>();
@ -184,7 +184,8 @@ public abstract class AbstractParam<T> {
private Object loadEntity(String id) {
LoadContext ctx = new LoadContext(javaClass).setId(UUID.fromString(id));
Entity entity = AppBeans.get(DataService.class).load(ctx);
DataService dataService = AppBeans.get(DataService.NAME);
Entity entity = dataService.load(ctx);
return entity;
}

View File

@ -34,9 +34,11 @@ public abstract class AbstractPropertyCondition<T extends AbstractParam> extends
Class itemsClass = datasource.getMetaClass().getJavaClass();
String propertyPath = itemsClass.getSimpleName() + "." + name;
this.locCaption = AppBeans.get(Messages.class).getMessage(itemsClass, propertyPath);
Messages messages = AppBeans.get(Messages.NAME);
this.locCaption = messages.getMessage(itemsClass, propertyPath);
if (locCaption == null || locCaption.equals(propertyPath)) {
this.locCaption = AppBeans.get(MessageTools.class).loadString(messagesPack, caption);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
this.locCaption = messageTools.loadString(messagesPack, caption);
}
String text = element.getText();
@ -148,7 +150,8 @@ public abstract class AbstractPropertyCondition<T extends AbstractParam> extends
}
if (operator == null) {
return locCaption + ": " + AppBeans.get(Messages.class).getMessage(MESSAGES_PACK, "PropertyCondition.operatorNotDefined");
Messages messages = AppBeans.get(Messages.NAME);
return locCaption + ": " + messages.getMessage(MESSAGES_PACK, "PropertyCondition.operatorNotDefined");
} else {
return null;
}
@ -156,6 +159,7 @@ public abstract class AbstractPropertyCondition<T extends AbstractParam> extends
@Override
public String getOperationCaption() {
return AppBeans.get(Messages.class).getMessage(operator);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(operator);
}
}

View File

@ -31,7 +31,7 @@ public abstract class AbstractPropertyConditionDescriptor<T extends AbstractPara
super(name, filterComponentName, datasource);
this.caption = caption;
Messages messages = AppBeans.get(Messages.class);
Messages messages = AppBeans.get(Messages.NAME);
if (!isBlank(caption)) {
this.locCaption = messages.getTools().loadString(messagesPack, caption);

View File

@ -48,7 +48,7 @@ public abstract class AbstractRuntimePropConditionEditDlg<T> {
public AbstractRuntimePropConditionEditDlg(AbstractRuntimePropCondition condition) {
dataService = AppBeans.get(DataService.NAME);
metadata = AppBeans.get(Metadata.class);
metadata = AppBeans.get(Metadata.NAME);
this.condition = condition;
messagesPack = AppConfig.getMessagesPack();

View File

@ -28,6 +28,7 @@ public enum ParamType {
@Override
public String toString() {
return AppBeans.get(Messages.class).getMessage(this);
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(this);
}
}

View File

@ -25,8 +25,8 @@ public class ModelPropertiesFilter {
public ModelPropertiesFilter() {
security = AppBeans.get(Security.NAME);
messageTools = AppBeans.get(MessageTools.class);
metadataTools = AppBeans.get(MetadataTools.class);
messageTools = AppBeans.get(MessageTools.NAME);
metadataTools = AppBeans.get(MetadataTools.NAME);
}
public boolean isPropertyFilterAllowed(MetaClass metaClass, MetaProperty property) {

View File

@ -42,11 +42,12 @@ public class PropertyModelItem implements ModelItem {
this.descriptor = descriptor;
} else {
StringBuilder name = new StringBuilder(metaProperty.getName());
StringBuilder caption = new StringBuilder(AppBeans.get(MessageTools.class).getPropertyCaption(metaProperty));
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
StringBuilder caption = new StringBuilder(messageTools.getPropertyCaption(metaProperty));
ModelItem item = parent;
while (item != null && item instanceof PropertyModelItem) {
name.insert(0, ((PropertyModelItem) item).metaProperty.getName() + ".");
caption.insert(0, AppBeans.get(MessageTools.class).getPropertyCaption(((PropertyModelItem) item).metaProperty) + ".");
caption.insert(0, messageTools.getPropertyCaption(((PropertyModelItem) item).metaProperty) + ".");
item = item.getParent();
}
this.descriptor = descriptorBuilder.buildPropertyConditionDescriptor(name.toString(), caption.toString());
@ -87,7 +88,8 @@ public class PropertyModelItem implements ModelItem {
if (caption != null) {
return caption;
}
return AppBeans.get(MessageTools.class).getPropertyCaption(metaProperty);
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
return messageTools.getPropertyCaption(metaProperty);
}
@Override

View File

@ -55,7 +55,8 @@ public class RootCustomConditionModelItem implements ModelItem {
@Override
public String getCaption() {
return AppBeans.get(Messages.class).getMessage(AbstractFilterEditor.MESSAGES_PACK, "NewConditionDlg.specialConditions");
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(AbstractFilterEditor.MESSAGES_PACK, "NewConditionDlg.specialConditions");
}
@Override

View File

@ -49,7 +49,8 @@ public class RootGroupingModelItem implements ModelItem {
@Override
public String getCaption() {
return AppBeans.get(Messages.class).getMessage(AbstractFilterEditor.MESSAGES_PACK, "NewConditionDlg.grouping");
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(AbstractFilterEditor.MESSAGES_PACK, "NewConditionDlg.grouping");
}
@Override

View File

@ -82,7 +82,8 @@ public class RootPropertyModelItem implements ModelItem {
@Override
public String getCaption() {
return AppBeans.get(Messages.class).getMessage(AbstractFilterEditor.MESSAGES_PACK, "NewConditionDlg.attributes");
Messages messages = AppBeans.get(Messages.NAME);
return messages.getMessage(AbstractFilterEditor.MESSAGES_PACK, "NewConditionDlg.attributes");
}
@Override

View File

@ -12,9 +12,9 @@ import com.haulmont.cuba.gui.components.Formatter;
* @author tulupov
* @version $Id$
*/
public class ClassNameFormatter implements Formatter{
public class ClassNameFormatter implements Formatter {
protected Messages messages = AppBeans.get(Messages.class);
protected Messages messages = AppBeans.get(Messages.NAME);
@Override
public String format(Object value) {

Some files were not shown because too many files have changed in this diff Show More