Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabViewRenderer.encodeTabContentPanes does not set offset correctly #1054

Closed
gitmotte opened this issue Jan 21, 2019 · 3 comments
Closed

TabViewRenderer.encodeTabContentPanes does not set offset correctly #1054

gitmotte opened this issue Jan 21, 2019 · 3 comments
Assignees
Labels
bug Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation.
Milestone

Comments

@gitmotte
Copy link
Contributor

gitmotte commented Jan 21, 2019

Version: 1.4.1, 1.5.0-SNAPSHOT

If there are multiple tabs and the first one is disabled, but the last one is always enabled, the activeIndex="-1" does not work to load the last enabled Tab. The offset is only incremented on active Tabs ...

for (int index = 0; index < tabs.size(); index++) {
	final Tab tab = (Tab) tabs.get(index);
	if (tab.isRendered()) {
		final int currentIndex = numberOfTabsRendered;
		Runnable r = new Runnable() {
			int offset = 0;
			public void run() {
				try {
					encodeTabPane(context, writer, tab, (currentIndex+offset == currentlyActiveIndex) && (!tabView.isDisabled()));
					offset++;
				} catch (IOException ex) {
					// exotic case, suffice it to log it
					LOGGER.log(Level.SEVERE, "An exception occurred while rendering a tab.", ex);
				}
			}
		};
		if (tab.getValue() == null) {
			r.run();
			numberOfTabsRendered ++;
		} else {
			numberOfTabsRendered += ((Tab)tabs.get(currentIndex)).encodeTabs(context, r);
		}
	} 
}

Btw. where do i find the unit-tests ? https://github.com/TheCoder4eu/BootsFaces-Tests seems to be outdated ..

gitmotte added a commit to gitmotte/BootsFaces-OSP that referenced this issue Jan 21, 2019
@stephanrauh
Copy link
Collaborator

Oops. Thanks for correcting this bug!

BTW: sorry for the long delay. I've been moving to another town. That's a full-time project of its own. :)

@stephanrauh stephanrauh added the bug label Aug 1, 2019
@stephanrauh stephanrauh added this to the v1.5.0 milestone Aug 1, 2019
@stephanrauh
Copy link
Collaborator

As for your question: there are no unit tests. We've started to think about tests when it was too late. Plus, we didn't find out yet how to write useful and efficient unit tests for JSF components with a reasonable effort.

@stephanrauh
Copy link
Collaborator

I've merged your PR.

@TheCoder4eu TheCoder4eu modified the milestones: v1.5.0, v1.4.2 Aug 28, 2019
@TheCoder4eu TheCoder4eu added the Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation. label Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation.
Projects
None yet
Development

No branches or pull requests

3 participants