List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink isActionAuthorized
public final boolean isActionAuthorized(Action action)
From source file:org.obiba.onyx.webapp.administration.page.AdministrationPage.java
License:Open Source License
public AdministrationPage() { AjaxLink<?> userTab = new AdminTab("userTab") { @Override// w w w . j a v a 2 s. c o m public Component getTabComponent() { return new UserSearchPanel(getContentId()); } }; add(userTab.setOutputMarkupId(true)); links.add(userTab); AjaxLink<?> dataTab = new AdminTab("dataTab") { @Override public Component getTabComponent() { return new DataManagementPanel(getContentId()); } }; add(dataTab.setOutputMarkupId(true)); links.add(dataTab); AjaxLink<?> editorTab = new EditorTab("editorTab") { @Override public Component getTabComponent() { for (Module module : moduleRegistry.getModules()) { Component editorComponent = module.getEditorPanel(getContentId()); if (editorComponent != null) return editorComponent; } return null; } }; add(editorTab.setOutputMarkupId(true)); links.add(editorTab); AjaxLink<?> devTab = new AdminTab("devTab") { @Override public Component getTabComponent() { return new DevelopersPanel(getContentId()); } @Override public boolean isVisible() { return ((OnyxApplication) WebApplication.get()).isDevelopmentMode(); } }; add(devTab.setOutputMarkupId(true)); links.add(devTab); // Display first permitted tab for (AjaxLink<?> link : links) { if (link.isActionAuthorized(new Action(Action.RENDER))) { Component tabComponent = ((Link) link).getTabComponent(); add(tabComponent.setOutputMarkupId(true)); link.add(new AttributeModifier("class", true, new Model<String>("obiba-button ui-corner-all selected"))); break; } } }