@Override protected void valueBindingConnected(ValueSource<String> valueSource) { super.valueBindingConnected(valueSource); if (valueSource instanceof EntityValueSource) { DataAwareComponentsTools dataAwareComponentsTools = beanLocator.get(DataAwareComponentsTools.class); EntityValueSource entityValueSource = (EntityValueSource) valueSource; dataAwareComponentsTools.setupMaxLength(this, entityValueSource); } }
@Override public void afterPropertiesSet() { UserSessionSource userSessionSource = beanLocator.get(UserSessionSource.NAME); FormatStringsRegistry formatStringsRegistry = beanLocator.get(FormatStringsRegistry.NAME); String timeFormat = formatStringsRegistry.getFormatStringsNN(userSessionSource.getLocale()).getTimeFormat(); setFormat(timeFormat); }
protected List<UserSubstitution> getUserSubstitutions() { UserManagementService userManagementService = beanLocator.get(UserManagementService.NAME); UserSessionSource uss = beanLocator.get(UserSessionSource.NAME); return userManagementService.getSubstitutedUsers(uss.getUserSession().getUser().getId()); }
/** * Saves screen settings. */ protected void saveSettings() { if (settings != null) { ScreenSettings screenSettings = getBeanLocator().get(ScreenSettings.NAME); screenSettings.saveSettings(this, settings); } }
@Override public void setUploadButtonIcon(String icon) { if (!StringUtils.isEmpty(icon)) { IconResolver iconResolver = beanLocator.get(IconResolver.class); component.setUploadButtonIcon(iconResolver.getIconResource(icon)); } else { component.setUploadButtonIcon(null); } }
@Override public void setContentSwitchMode(ContentSwitchMode mode) { checkNotNullArgument(mode, "Content switch mode can't be null. Use ContentSwitchMode.DEFAULT option instead"); MainTabSheetMode tabSheetMode = beanLocator.get(Configuration.class) .getConfig(WebConfig.class) .getMainTabSheetMode(); if (tabSheetMode != MainTabSheetMode.MANAGED) { log.debug("Content switch mode can be set only for the managed main TabSheet. Current invocation will be ignored."); } this.contentSwitchMode = mode; }
@Override public void afterPropertiesSet() { initComponent(component); Configuration configuration = beanLocator.get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); setPageLength(clientConfig.getLookupFieldPageLength()); UserSessionSource userSessionSource = beanLocator.get(UserSessionSource.class); this.locale = userSessionSource.getLocale(); }
@Inject public void setBeanLocator(BeanLocator beanLocator) { super.setBeanLocator(beanLocator); UserSessionSource uss = beanLocator.get(UserSessionSource.NAME); TimeZone timeZone = uss.getUserSession().getTimeZone(); TimeZones timeZones = beanLocator.get(TimeZones.NAME); component.setValue(timeZones.getDisplayNameShort(timeZone)); if (timeZone == null) { // hidden by default if timeZone is null setVisible(false); } }
@Override public void setOptions(Options<V> options) { if (this.optionsBinding != null) { this.optionsBinding.unbind(); this.optionsBinding = null; } if (options != null) { OptionsBinder optionsBinder = beanLocator.get(OptionsBinder.NAME); this.optionsBinding = optionsBinder.bind(options, this, this::setItemsToPresentation); this.optionsBinding.activate(); } }
@Override public void setClearButtonIcon(String icon) { if (icon != null) { IconResolver iconResolver = beanLocator.get(IconResolver.NAME); Resource iconResource = iconResolver.getIconResource(icon); component.setClearButtonIcon(iconResource); } else { component.setClearButtonIcon(null); } }
@Override public void setOptions(Options<V> options) { if (this.optionsBinding != null) { this.optionsBinding.unbind(); this.optionsBinding = null; } if (options != null) { OptionsBinder optionsBinder = beanLocator.get(OptionsBinder.NAME); this.optionsBinding = optionsBinder.bind(options, this, this::setItemsToPresentation); this.optionsBinding.activate(); } }
protected FileDescriptor commitFileDescriptor(FileDescriptor fileDescriptor) { DataSupplier dataSupplier = getDataSupplier(); if (dataSupplier != null) { return dataSupplier.commit(fileDescriptor); } DataManager dataManager = beanLocator.get(DataManager.NAME); return dataManager.commit(fileDescriptor); }
@PostConstruct public void init() { theme = themeConstantsManager.getConstants(); windowManager = windowManagerProvider.get(); if (beanLocator.containsBean(FtsFilterHelper.NAME)) { ftsFilterHelper = beanLocator.get(FtsFilterHelper.class); } filterMode = FilterMode.GENERIC_MODE; conditionsLocation = clientConfig.getGenericFilterConditionsLocation(); createLayout(); }
/** * Validates visible and enabled UI components. <br> * Can be overridden in subclasses. * * @return validation errors */ protected ValidationErrors validateUiComponents() { ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.NAME); return screenValidation.validateUiComponents(getForm().getComponents()); }
@Override public void needMinSearchStringLength(String filterString, int minSearchStringLength) { Messages messages = beanLocator.get(Messages.NAME); String message = messages.formatMessage( "com.haulmont.cuba.gui", "searchSelect.minimumLengthOfFilter", minSearchStringLength); App.getInstance().getWindowManager().showNotification(message, defaultNotificationType); } };
protected boolean handleValidationErrors(ValidationErrors errors) { postValidate(errors); if (errors.isEmpty()) return true; ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.class); screenValidation.showValidationErrors(this, errors); return false; }
/** * Returns the name of the pessimistic lock. */ protected String getLockName() { InstanceContainer<T> container = getEditContainer(); return getBeanLocator().get(ExtendedEntities.class) .getOriginalOrThisMetaClass(container.getEntityMetaClass()) .getName(); }
public void releaseLock() { if (justLocked) { Datasource ds = getDatasourceInternal(); Entity entity = ds.getItem(); if (entity != null) { getBeanLocator().get(LockService.class).unlock(getMetaClassForLocking(ds).getName(), entity.getId().toString()); } } }
protected void initLookupActions(@SuppressWarnings("unused") InitEvent event) { addAction(new SelectAction(this)); Messages messages = getBeanLocator().get(Messages.NAME); addAction(new BaseAction(LOOKUP_CANCEL_ACTION_ID) .withCaption(messages.getMainMessage("actions.Cancel")) .withHandler(e -> close("cancel") )); }
protected void handleDateOutOfRange(V value) { if (getFrame() != null) { Messages messages = beanLocator.get(Messages.NAME); Notifications notifications = ComponentsHelper.getScreenContext(this).getNotifications(); notifications.create() .withCaption(messages.getMainMessage("datePicker.dateOutOfRangeMessage")) .withType(Notifications.NotificationType.TRAY) .show(); } setValueToPresentation(convertToLocalDateTime(value, zoneId)); }