/** * Sets the filter. * * @param filter * the filter to set. */ public void setFilter(Object filter) { if (ObjectUtils.equals(this.filter, filter)) { return; } Object oldValue = getFilter(); this.filter = filter; firePropertyChange("filter", oldValue, getFilter()); }
/** * Gets the module descriptor. * * @return the module descriptor. */ @Override protected BeanCollectionModuleDescriptor getDescriptor() { return new FilterableBeanCollectionModuleDescriptor(getElementComponentDescriptor(), getQueryComponentDescriptorFactory().createQueryComponentDescriptor(getFilterComponentDescriptor())); }
/** * {@inheritDoc} */ @Override public MobileFilterableBeanCollectionModule clone() { MobileFilterableBeanCollectionModule clone = (MobileFilterableBeanCollectionModule) super.clone(); return clone; }
/** * Deserialize filter criteria from base 64 from * and hydrate que query component. * * @param filterAsBase64 * the serialized form of the filter criteria * @throws ClassNotFoundException * the class not found exception * @throws IOException * the iO exception */ public void deserializeCriteria(String filterAsBase64) throws ClassNotFoundException, IOException { Serializable[] criteria = QueryComponentSerializationUtil.deserializeFilter(filterAsBase64); hydrateCriteria(getFilter(), criteria); }
return; Integer oldDisplayPageIndex = getDisplayPageIndex(); String oldDisplayPageCount = getDisplayPageCount(); String oldDisplayRecordCount = getDisplayRecordCount(); boolean oldPageNavigationEnabled = isPageNavigationEnabled(); boolean oldNextPageEnabled = isNextPageEnabled(); boolean oldPreviousPageEnabled = isPreviousPageEnabled(); IQueryComponent oldValue = getFilter(); if (oldValue != null) { oldValue.removePropertyChangeListener(filterComponentTracker); filter.put(AbstractQueryComponentsAction.CRITERIA_REFINER, criteriaRefiner); filter.setPageSize(getPageSize()); filter.setDefaultOrderingProperties(getOrderingProperties()); filter.addPropertyChangeListener(filterComponentTracker); firePropertyChange(IPageable.DISPLAY_PAGE_INDEX, oldDisplayPageIndex, getDisplayPageIndex()); firePropertyChange(IPageable.DISPLAY_PAGE_COUNT, oldDisplayPageCount, getDisplayPageCount()); firePropertyChange(IPageable.DISPLAY_RECORD_COUNT, oldDisplayRecordCount, getDisplayRecordCount()); firePropertyChange(IPageable.PAGE_NAVIGATION_ENABLED, oldPageNavigationEnabled, isPageNavigationEnabled()); firePropertyChange(IPageable.NEXT_PAGE_ENABLED, oldNextPageEnabled, isNextPageEnabled()); firePropertyChange(IPageable.PREVIOUS_PAGE_ENABLED, oldPreviousPageEnabled, isPreviousPageEnabled()); firePropertyChange(FilterableBeanCollectionModuleDescriptor.FILTER, oldValue, getFilter());
IComponentDescriptor<IComponent> realComponentDesc = getFilterComponentDescriptor(); IViewDescriptor filterView = getFilterViewDescriptor(); IComponentDescriptorProvider<IQueryComponent> filterModelDescriptorProvider = (IComponentDescriptorProvider<IQueryComponent>) moduleDescriptor boolean customFilterView = false; if (filterView == null) { boolean fos = getFindOnSet(); boolean fot = getFindOnType(); IDisplayableAction charAction = null; if (fot) { filterView = getQueryViewDescriptorFactory().createQueryViewDescriptor(realComponentDesc, filterModelDescriptorProvider.getComponentDescriptor(), fos ? pagingAction : null, fot ? charAction : null, Collections.<String, Object>emptyMap()); cleanupFilterViewDescriptor(filterView); getQueryViewDescriptorFactory().adaptExistingViewDescriptor(filterView); BasicTabViewDescriptor tabFilterView = getFilterExtraViewDescriptor(); if (tabFilterView == null) { IQueryExtraViewDescriptorFactory extraViewFactory = getQueryExtraViewDescriptorFactory(); if (extraViewFactory != null) { tabFilterView = extraViewFactory.createQueryExtraViewDescriptor(getProjectedViewDescriptor(), realComponentDesc, filterModelDescriptorProvider.getComponentDescriptor()); newTabFilterView.setPermId(getPermId() + ".filter"); newTabFilterView.setRenderingOptions(ERenderingOptions.LABEL);
context); context.put(CreateQueryComponentAction.COMPONENT_REF_DESCRIPTOR, ((IComponentDescriptor<?>) filterableBeanCollectionModule.getViewDescriptor().getModelDescriptor()) .getPropertyDescriptor(FilterableBeanCollectionModuleDescriptor.FILTER)); final IQueryComponent queryComponent; } else { queryComponent = getEntityFactory(context).createQueryComponentInstance( (Class<? extends IComponent>) filterableBeanCollectionModule.getElementComponentDescriptor() .getComponentContract()); filterableBeanCollectionModule.getProjectedViewDescriptor()); if (moduleObjectsViewDescriptor instanceof ITableViewDescriptor) { List<String> prefetchProperties = new ArrayList<>(); queryComponentRefiner.refineQueryComponent(queryComponent, context); IQueryComponent previousFilter = filterableBeanCollectionModule.getFilter(); if (previousFilter != null) { queryComponent.setOrderingProperties(previousFilter.getOrderingProperties()); filterableBeanCollectionModule.setFilter(queryComponent); filterableBeanCollectionModule.setModuleObjects(null); if (filterableBeanCollectionModule.getPagingAction() != null) { PropertyChangeListener paginationListener = new PropertyChangeListener() {
IViewDescriptor superViewDescriptor = super.getViewDescriptor(); IComponentDescriptor<?> moduleDescriptor = (IComponentDescriptor<?>) superViewDescriptor.getModelDescriptor(); IViewDescriptor filterViewDesc = buildFilterViewDescriptor(moduleDescriptor); .extractMainCollectionView(getProjectedViewDescriptor()); if (moduleObjectsView != null) { if (moduleObjectsView.getName() == null) { moduleObjectsView.setName(getName()); if (getPageSize() != null && getPageSize() > 0) { if (moduleObjectsView.getPaginationViewDescriptor() == null) { moduleObjectsView.setPaginationViewDescriptor(getPaginationViewDescriptor());
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { if (queryAction != null) { FilterableBeanCollectionModule module = (FilterableBeanCollectionModule) getModuleConnector( context).getConnectorValue(); IValueConnector filterConnector = getModuleConnector(context) .getChildConnector("filter"); context .put(ActionContextConstants.QUERY_MODEL_CONNECTOR, filterConnector); IQueryComponent filter = (IQueryComponent) module.getFilter(); if (actionHandler.execute(queryAction, context)) { module.setModuleObjects(filter.getQueriedComponents()); filter.setQueriedComponents(null); } } return super.execute(actionHandler, context); }
/** * Gets find on set. * * @return the find on set */ protected boolean getFindOnSet() { if (findOnSet != null) { return findOnSet; } Boolean autoQueryEnabled = getElementComponentDescriptor().getAutoQueryEnabled(); if (autoQueryEnabled != null) { return autoQueryEnabled; } Integer pageSize = getPageSize(); return pageSize != null && pageSize > 0; }
moduleDescriptor = new FilterableBeanCollectionModuleDescriptor( componentDescriptor, ((FilterableBeanCollectionModule) module) .getFilterComponentDescriptor()); } else { moduleDescriptor = new BeanCollectionModuleDescriptor( if (module instanceof FilterableBeanCollectionModule) { IComponentDescriptor<Object> filterComponentDescriptor = ((FilterableBeanCollectionModule) module) .getFilterComponentDescriptor(); IViewDescriptor filterViewDescriptor = ((FilterableBeanCollectionModule) module) .getFilterViewDescriptor(); if (filterViewDescriptor == null) { filterViewDescriptor = queryViewDescriptorFactory
/** * Gets the filterComponentDescriptor. * * @return the filterComponentDescriptor. */ @SuppressWarnings("unchecked") public IComponentDescriptor<IComponent> getFilterComponentDescriptor() { if (filterComponentDescriptor == null) { return (IComponentDescriptor<IComponent>) getElementComponentDescriptor(); } return filterComponentDescriptor; }
/** * Assigns the result list to the module. * <p> * {@inheritDoc} */ @Override protected void queryPerformed(IQueryComponent queryComponent, Map<String, Object> context) { FilterableBeanCollectionModule module = (FilterableBeanCollectionModule) getModule(context); List<?> currentModuleObjects = module.getModuleObjects(); List<Object> targetModuleObjects = new ArrayList<>( queryComponent.getQueriedComponents()); // We need to preserve transient entities from being lost. if (currentModuleObjects != null) { for (Object comp : currentModuleObjects) { if (comp instanceof IEntity && !((IEntity) comp).isPersistent() && !targetModuleObjects.contains(comp)) { targetModuleObjects.add(comp); } } } module.setModuleObjects(targetModuleObjects); //queryComponent.setQueriedComponents(null); } }
Module module = getModule(context); if (module instanceof FilterableBeanCollectionModule) { IQueryComponent filter = ((FilterableBeanCollectionModule) module).getFilter(); if (filter != null) { if (queryComponentRefiner != null) { if (((FilterableBeanCollectionModule) module).getModuleObjects() == null || ((FilterableBeanCollectionModule) module).getModuleObjects().isEmpty()) { actionHandler.execute(emptyResultAction, context);
/** * Retrieves the query component out of the context. * * @param context * the action context. * @return the query component. */ @Override protected IQueryComponent getQueryComponent(Map<String, Object> context) { FilterableBeanCollectionModule module = (FilterableBeanCollectionModule) getModule(context); return module.getFilter(); }
/** * {@inheritDoc} * * @param evt * the evt */ @Override public void propertyChange(PropertyChangeEvent evt) { target.firePropertyChange(FilterableBeanCollectionModuleDescriptor.FILTER + "." + evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); if (IPageable.DISPLAY_PAGE_INDEX.equals(evt.getPropertyName()) || IPageable.NEXT_PAGE_ENABLED.equals( evt.getPropertyName()) || IPageable.PAGE.equals(evt.getPropertyName()) || IPageable.PAGE_COUNT.equals( evt.getPropertyName()) || IPageable.DISPLAY_PAGE_COUNT.equals(evt.getPropertyName()) || IPageable.PAGE_SIZE .equals(evt.getPropertyName()) || IPageable.PREVIOUS_PAGE_ENABLED.equals(evt.getPropertyName()) || IPageable.RECORD_COUNT.equals(evt.getPropertyName()) || IPageable.DISPLAY_RECORD_COUNT.equals( evt.getPropertyName()) || IPageable.SELECTED_RECORD_COUNT.equals(evt.getPropertyName()) || IPageable.PAGE_NAVIGATION_ENABLED.equals(evt.getPropertyName())) { target.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); } } }
/** * Cleanup filter view descriptor. * * @param filterViewDesc * the filter view desc */ protected void cleanupFilterViewDescriptor(IViewDescriptor filterViewDesc) { if (filterViewDesc instanceof BasicViewDescriptor) { ((BasicViewDescriptor) filterViewDesc).setModelDescriptor(null); } if (filterViewDesc instanceof ICompositeViewDescriptor) { List<IViewDescriptor> children = ((ICompositeViewDescriptor) filterViewDesc).getChildViewDescriptors(); if (children != null) { for (IViewDescriptor childViewDesc : children) { cleanupFilterViewDescriptor(childViewDesc); } } } }
/** * Gets find on type. * * @return the find on type */ protected boolean getFindOnType() { if (findOnType != null) { return findOnType; } Boolean autoQueryEnabled = getElementComponentDescriptor().getAutoQueryEnabled(); if (autoQueryEnabled != null) { return autoQueryEnabled; } Integer pageSize = getPageSize(); return pageSize != null && pageSize > 0; }
/** * Gets the filterComponentDescriptor. * * @return the filterComponentDescriptor. */ public IComponentDescriptor<Object> getFilterComponentDescriptor() { if (filterComponentDescriptor == null) { return getElementComponentDescriptor(); } return filterComponentDescriptor; }
/** * Serialize filter criteria. * * @return the serialized form of the filter criteria component * * @throws IOException * the iO exception */ public String serializeCriteria() throws IOException { return QueryComponentSerializationUtil.serializeFilter(getFilter(), new LinkedHashMap<String, Serializable>()); }