Change in ovirt-engine[master]: webadmin: Refactoring of AddRemoveRowWidget, remove juggling...

mbetak at redhat.com mbetak at redhat.com
Wed Oct 26 15:17:24 UTC 2016


Martin Betak has submitted this change and it was merged.

Change subject: webadmin: Refactoring of AddRemoveRowWidget, remove juggling with iterator
......................................................................


webadmin: Refactoring of AddRemoveRowWidget, remove juggling with
iterator

Former code excelled in optimizing LOC metric and getting everything
done via Iterator manipulation. Which is unreadable, full of
side-effects (code smell), and it's pointless.

Changes:
• items.listIterator(items.size()).hasPrevious()  ≈ !items.isEmpty()

• mysterious first part of if statement "item == last.previous()"
comparison makes sure, that we're adding plus button only if last item
is removed. I made this fact more obvious.

• mysterious second part of if statement "last.hasPrevious()" makes
sure, that after item removal, the items collection won't be
empty, thus we have something to add plus button to. I made this fact
more obvious.

• adding of plus button before removing last item is (in priciple)
wrong. Adding plus symbol only after removal is a) easier to write
code b) it is required by follow-up patch.

Change-Id: Ib563b43cf7e7cd4a71ff51f615ebfb8ff074e79c
Signed-off-by: Martin Mucha <mmucha at redhat.com>
---
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AddRemoveRowWidget.java
1 file changed, 15 insertions(+), 6 deletions(-)

Approvals:
  Tomas Jelinek: Looks good to me, approved
  Martin Mucha: Verified
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/65571
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib563b43cf7e7cd4a71ff51f615ebfb8ff074e79c
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Mucha <mmucha at redhat.com>
Gerrit-Reviewer: Jakub Niedermertl <jniederm at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Martin Mucha <mmucha at redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjelinek at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list