r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ if (GetItemCount(groupIndex) == 0 && groupIndex > __pListImpl->__topGroup)
+ {
+ __pListImpl->__bottomGroup++;
+ }
+
+ if (groupIndex < __pListImpl->__topGroup)
+ {
+ __pListImpl->__topGroup = groupIndex;
+ }
+
return __pListImpl->GetTableViewGroupItemAt(groupIndex);
}
pCustomListItem->__pCustomListItemImpl->__pTableViewGroupItemData = null;
}
+ if (__pListImpl->GetItemCountAt(groupIndex) == 0)
+ {
+ if (groupIndex == __pListImpl->__topGroup)
+ {
+ if (__pListImpl->__topGroup < __pListImpl->__bottomGroup)
+ {
+ __pListImpl->__topGroup++;
+ }
+ }
+ else if (groupIndex < __pListImpl->__topGroup)
+ {
+ __pListImpl->__topGroup--;
+ }
+ if (__pListImpl->__bottomGroup != 0)
+ {
+ __pListImpl->__bottomGroup--;
+ }
+ }
+
delete pItem;
return true;
}
}
}
+ else if (__pListImpl->__isFullUpdate == true)
+ {
+ __pListImpl->RemoveFromItemsList(groupIndex, (__pListImpl->GetSubItemCountAt(groupIndex) - 1), false);
+ }
delete pItem;
pItem = null;
, __bottomGroup(0)
, __topGroup(0)
, __loadedCount(0)
+ , __isFullUpdate(false)
, __pItemProvider(null)
, __directDelete(false)
, __forceScroll(false)
return E_SUCCESS;
}
- if (groupIndex <= __topGroup)
+ if (groupIndex <= __bottomGroup)
{
- __topGroup++;
__bottomGroup++;
}
+ if (groupIndex < __topGroup)
+ {
+ __topGroup++;
+ }
+
if (__pItemProvider == null)
{
r = CreateItemProvider();
SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
- SysTryReturn(NID_UI_CTRL, (index >= GetTopItemIndex(groupIndex) && index <= (GetSubItemCountAt(groupIndex) + GetTopItemIndex(groupIndex))), E_INVALID_ARG, E_INVALID_ARG,
- "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
-
_TableViewItemParams tableViewItemParams;
tableViewItemParams.pItem = (const_cast<CustomListItem*>(&item));
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
"[%s] A system error has occurred. Failed to create an item.", GetErrorMessage(r));
- r = InsertIntoItemsList(item, groupIndex, (index - GetTopItemIndex(groupIndex)));
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+ int subItemCount = GetSubItemCountAt(groupIndex);
+ if (index < (subItemCount + GetTopItemIndex(groupIndex)) && (index >= GetTopItemIndex(groupIndex)))
+ {
+ r = InsertIntoItemsList(item, groupIndex, (index - GetTopItemIndex(groupIndex)));
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+ }
_SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
"[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
- result r = E_SUCCESS;
Boolean* pChecked = null;
int itemIndex = 0;
- int subItemCount = GetSubItemCountAt(groupIndex);
- for (itemIndex = pGroupObject->__itemCount; itemIndex >= 0; itemIndex--)
+ for (itemIndex = (GetItemCountAt(groupIndex) - 1); itemIndex >= 0; itemIndex--)
{
pChecked = dynamic_cast<Boolean*>(pGroupObject->__pCheckedList->GetAt(itemIndex));
if (pChecked && pChecked->ToBool() == true)
{
- if (pGroupObject->__pCheckedList != null)
- {
- pGroupObject->__pCheckedList->RemoveAt(itemIndex, true);
- }
-
- __directDelete = true;
-
- if (itemIndex < (subItemCount + pGroupObject->__topIndex) && (itemIndex >= pGroupObject->__topIndex))
- {
- RemoveFromItemsList(groupIndex, (itemIndex - pGroupObject->__topIndex));
- }
-
- r = GetCore().RefreshTableView(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
- if (r != E_SUCCESS)
- {
- SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupIndex);
- }
-
- __directDelete = false;
-
- CallUnloadItemCb(groupIndex, itemIndex);
- pGroupObject->__itemCount--;
+ RemoveItemAt(groupIndex, itemIndex, 0);
}
}
result
_SlidableGroupedListImpl::RemoveAllItemsAt(int groupIndex)
{
- result r = E_SUCCESS;
SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
- _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
- SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
- "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
-
- __directDelete = true;
-
- for (int itemCount = 0; itemCount < GetSubItemCountAt(groupIndex);)
- {
- r = RemoveItemAt(groupIndex, 0, 0);
- if (r != E_SUCCESS)
- {
- SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupIndex);
- }
- }
-
- __directDelete = false;
+ int itemIndex = 0;
- if (pGroupObject->__pCheckedList != null)
+ for (itemIndex = (GetItemCountAt(groupIndex) - 1); itemIndex >= 0; itemIndex--)
{
- pGroupObject->__pCheckedList->RemoveAll(true);
+ RemoveItemAt(groupIndex, itemIndex, 0);
}
- pGroupObject->__itemCount = 0;
-
return E_SUCCESS;
}
for (groupCount = 0; groupCount < __groupsList.GetCount(); groupCount++)
{
- RemoveAllItemsAt(groupCount);
+ _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupCount));
+ SysTryReturn(NID_UI_CTRL, pGroupObject, 0, E_SYSTEM,
+ "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupCount);
+
+ pGroupObject->__itemCount = 0;
+ pGroupObject->__topIndex = 0;
+
}
- __pItemProvider->firstTime = true;
+ __isFullUpdate = true;
+ GetCore().UpdateTableView();
+ __isFullUpdate = false;
+ __pItemProvider->firstTime = true;
+ __topGroup = 0;
return E_SUCCESS;
}
int subItemCount = GetSubItemCountAt(groupIndex);
- SysTryReturn(NID_UI_CTRL, (index >= 0 && index < subItemCount),
+ SysTryReturn(NID_UI_CTRL, (index >= 0 && index < pGroupObject->__itemCount),
E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
- if (!(index < pGroupObject->__topIndex + subItemCount))
+ __directDelete = true;
+
+ if (pGroupObject->__pCheckedList != null)
{
- pGroupObject->__itemCount--;
- return E_SUCCESS;
+ pGroupObject->__pCheckedList->RemoveAt(index, true);
}
- __directDelete = true;
-
- RemoveFromItemsList(groupIndex, index);
+ if (index < (subItemCount + pGroupObject->__topIndex) && (index >= pGroupObject->__topIndex))
+ {
+ RemoveFromItemsList(groupIndex, (index - pGroupObject->__topIndex));
+ }
result r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
if (r != E_SUCCESS)
SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupIndex);
}
- if (pGroupObject->__pCheckedList != null)
- {
- pGroupObject->__pCheckedList->RemoveAt(index, true);
- }
-
__directDelete = false;
CallUnloadItemCb(groupIndex, index);