//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimCellRangeFilter::isRangeFilterControlled()
{
    RimView* rimView = NULL;
    firstAncestorOrThisOfType(rimView);
    CVF_ASSERT(rimView);

    bool isRangeFilterControlled = false;
    if (rimView->viewController() && rimView->viewController()->isRangeFiltersControlled())
    {
        isRangeFilterControlled = true;
    }

    return isRangeFilterControlled;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
{
    RimView* rimView = NULL;
    firstAncestorOrThisOfType(rimView);
    CVF_ASSERT(rimView);

    bool isPropertyFilterControlled = false;
    RimViewController* vc = rimView->viewController();
    if (vc && vc->isPropertyFilterOveridden())
    {
        isPropertyFilterControlled = true;
    }

    return isPropertyFilterControlled;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPropertyFilterCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
{
    PdmObject::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);

    RimView* rimView = NULL;
    this->firstAncestorOrThisOfType(rimView);
    RimViewController* viewController = rimView->viewController();
    if (viewController && (viewController->isPropertyFilterOveridden() 
                           || viewController->isVisibleCellsOveridden()))
    {
        isActive.uiCapability()->setUiReadOnly(true, uiConfigName);
    }
    else
    {
        isActive.uiCapability()->setUiReadOnly(false, uiConfigName);
    }

    updateIconState();
}