/** * Gets page size. * * @return the page size */ protected Integer getPageSize(IReferencePropertyDescriptor<IComponent> erqDescriptor) { if (pageSize != null) { return pageSize; } if (erqDescriptor.getReferencedDescriptor().getPageSize() != null) { return erqDescriptor.getReferencedDescriptor().getPageSize(); } return null; }
private IView<SComponent> createReferencePropertyView( IReferencePropertyDescriptor<?> propertyDescriptor, IActionHandler actionHandler, Locale locale) { SActionField viewComponent = createSActionField(true); SReferenceFieldConnector connector = new SReferenceFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setToStringPropertyConnector(new BasicValueConnector( propertyDescriptor.getComponentDescriptor().getToStringProperty())); connector.setExceptionHandler(actionHandler); Action fieldAction = actionFactory.createAction(lovAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); fieldAction.putValue(Action.NAME, getTranslationProvider().getTranslation( "lov.element.name", new Object[] {propertyDescriptor.getReferencedDescriptor().getI18nName( translationProvider, locale)}, locale)); fieldAction.putValue(Action.SHORT_DESCRIPTION, getTranslationProvider() .getTranslation( "lov.element.description", new Object[] {propertyDescriptor.getReferencedDescriptor() .getI18nName(translationProvider, locale)}, locale) + TOOLTIP_ELLIPSIS); if (propertyDescriptor.getReferencedDescriptor().getIconImageURL() != null) { fieldAction.putValue(Action.SMALL_ICON, iconFactory.getIcon( propertyDescriptor.getReferencedDescriptor().getIconImageURL(), IIconFactory.TINY_ICON_SIZE)); } viewComponent.setActions(Collections.singletonList(fieldAction)); adjustSizes(viewComponent, null, null); return constructView(viewComponent, null, connector); }
.getInitializationMapping(); if (initializationMapping != null) { getEntityFactory(context).applyInitializationMapping(queryComponent, queryComponent.getQueryDescriptor(), masterComponent, initializationMapping, erqDescriptor.getName());
if (erqDescriptor.getReferencedDescriptor() instanceof IQueryComponentDescriptor) { queriedContract = ((IQueryComponentDescriptor) erqDescriptor .getReferencedDescriptor()).getQueriedComponentsDescriptor() .getComponentContract(); } else { queriedContract = erqDescriptor.getReferencedDescriptor() .getComponentContract(); queryComponent.setPageSize(erqDescriptor.getPageSize());
SActionField viewComponent = createSActionField(true); SReferenceFieldConnector connector = new SReferenceFieldConnector( propertyDescriptor.getName(), viewComponent); String renderedProperty = computeRenderedProperty(propertyViewDescriptor); connector.setRenderingConnector(new BasicValueConnector(renderedProperty)); "lov.element.description", new Object[] { propertyDescriptor.getReferencedDescriptor().getI18nName( actionHandler, locale) }, locale) + TOOLTIP_ELLIPSIS); if (propertyDescriptor.getReferencedDescriptor().getIconImageURL() != null) { lovAction.putValue( Action.SMALL_ICON, getIconFactory().getIcon( propertyDescriptor.getReferencedDescriptor().getIconImageURL(), getIconFactory().getTinyIconSize()));
protected Object getReferenceProperty(Object proxy, final IReferencePropertyDescriptor<IComponent> propertyDescriptor) { String propertyName = propertyDescriptor.getName(); Object referent = straightGetProperty(proxy, propertyName); if (referent instanceof IPropertyChangeCapable) { .getReferencedDescriptor(); if (referent == null && EntityHelper.isInlineComponentReference(propertyDescriptor) && !propertyDescriptor .isComputed() && propertyDescriptor.isMandatory()) { boolean wasDirtyTrackingEnabled = isDirtyTrackingEnabled(); try {
erqDescriptor.getReferencedDescriptor().getQueryComponentContract()); .getInitializationMapping(); if (initializationMapping != null) { IEntity masterEntity = null; ACTION_MODEL_NAME, new BasicQueryComponentDescriptor(erqDescriptor .getReferencedDescriptor())); context.put(ActionContextConstants.QUERY_MODEL_CONNECTOR, modelConnector); if (queryPropertyValue != null && !queryPropertyValue.equals("*")) { modelConnector.getChildConnector( erqDescriptor.getComponentDescriptor().getToStringProperty()) .setConnectorValue(queryPropertyValue);
autoCompletePropertyName = erqDescriptor.getReferencedDescriptor().getAutoCompleteProperty(); if (erqDescriptor.getReferencedDescriptor() instanceof RefQueryComponentDescriptor<?>) { IReferencePropertyDescriptor<IComponent> refinedErqDescriptor = ((BasicReferencePropertyDescriptor<IComponent>) erqDescriptor) .getComponentDescriptor(erqDescriptor.getModelType())); erqDescriptor = refinedErqDescriptor;
private String getActionDescription(IAction action, Map<String, Object> context) { Class<? extends IAction> actionClass = action.getClass(); String actionDescription = actionClass.getSimpleName(); if (actionDescription == null || actionDescription.isEmpty()) { actionDescription = actionClass.getName(); int lastDotIndex = actionDescription.lastIndexOf("."); if (lastDotIndex >= 0) { actionDescription = actionDescription.substring(lastDotIndex + 1); } } if (action.getPermId() != null) { actionDescription += ("@"+action.getPermId()); } if (action instanceof LovAction<?, ?, ?>) { IReferencePropertyDescriptor<IComponent> componentRefDescriptor = (IReferencePropertyDescriptor<IComponent>) context .get(CreateQueryComponentAction.COMPONENT_REF_DESCRIPTOR); if (componentRefDescriptor != null) { String referencePropertyName = componentRefDescriptor.getName(); if (referencePropertyName != null) { int lastDotIndex = referencePropertyName.lastIndexOf("."); if (lastDotIndex >= 0) { referencePropertyName = referencePropertyName.substring(lastDotIndex + 1); } } actionDescription = actionDescription + "(" + referencePropertyName + ")"; } } return actionDescription; }
String propertyName = propertyDescriptor.getName(); EntityHelper.isInlineComponentReference(propertyDescriptor) && !propertyDescriptor.isComputed()); if (referenceTrackers == null) { referenceTrackers = new THashMap<>(1, 1.0f);
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public IViewDescriptor createLovViewDescriptor( IReferencePropertyDescriptor entityRefDescriptor) { BasicSplitViewDescriptor lovViewDescriptor = new BasicSplitViewDescriptor(); lovViewDescriptor.setLeftTopViewDescriptor(queryViewDescriptorFactory .createQueryViewDescriptor( entityRefDescriptor.getComponentDescriptor())); lovViewDescriptor .setRightBottomViewDescriptor(createResultViewDescriptor(entityRefDescriptor .getComponentDescriptor())); return lovViewDescriptor; }
/** * {@inheritDoc} */ @Override protected void storeReferenceProperty(Object proxy, IReferencePropertyDescriptor<?> propertyDescriptor, Object oldPropertyValue, Object newPropertyValue) { if (newPropertyValue != null && EntityHelper.isInlineComponentReference(propertyDescriptor) && !propertyDescriptor .isComputed()) { if (Proxy.isProxyClass(newPropertyValue.getClass()) && Proxy.getInvocationHandler( newPropertyValue) instanceof BasicComponentInvocationHandler && !(Proxy.getInvocationHandler( newPropertyValue) instanceof ControllerAwareComponentInvocationHandler)) { IComponent sessionAwareComponent = getInlineComponentFactory().createComponentInstance( ((IComponent) newPropertyValue).getComponentContract()); sessionAwareComponent.straightSetProperties(((IComponent) newPropertyValue).straightGetProperties()); super.storeReferenceProperty(proxy, propertyDescriptor, oldPropertyValue, sessionAwareComponent); } else { super.storeReferenceProperty(proxy, propertyDescriptor, oldPropertyValue, newPropertyValue); } } else { super.storeReferenceProperty(proxy, propertyDescriptor, oldPropertyValue, newPropertyValue); } }
viewComponent = createJLabel(propertyViewDescriptor, true); connector = new JLabelConnector(propertyDescriptor.getName() + "." + renderedProperty, (JLabel) viewComponent); } else { viewComponent = createJActionField(propertyViewDescriptor, true); connector = new JReferenceFieldConnector(propertyDescriptor.getName(), (JActionField) viewComponent); ((JReferenceFieldConnector) connector).setRenderingConnector(new BasicValueConnector(renderedProperty)); new Object[]{propertyDescriptor.getReferencedDescriptor().getI18nName(actionHandler, locale)}, locale) + IActionFactory.TOOLTIP_ELLIPSIS); ((JActionField) viewComponent).setActions(Collections.singletonList(lovAction));
/** * {@inheritDoc} */ @Override protected Object getReferenceProperty(Object proxy, IReferencePropertyDescriptor<IComponent> propertyDescriptor) { String propertyName = propertyDescriptor.getName(); getBackendController().initializePropertyIfNeeded((IComponent) proxy, propertyName); return super.getReferenceProperty(proxy, propertyDescriptor); }
.getPropertyDescriptor(rootProperty); referenceTracker = new NestedReferenceTracker(proxy, rootProperty, EntityHelper.isInlineComponentReference(rootPropertyDescriptor) && !rootPropertyDescriptor.isComputed()); if (referenceTrackers == null) { referenceTrackers = new THashMap<>(1, 1.0f);
@Override protected void feedContextWithDialog(IReferencePropertyDescriptor<IComponent> erqDescriptor, IQueryComponent queryComponent, IView<E> lovView, IActionHandler actionHandler, Map<String, Object> context) { super.feedContextWithDialog(erqDescriptor, queryComponent, lovView, actionHandler, context); if (!context.containsKey(LOV_DIALOG_ACTIONS)) { context.put(ModalDialogAction.DIALOG_ACTIONS, Arrays.asList(getFindAction())); } context.put(ModalDialogAction.DIALOG_TITLE, erqDescriptor.getReferencedDescriptor().getI18nName(getTranslationProvider(context), getLocale(context))); }
private IView<JComponent> createReferencePropertyView( IReferencePropertyDescriptor<?> propertyDescriptor, IActionHandler actionHandler, Locale locale) { JActionField viewComponent = createJActionField(true); JReferenceFieldConnector connector = new JReferenceFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setToStringPropertyConnector(new BasicValueConnector( propertyDescriptor.getComponentDescriptor().getToStringProperty())); connector.setExceptionHandler(actionHandler); Action fieldAction = actionFactory.createAction(lovAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); fieldAction.putValue(Action.NAME, getTranslationProvider().getTranslation( "lov.element.name", new Object[] {propertyDescriptor.getReferencedDescriptor().getI18nName( translationProvider, locale)}, locale)); fieldAction.putValue(Action.SHORT_DESCRIPTION, getTranslationProvider() .getTranslation( "lov.element.description", new Object[] {propertyDescriptor.getReferencedDescriptor() .getI18nName(translationProvider, locale)}, locale) + TOOLTIP_ELLIPSIS); if (propertyDescriptor.getReferencedDescriptor().getIconImageURL() != null) { fieldAction.putValue(Action.SMALL_ICON, iconFactory.getIcon( propertyDescriptor.getReferencedDescriptor().getIconImageURL(), IIconFactory.TINY_ICON_SIZE)); } viewComponent.setActions(Collections.singletonList(fieldAction)); adjustSizes(viewComponent, null, null); return constructView(viewComponent, null, connector); }
.getModelDescriptor(); String renderedProperty = computeRenderedProperty(propertyViewDescriptor); IValueConnector connector = getConnectorFactory().createCompositeValueConnector(propertyDescriptor.getName(), renderedProperty); connector.setExceptionHandler(actionHandler); new Object[]{propertyDescriptor.getReferencedDescriptor().getI18nName(actionHandler, locale)}, locale) + IActionFactory.TOOLTIP_ELLIPSIS); RActionList actionList = new RActionList(getGuidGenerator().generateGUID());
/** * {@inheritDoc} */ @Override protected Object getReferenceProperty(Object proxy, IReferencePropertyDescriptor<IComponent> propertyDescriptor) { String propertyName = propertyDescriptor.getName(); getBackendController().initializePropertyIfNeeded((IComponent) proxy, propertyName); return super.getReferenceProperty(proxy, propertyDescriptor); }
/** * {@inheritDoc} */ @Override protected void storeReferenceProperty(Object proxy, IReferencePropertyDescriptor<?> propertyDescriptor, Object oldPropertyValue, Object newPropertyValue) { if (newPropertyValue != null && EntityHelper.isInlineComponentReference(propertyDescriptor) && !propertyDescriptor.isComputed()) { if (Proxy.isProxyClass(newPropertyValue.getClass()) && Proxy.getInvocationHandler(newPropertyValue) instanceof BasicComponentInvocationHandler && !(Proxy.getInvocationHandler(newPropertyValue) instanceof ControllerAwareComponentInvocationHandler)) { IComponent sessionAwareComponent = getInlineComponentFactory() .createComponentInstance( ((IComponent) newPropertyValue).getComponentContract()); sessionAwareComponent .straightSetProperties(((IComponent) newPropertyValue) .straightGetProperties()); super.storeReferenceProperty(proxy, propertyDescriptor, oldPropertyValue, sessionAwareComponent); } else { super.storeReferenceProperty(proxy, propertyDescriptor, oldPropertyValue, newPropertyValue); } } else { super.storeReferenceProperty(proxy, propertyDescriptor, oldPropertyValue, newPropertyValue); } }