/** * Insert a new ui component into the panel. * * @param handler The handler associated with this component. */ private void addToHistory(XmlHandler handler) { int howManyToRemove = handlers.size() - historyIdx - 1; for (int cnt = 0; cnt < howManyToRemove; cnt++) { Misc.removeLast(handlers); } handlers.add(handler); historyIdx = handlers.size() - 1; checkButtons(); }