Skip to content

Commit

Permalink
Merge pull request #1608 from DSheirer/1603-duplicate-events
Browse files Browse the repository at this point in the history
#1603 De-Duplicate Call Events
  • Loading branch information
DSheirer authored Jul 22, 2023
2 parents c302c4d + 1ac49bf commit 005a4f8
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,21 @@ public T getItem(int index)
*/
public void add(T item)
{
mItems.addFirst(item);
ClearableHistoryModel.this.fireTableRowsInserted(0, 0);
while(mItems.size() > mHistorySize)
if(mItems.contains(item))
{
mItems.removeLast();
super.fireTableRowsDeleted(mItems.size() - 1, mItems.size() - 1);
int itemRow = mItems.indexOf(item);
fireTableRowsUpdated(itemRow, itemRow);
}
else
{
mItems.addFirst(item);
fireTableRowsInserted(0, 0);

while(mItems.size() > mHistorySize)
{
mItems.removeLast();
fireTableRowsDeleted(mItems.size() - 1, mItems.size() - 1);
}
}
}

Expand Down Expand Up @@ -100,14 +109,6 @@ public int getHistorySize()
return mHistorySize;
}

/**
* Resets the history size to the default value.
*/
public void resetHistorySize()
{
setHistorySize(DEFAULT_HISTORY_SIZE);
}

/**
* Sets the history size
* @param historySize
Expand Down

0 comments on commit 005a4f8

Please sign in to comment.