Exemplo n.º 1
0
/**
 * Attach the MODEL to a particular VIEW
 * This function causes the view to be updated appropriately
 */
void BOM_TABLE_MODEL::AttachTo( wxDataViewCtrl* aView )
{
    if( !aView )
    {
        return;
    }

    m_widget = aView;
    aView->Freeze();
    Cleared();

    aView->AssociateModel( this );
    aView->ClearColumns();

    // Add all columns
    for( auto col : ColumnList.Columns )
    {
        AddColumn( col );
    }

    aView->Thaw();

    // Notify the view that the data needs to be redrawn
    aView->Update();
}
Exemplo n.º 2
0
void TreeListModel::DeleteItem(const wxDataViewItem& item)
{
    TreeListModel_Item* node = reinterpret_cast<TreeListModel_Item*>(item.m_pItem);
    if ( node ) {
        
        TreeListModel_Item* parent = node->GetParent();
        wxDataViewItem parentItem(parent);
        ItemDeleted(parentItem, item);
        
        // this will also remove it from its model parent children list
        if ( parent == NULL ) {
            // root item, remove it from the roots array
            wxVector<TreeListModel_Item*>::iterator where = std::find(m_data.begin(), m_data.end(), node);
            if ( where != m_data.end() ) {
                m_data.erase(where);
            }
        }
        
        // If there are no more children, change the item back to 'normal'
        if ( parent && parent->GetChildren().empty() )
            DoChangeItemType(parentItem, false);
            
        wxDELETE(node);
    }
    
    if ( IsEmpty() )
        Cleared();
}
Exemplo n.º 3
0
void wxTreeListModel::DeleteAllItems()
{
    while ( m_root->GetChild() )
    {
        m_root->DeleteChild();
    }

    Cleared();
}
Exemplo n.º 4
0
void StaleFilesModel::Clear()
{
    wxVector<StaleFilesModel_Item*> roots = m_data;
    wxVector<StaleFilesModel_Item*>::iterator iter = roots.begin();
    for(; iter != roots.end(); ++iter) {
        DeleteItem( wxDataViewItem(*iter) );
    }
    Cleared();
}
Exemplo n.º 5
0
void CScoptViewResultsModel::Clear()
{
    wxVector<CScoptViewResultsModel_Item*> roots = m_data;
    wxVector<CScoptViewResultsModel_Item*>::iterator iter = roots.begin();
    for(; iter != roots.end(); ++iter) {
        DeleteItem( wxDataViewItem(*iter) );
    }
    Cleared();
}
Exemplo n.º 6
0
void TreeListModel::Clear()
{
    wxVector<TreeListModel_Item*> roots = m_data;
    wxVector<TreeListModel_Item*>::iterator iter = roots.begin();
    for(; iter != roots.end(); ++iter) {
        DeleteItem( wxDataViewItem(*iter) );
    }
    m_data.clear();
    Cleared();
}
Exemplo n.º 7
0
void MemCheckDVCErrorsModel::Clear()
{
    wxVector<MemCheckDVCErrorsModel_Item*> roots = m_data;
    wxVector<MemCheckDVCErrorsModel_Item*>::iterator iter = roots.begin();
    for(; iter != roots.end(); ++iter) {
        DeleteItem( wxDataViewItem(*iter) );
    }
    m_data.clear();
    Cleared();
}
void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::SetGroupingColumn( int aCol )
{
    if( m_GroupingColumn == aCol )
        return;

    m_GroupingColumn = aCol;

    Cleared();
    CalculateGrouping();
    Refresh();
}
Exemplo n.º 9
0
/**
 *  Recalculate grouping of components and reload table
 **/
void BOM_TABLE_MODEL::ReloadTable()
{
    if( m_widget )
    {
        m_widget->Freeze();
    }

    // Alert the view that the model data has changed
    Cleared();

    Groups.clear();

    for( auto& cmp : m_components )
    {
        bool grouped = false;

        if( m_groupColumns )
        {
            for( auto& group : Groups )
            {
                if( group->AddComponent( &*cmp ) )
                {
                    grouped = true;
                    break;
                }
            }
        }

        // No suitable group was found for this component
        if( !grouped )
        {
            auto* newGroup = new BOM_TABLE_GROUP( &ColumnList );

            newGroup->AddComponent( &*cmp );

            Groups.push_back( std::unique_ptr<BOM_TABLE_GROUP>( newGroup ) );
        }
    }

    // Update the display
    if( m_widget )
    {
        //Cleared();
        m_widget->AssociateModel( this );
        m_widget->Thaw();
    }
}
Exemplo n.º 10
0
//---------------------------------------------------------------------------------------
tAlarmSmartCraft::tAlarmSmartCraft( 
    const tSmartCraftFaults::tFaultID& faultID, eSeverity severity, 
    int soundingPeriod, bool clearsWhenOk, bool raiseAgain, QObject* pParent
)
    : tCoreAlarm( 
        tAlarmID( eAlarmEngine_SmartCraft, (faultID.network << 24)+(faultID.module << 20)+(faultID.scInstance << 16)+faultID.fault, 0 ), 
        true, severity, soundingPeriod, false, clearsWhenOk, acknowledgeWhenAcked, raiseAgain, pParent )
    , m_FaultID( faultID )
    , m_HasText( false )
{
    SetDeactivateOnTimeout( false );

    Connect( this, SIGNAL(Cleared( tCoreAlarm::eSource )),
             this, SLOT(OnCleared( tCoreAlarm::eSource )) );

    Connect( this, SIGNAL(Acknowledged( tCoreAlarm::eSource )),
             this, SLOT(OnAcknowledged( tCoreAlarm::eSource )) );

    Connect( this, SIGNAL(Silenced( tCoreAlarm::eSource )),
             this, SLOT(OnSilenced( tCoreAlarm::eSource )) );
} 
Exemplo n.º 11
0
//region realizacion de la interfaz IComandoPACSNotificador
void GNC::GUI::AcquisitionTableModel::ReloadModel(std::list< GNC::GCS::Ptr<GIL::DICOM::DicomDataset> >& results)
{
        //RELOAD MODEL FROM IMODELODICOM...
        if (!studyMap.empty()) {
                wxDataViewItemArray toDeleteList;
                for (TMapIndex::iterator it = studyMap.begin(); it !=  studyMap.end(); ++it) {
                        toDeleteList.push_back(wxDataViewItem((*it).second));
                }
                //then delete studies Nodes...
                ItemsDeleted(wxDataViewItem(0), toDeleteList);

                //delete all and reload again...
                ClearStudyMap();
        }
        Cleared();

        wxDataViewItemArray addList;
        if(results.size() == 0) {
                //add a virtual item...
                GNC::GCS::Ptr<GIL::DICOM::DicomDataset> pDataset(new GIL::DICOM::DicomDataset());
                pDataset->tags[GKDCM_PatientName] = _Std("No results found");
                pDataset->tags[GKDCM_StudyInstanceUID] = "";
                pDataset->secuencias.push_back(GIL::DICOM::DicomDataset());//dummy
                AcquisitionNode* pNode = new AcquisitionNode(NULL, pDataset);
                studyMap[pNode->uid] = pNode;
                addList.push_back(wxDataViewItem((void*)pNode));
        } else {
                for (std::list< GNC::GCS::Ptr<GIL::DICOM::DicomDataset> >::iterator it = results.begin(); it != results.end(); ++it) {
                        std::string studyUID = (*it)->getTag(GKDCM_StudyInstanceUID);
                        if (studyMap.find(studyUID) == studyMap.end()) {
                                AcquisitionNode* pNode = new AcquisitionNode(NULL, (*it));
                                studyMap[pNode->uid] = pNode;
                                addList.push_back(wxDataViewItem((void*)pNode));
                        }
                }
        }

        ItemsAdded(wxDataViewItem(0), addList);
}
Exemplo n.º 12
0
//---------------------------------------------------------------------------------------
void tAlarmSmartCraft::OnCleared( tCoreAlarm::eSource source )
{
    if (source != fromAlerts)
        emit Cleared( tAlarmSmartCraftPtr(this), source );
}