Add status bar to views (MGNLUI-75)

[MGNLUI-1071] Status bar, create default view Created: 09/Apr/13  Updated: 26/Apr/13  Resolved: 15/Apr/13

Status: Closed
Project: Magnolia UI
Component/s: design
Affects Version/s: None
Fix Version/s: 5.0

Type: Sub-task Priority: Neutral
Reporter: Mikaël Geljić Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: statusbar
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Date of First Response:
Sprint: Iteration 2013-13, Iteration 2013-14, Iteration 2013-15, Iteration 2013-16, Iteration 2013-17

 Description   

As specified in concept http://wiki.magnolia-cms.com/display/DEV/Concept+-+Status+bar+in+subapps

  • Create interface StatusBarView
  • Implement it as a simple vaadin CustomComponent


 Comments   
Comment by Daniel Lipp [ 17/Apr/13 ]

StatusBarViewImpl would be more DRY when combining addComponent with getFirstAvailableRightIndex and getFirstAvailableLeftIndex to something like:

    public void addComponent(Component c, Alignment align) {
        int index = 0;
        Iterator<Component> it = getComponentIterator();
        while (it.hasNext()) {
            Alignment nextAlignment = getComponentAlignment(it.next());
            if (align.isLeft() ? nextAlignment.isLeft() : nextAlignment.isRight()) {
                index++;
            }
        }
        addComponent(c, index);
        setComponentAlignment(c, align);
    }

A UnitTest would be handy to verify refactoring doesn't break anything.
Although there might be one required change: looks suspicious that in getFirstAvailableRightIndex the getComponentAlignment(it.next()).isRight() is inverted by '!' but not in getFirstAvailableLeftIndex.

Comment by Mikaël Geljić [ 17/Apr/13 ]

#addComponent(Component, Alignment) is specified in the concept such that first added is first aligned. For right-aligned components, that means we stack components starting from the right. Concretely though, in the end it extends the HorizontalLayout so it's just one series of indices, and we have to insert components at the right position in that series.

For left alignment: we iterate as long as next component is left-aligned. New insertion position is after last left-aligned component. (LTR)
For right alignment: we iterate as long as next component is not right-aligned. New insertion position is before first right-aligned component. (RTL)
For center alignment: same inserting point as for right alignment. New insertion position is after last centered component. (LTR)

I actually have the test already and that was omitted in the commit, so it's easy to test the proposal but I doubt it works, when these two methods make it more legible. Then I will at least add javadoc in impl to give those missing details.

Comment by Daniel Lipp [ 18/Apr/13 ]

I like the new imp

Generated at Mon Feb 12 08:43:04 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.