Forum Message UI Improvement (Thesis Board #3470) #61
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "3470-forum-msg-ui-improvement"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix #63
Requirements
On supervisor's start page, a overview of the projects being supervised is shown as a table. One of columns is a flag and on clicking action the browser is redirected to forum page of that project.
Two improvements were asked:
How to test
eric@example.com
WIP: Forum Message UI Improvement (3470)to Forum Message UI Improvement (3470)Some suggestions for improvement.
Things that should be fixed
NumberOfMessagesPanel
This panel has no behaviour and just shows a label whose data comes from outside. Can move the
Label
component to where it is used (SupervisorMyProjectsPanel
). The label'sIModel
does not need to include the parenthesis, they should be moved to the HTML since they have to do with presentation rather than the data to display.Old
hasUnreadThreads
method inProjectForumService
This method was replaced with the
getUnreadThreadsCount
method and should be removed, its associated test should be updated to test the newgetUnreadThreadsCount
method.Wicket gotcha's that's good to know
Risk of stale information
Due to the way the unread thread count is retrieved in
SupervisorMyProjectsPanel
it may not updated as the underlying data (in the database) changes because the constructor is only run once. However, in this specific case, since it is done in aRefreshingView
(the component that is responsible for renderingIColumn
s in aDataTable
) that for implementation specific reasons does re-run itspopulateItem
method it does indeed work. But had the fetching not been done in aRefreshingView
it would not have worked as expected on page refresh.To solve this the
msgCount
should be loaded in anIModel
(because those get detached and re-attached at every refresh). The ideal implementation isLoadableDetachableModel
to cache the value during each render if the associatedgetObject
method is called multiple times. AnIModel
sgetObject
should not be called in the constructer because then you have the some problem, instead of use methods onIModel
such asmap
or callgetObject
from Wicket's lifecycleonConfigure
,onClick
, `onSubmit, and so on.getString
in "constructor"Similar to the above problems with loading data outside of
IModel
exist for callinggetString
(line 287 inSupervisorMyProjectsPanel
). In these cases the fix is very simple, replacegetString(...)
withnew ResourceModel(...)
that does the same thing just wrapped in anIModel
andAttributeModifier
has a constructor for acceptingIModel
instead of directString
s. Again, this works now because we're in aRefreshingView
otherwise you'd get a warning similar to what happened in #48.Forum Message UI Improvement (3470)to Forum Message UI Improvement (Thesis Board #3470)PO review OK