@Override public String getMessage(String pack, String key, Locale locale) { return messages.getMessage(pack, key, locale); } }
protected String getDefaultCaption() { if (messages != null) { // legacy behaviour return messages.getMessage(getClass(), id); } else { return null; } }
@Override public void validate(Object value) throws ValidationException { if (StringUtils.isNotEmpty((String) value) && !((String) value).matches(".+\\.([A-z]{0,5})")) throw new ValidationException(String.format( messages.getMessage(OutputFileNameValidator.class, "fillCorrectOutputFileNameMsg"), messages.getMessage(ReportWizardCreator.class, "outputFileName"))); } }
@Override public Object exec(List args) throws TemplateModelException { if (args.size() == 2) return messages.getMessage((String) args.get(0), (String) args.get(1)); else if (args.size() == 1) { return messages.getMessage((Enum) args.get(0)); } else throw new TemplateModelException("Wrong arguments"); } }
@Override public String getCaption() { Messages messages = AppBeans.get(Messages.class); return messages.getMessage(getClass(), "Layout.root"); } }
@Override protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) { String msg = messages.getMessage(getClass(), "accessDenied.message"); windowManager.showNotification(msg, Frame.NotificationType.ERROR); }
public ListPrintFormAction(String id, ListComponent listComponent) { super(id); this.listComponent = listComponent; Messages messages = AppBeans.get(Messages.NAME); this.caption = messages.getMessage(ListPrintFormAction.class, "actions.Report"); this.icon = "icons/reports-print.png"; }
@Override protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) { String msg = messages.getMessage(LuceneIndexNotFoundExceptionHandler.class, "indexNotFound.msg"); windowManager.showNotification(msg, Frame.NotificationType.ERROR); } }
protected Map<String, Object> getSizeUnitsValues() { Map<String, Object> sizeUnitsMap = new HashMap<>(); for (SizeUnit sizeUnit : SizeUnit.values()) { sizeUnitsMap.put(messages.getMessage(sizeUnit), sizeUnit); } return sizeUnitsMap; }
@Override public String getCaption() { if (!Strings.isNullOrEmpty(this.caption)) { return this.caption; } Messages messages = AppBeans.get(Messages.NAME); return messages.getMessage(StartProcessAction.class, "startProcess"); } }
@Override protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) { String msg = messages.getMessage(getClass(), "noSuchScreen.message"); windowManager.showNotification(msg, throwable != null ? throwable.getMessage() : null, Frame.NotificationType.ERROR); }
@Override public String getCaption() { Messages messages = AppBeans.get(Messages.class); return messages.getMessage(getClass(), "Layout.grid"); } }
@Override public String getCaption() { Messages messages = AppBeans.get(Messages.class); return messages.getMessage(getClass(), "Layout.css"); }
private String formatEnum(Enum enumValue) { Messages messages = AppBeans.get(Messages.class); GlobalConfig globalConfig = AppBeans.get(Configuration.class).getConfig(GlobalConfig.class); Set<String> localizedValues = new HashSet<>(); for (Locale locale : globalConfig.getAvailableLocales().values()) { localizedValues.add(messages.getMessage(enumValue, locale)); } return Joiner.on(" ").join(localizedValues); }
public void setMode(AggregationMode mode) { this.mode = mode; if (StringUtils.isEmpty(caption)) { setCaption(AppBeans.get(Messages.class).getMessage(getClass(), "AggregationMode." + mode.toString())); } }
/** * Method returns the current value that should be displayed in the UI. The method takes into account the {@link #secret} * property value and displays a value placeholder if it should not be visible */ @MetaProperty public String getDisplayedCurrentValue() { if (Boolean.TRUE.equals(secret) && isDatatypeMayBeHidden()) { return AppBeans.get(Messages.class).getMessage(AppPropertyEntity.class, "AppPropertyEntity.valueIsSecret"); } else { return currentValue; } }
/** * Method returns the default value that should be displayed in the UI. The method takes into account the {@link #secret} * property value and displays a value placeholder if it should not be visible */ @MetaProperty public String getDisplayedDefaultValue() { if (Boolean.TRUE.equals(secret) && isDatatypeMayBeHidden()) { return AppBeans.get(Messages.class).getMessage(AppPropertyEntity.class, "AppPropertyEntity.valueIsSecret"); } else { return defaultValue; } }
protected Label generateLabelByPermissionVariant(PermissionVariant permissionVariant) { if (permissionVariant == PermissionVariant.NOTSET) return null; String labelValue = "<span class=\"role-permission-" + permissionVariant.getColor() + "\">" + messages.getMessage(permissionVariant) + "</span>"; Label label = componentsFactory.createComponent(Label.class); label.setHtmlEnabled(true); label.setValue(labelValue); return label; } }
protected void createJpqlDataSet(ReportData reportData, ReportRegion reportRegion, BandDefinition dataBand) { DataSet dataSet = dataSetFactory.createEmptyDataSet(dataBand); dataSet.setName(messages.getMessage(getClass(), "dataSet")); dataSet.setType(DataSetType.JPQL); String query = new JpqlQueryBuilder(reportData, reportRegion).buildQuery(); dataSet.setText(query); dataSet.setDataStore(reportData.getDataStore()); dataBand.getDataSets().add(dataSet); }
@Override public void check(Credentials credentials, AuthenticationDetails authenticationDetails) throws LoginException { if (credentials instanceof AbstractClientCredentials) { AbstractClientCredentials clientCredentials = (AbstractClientCredentials) credentials; if (clientCredentials.isCheckClientPermissions() && clientCredentials.getClientType() == ClientType.REST_API && !authenticationDetails.getSession().isSpecificPermitted("cuba.restApi.enabled")) { throw new RestApiAccessDeniedException(messages.getMessage(MSG_PACK, "LoginException.restApiAccessDenied")); } } }