Alona Kaplan has posted comments on this change. Change subject: userportal: Add quota bar tool-tip ......................................................................
Patch Set 2: (6 inline comments) .................................................... File frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/QuotaProgressBar.java Line 39: private static final double GIGA = 1024; Line 40: private static final double MB_GB_THRESHOLD = 4; // over this threshold number would be presented in GB not MB Line 41: private QuotaUsagePerUser quotaUsagePerUser; Line 42: Line 43: public QuotaProgressBar(ApplicationTemplates templates, QuotaUsagePerUser quotaUsagePerUser, QuotaType type) { Why don't you create the templates in this class? What is the added value of getting through the ctor? Line 44: this(templates, type); Line 45: setQuotaUsagePerUser(quotaUsagePerUser); Line 46: } Line 47: Line 61: } Line 62: Line 63: private void setValuesByType(QuotaUsagePerUser quotaUsagePerUser) { Line 64: switch (type) { Line 65: case STORAGE: I think inheritance should be used instead of switch..case. Line 66: setValues(quotaUsagePerUser.getStorageLimit(), Line 67: quotaUsagePerUser.getStorageTotalUsage() - quotaUsagePerUser.getStorageUsageForUser(), Line 68: quotaUsagePerUser.getStorageUsageForUser()); Line 69: break; Line 117: setBars(); Line 118: } Line 119: } Line 120: Line 121: private String renderStorage(double storage) { This method is needed just for StorageQuotaProgressBar (if you will use inheritance:)). Line 122: return storage <= 0 ? "0" : diskSizeRenderer.render(storage); //$NON-NLS-1$ Line 123: } Line 124: Line 125: private String renderMemory(double memory) { Line 121: private String renderStorage(double storage) { Line 122: return storage <= 0 ? "0" : diskSizeRenderer.render(storage); //$NON-NLS-1$ Line 123: } Line 124: Line 125: private String renderMemory(double memory) { Same here, needed just for MemoryQuotaProgressBar. Line 126: if (memory <= 0) { Line 127: return "0"; //$NON-NLS-1$ Line 128: } Line 129: return memory > Math.abs(MB_GB_THRESHOLD * GIGA) ? diskSizeRenderer.render(memory / GIGA) : (int) memory + "MB"; //$NON-NLS-1$ Line 155: @Override Line 156: public void onMouseOver(MouseOverEvent event) { Line 157: SafeHtml tooltipHtml = getTooltip(); Line 158: if (!"".equals(tooltipHtml.asString())) { //$NON-NLS-1$ Line 159: tooltip.setHTML(getTooltip()); Why don't you use tooltipHtml? Line 160: PopupUtils.adjustPopupLocationToFitScreenAndShow(tooltipPanel, event.getClientX(), event.getClientY() + 20); Line 161: } Line 162: } Line 163: Line 167: MEM Line 168: } Line 169: Line 170: public SafeHtml getTooltip() { Line 171: switch (type) { Same here, inheritance would avoid this ugly long block. Line 172: case STORAGE: Line 173: if (quotaUsagePerUser.getStorageLimit() == UNLIMITED) { Line 174: return EMPTY_HTML; Line 175: } -- To view, visit http://gerrit.ovirt.org/13134 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icb877d23edceaccb8e1cd549bef8ef7d9d044ca7 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <oma...@redhat.com> Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com> Gerrit-Reviewer: Gilad Chaplik <gchap...@redhat.com> Gerrit-Reviewer: Laszlo Hornyak <lhorn...@redhat.com> Gerrit-Reviewer: ofri masad <oma...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches