Commit e499e2a4 authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: missing ListView in OutputXML: synchronize selected items, names and keys (2/2)

parent 783c8a29
......@@ -92,24 +92,10 @@ public:
std::vector<int> GetSelectedItems()
{
if( m_SelectedNames.size() != 0 )
{
this->SetSelectedItemsByNames();
}
else if( m_SelectedKeys.size() != 0 )
{
this->SetSelectedItemsByKeys();
}
return m_SelectedItems;
}
void SetSelectedNames(std::vector<std::string> selectedNames)
{
m_SelectedNames = selectedNames;
m_SelectedItems.clear();
m_SelectedKeys.clear();
}
void SetSelectedNames(std::vector<std::string> selectedNames);
std::vector<std::string> GetSelectedNames()
{
......@@ -117,22 +103,21 @@ public:
}
void SetSelectedKeys(std::vector<std::string> selectedKeys)
{
m_SelectedKeys = selectedKeys;
m_SelectedItems.clear();
m_SelectedNames.clear();
}
void SetSelectedKeys(std::vector<std::string> selectedKeys);
std::vector<std::string> GetSelectedKeys()
{
return m_SelectedKeys;
}
/** Set selected items using a lit of selected keys. */
void SetSelectedItemsByKeys();
/** Set selected items using a lit of selected names. */
void SetSelectedItemsByNames();
/** Set selected items using a lit of selected keys.
* OBSOLETE : this method is not needed anymore and does nothing. */
void SetSelectedItemsByKeys(){}
/** Set selected items using a lit of selected names.
* OBSOLETE : this method is not needed anymore and does nothing. */
void SetSelectedItemsByNames(){}
void SetSelectedItems(std::vector<std::string> selectedItems)
{
std::vector<int> items;
......@@ -140,14 +125,22 @@ public:
{
items.push_back( atoi( selectedItems[i].c_str() ) );
}
m_SelectedItems = items;
m_SelectedNames.clear();
m_SelectedKeys.clear();
this->SetSelectedItems(items);
}
void SetSelectedItems(std::vector<int> selectedItems)
{
m_SelectedItems = selectedItems;
m_SelectedNames.clear();
m_SelectedKeys.clear();
// update selected names and keys
std::vector<std::string> names = this->GetChoiceNames();
std::vector<std::string> keys = this->GetChoiceKeys();
for (unsigned int i=0 ; i<m_SelectedItems.size() ; i++)
{
m_SelectedNames.push_back(names[m_SelectedItems[i]]);
m_SelectedKeys.push_back(keys[m_SelectedItems[i]]);
}
}
protected:
......
......@@ -145,14 +145,15 @@ ListViewParameter::ClearChoices()
m_ChoiceList.clear();
}
void
ListViewParameter::SetSelectedItemsByNames()
ListViewParameter::SetSelectedNames(std::vector<std::string> selectedNames)
{
std::vector<int> selectedItems;
std::vector<std::string> names = this->GetChoiceNames();
for(unsigned int i=0; i<m_SelectedNames.size(); i++)
for(unsigned int i=0; i<selectedNames.size(); i++)
{
const std::string selectedName = m_SelectedNames[i];
const std::string selectedName = selectedNames[i];
unsigned int j(0);
for(; j<names.size(); j++)
{
......@@ -182,13 +183,13 @@ ListViewParameter::SetSelectedItemsByNames()
void
ListViewParameter::SetSelectedItemsByKeys()
ListViewParameter::SetSelectedKeys(std::vector<std::string> selectedKeys)
{
std::vector<int> selectedItems;
std::vector<std::string> keys = this->GetChoiceKeys();
for(unsigned int i=0; i<m_SelectedKeys.size(); i++)
for(unsigned int i=0; i<selectedKeys.size(); i++)
{
const std::string selectedKey = m_SelectedKeys[i];
const std::string selectedKey = selectedKeys[i];
unsigned int j(0);
std::ostringstream oss;
for(; j<keys.size(); j++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment