This navigation menu however, is far
from being perfect. There are at least two enhancements that we might want to add:
1. There is no need to display the navigation menu on the Start page, at least
until the user hasn't logged in.
2. There is no need to link a page to itself, for example when we are at the
ShowAll page, the All Celebrities link could be disabled.
For any of these tasks, the Border component will need to know which page renders
it at that moment. We can easily find the class name of the page that contains the
component using the already familiar ComponentResources class, like this:
@Inject
private ComponentResources resources;
private String getPageName()
{
Component page = resources.getContainer();
return page.getClass().getName();
}
We can also provide a few simple methods that will check if the current page is the
Start page, the Registration and so on??”as many methods as there are links in the
navigation menu:
public boolean isNotStart()
{
return !getPageName().equals(Start.class.getName());
}
public boolean isRegistration()
{
return getPageName().equals(Registration.class.getName());
}
public boolean isShowAll()
{
return getPageName().equals(ShowAll.
Pages:
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255