List of usage examples for org.apache.wicket Component RENDER
Action RENDER
To view the source code for org.apache.wicket Component RENDER.
Click Source Link
From source file:hsa.awp.admingui.util.AccessUtil.java
License:Open Source License
public static void allowRender(Component component, String right) { MetaDataRoleAuthorizationStrategy.authorize(component, Component.RENDER, right); }
From source file:lt.inventi.wicket.shiro.ShiroWicketPlugin.java
License:Apache License
/** * Performs authorization checks for the {@link Component#RENDER RENDER} * action only. Other actions are always allowed. * <p>/*from ww w. j av a 2 s.c om*/ * If the action is {@code RENDER}, the component class <em>and its * superclasses</em> are checked for the presence of * {@link org.apache.shiro.authz.annotation Shiro annotations}. * <p> * The absence of any Shiro annotation means that the component may be * rendered, and {@code true} is returned. Otherwise, each annotation is * evaluated against the current Shiro Subject. If any of the requirements * dictated by the annotations fail, {@code false} is returned and * rendering for the component will be skipped. * <p> * For example, this link will be hidden if the user is already * authenticated: * <pre class="example"> * @RequiresGuest * public class LoginLink extends StatelessLink * { * ... * }</pre> */ @Override public boolean isActionAuthorized(Component component, Action action) { if (Component.RENDER.equals(action)) { try { assertAuthorized(component.getClass()); } catch (AuthorizationException ae) { return false; } } return true; }
From source file:org.apache.syncope.client.console.panels.DashboardAccessTokensPanel.java
License:Apache License
public DashboardAccessTokensPanel(final String id, final PageReference pageRef) { super(id);// w ww . ja v a 2 s . c om WizardMgtPanel<AccessTokenTO> accessTokens = new AccessTokenDirectoryPanel.Builder(pageRef) { private static final long serialVersionUID = -5960765294082359003L; }.disableCheckBoxes().build("accessTokens"); MetaDataRoleAuthorizationStrategy.authorize(accessTokens, Component.RENDER, StandardEntitlement.ACCESS_TOKEN_LIST); add(accessTokens); }
From source file:org.apache.syncope.client.console.panels.DashboardControlPanel.java
License:Apache License
public DashboardControlPanel(final String id, final PageReference pageRef) { super(id);// w w w. ja v a 2s . co m JobWidget job = new JobWidget("job", pageRef); MetaDataRoleAuthorizationStrategy.authorize(job, Component.RENDER, String.format("%s,%s,%s", StandardEntitlement.NOTIFICATION_LIST, StandardEntitlement.TASK_LIST, StandardEntitlement.REPORT_LIST)); add(job); ReconciliationWidget reconciliation = new ReconciliationWidget("reconciliation", pageRef); MetaDataRoleAuthorizationStrategy.authorize(job, Component.RENDER, String.format("%s,%s,%s", StandardEntitlement.REPORT_EXECUTE, StandardEntitlement.REPORT_READ, StandardEntitlement.REPORT_LIST)); add(reconciliation); }
From source file:org.apache.syncope.client.console.widgets.ReconciliationWidget.java
License:Apache License
public ReconciliationWidget(final String id, final PageReference pageRef) { super(id);// w w w .j ava 2 s . c o m this.pageRef = pageRef; setOutputMarkupId(true); add(detailsModal); overlay = new WebMarkupContainer("overlay"); overlay.setOutputMarkupPlaceholderTag(true); overlay.setVisible(false); add(overlay); this.reconciliationReportKey = SyncopeConsoleApplication.get().getReconciliationReportKey(); ReportTO reconciliationReport = null; if (SyncopeConsoleSession.get().owns(StandardEntitlement.REPORT_READ)) { try { reconciliationReport = restClient.read(reconciliationReportKey); } catch (Exception e) { LOG.error("Could not fetch the expected reconciliation report with key {}, aborting", reconciliationReportKey, e); } } Fragment reportResult = reconciliationReport == null || reconciliationReport.getExecutions().isEmpty() ? new Fragment("reportResult", "noExecFragment", this) : buildExecFragment(); reportResult.setOutputMarkupId(true); add(reportResult); IndicatorAjaxLink<Void> refresh = new IndicatorAjaxLink<Void>("refresh") { private static final long serialVersionUID = -7978723352517770644L; @Override public void onClick(final AjaxRequestTarget target) { try { restClient.startExecution(reconciliationReportKey, null); overlay.setVisible(true); target.add(ReconciliationWidget.this); SyncopeConsoleSession.get().setCheckReconciliationJob(true); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); } catch (Exception e) { LOG.error("While starting reconciliation report", e); SyncopeConsoleSession.get().error("Could not start reconciliation report"); } ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } }; MetaDataRoleAuthorizationStrategy.authorize(refresh, Component.RENDER, StandardEntitlement.REPORT_EXECUTE); add(refresh); }
From source file:org.dcm4chee.dashboard.ui.messaging.SideColumnsView.java
License:Apache License
/** * Renders the columns./*from w ww . ja v a 2s. c o m*/ * * @param markupStream * The markup stream of this component */ @Override protected void onRender(final MarkupStream markupStream) { final int markupStart = markupStream.getCurrentIndex(); Response response = RequestCycle.get().getResponse(); boolean firstLeft = true; // whether there was no left column rendered // yet boolean rendered = false; for (int i = 0; i < columns.size(); ++i) { IColumn column = columns.get(i); Component component = components.get(i); IRenderable renderable = renderables.get(i); // write wrapping markup response.write("<span class=\"b_\" style=\"" + renderColumnStyle(column) + "\">"); if (column.getLocation().getAlignment() == Alignment.LEFT && firstLeft == true) { // for the first left column we have different style class // (without the left border) response.write("<span class=\"d_\">"); firstLeft = false; } else { if (i == 3) { QueueModel queueModel = (QueueModel) ((DefaultMutableTreeNode) node).getUserObject(); response.write("<span class=\"c_\"" + (queueModel.getColor() == null ? "" : "style=\"background-color: " + queueModel.getColor() + ";\"") + ">"); } else response.write("<span class=\"c_\">"); } if (component != null) { markupStream.setCurrentIndex(markupStart); component.render(markupStream); rendered = true; } else if (renderable != null) { renderable.render(node, response); } else { throw new IllegalStateException( "Either renderable or cell component must be created for this node"); } response.write("</span></span>\n"); } // if no component was rendered just advance in the markup stream if (rendered == false) { markupStream.skipComponent(); } }
From source file:org.devgateway.eudevfin.dim.NavbarInitializer.java
License:Open Source License
@WicketNavbarComponentInitializer(position = Navbar.ComponentPosition.LEFT, order = 0) public static Component newHomePageNavbarButton(final Page page) { final NavbarButton<HomePage> homePageNavbarButton = new NavbarButton<HomePage>( page.getApplication().getHomePage(), new StringResourceModel("navbar.home", page, null, null)) .setIconType(IconType.home); MetaDataRoleAuthorizationStrategy.authorize(homePageNavbarButton, Component.RENDER, AuthConstants.Roles.ROLE_USER); return homePageNavbarButton; }
From source file:org.devgateway.eudevfin.dim.NavbarInitializer.java
License:Open Source License
@WicketNavbarComponentInitializer(position = Navbar.ComponentPosition.RIGHT, order = 6) public static Component newMessagesNavbarButton(final Page page) { final NavbarButton<Messages> homePageNavbarButton = new MessageNavbarButton(Messages.class, Model.of("")); homePageNavbarButton.setIconType(IconType.comment); MetaDataRoleAuthorizationStrategy.authorize(homePageNavbarButton, Component.RENDER, AuthConstants.Roles.ROLE_USER); return homePageNavbarButton; }
From source file:org.devgateway.eudevfin.dim.NavbarInitializer.java
License:Open Source License
@WicketNavbarComponentInitializer(position = Navbar.ComponentPosition.LEFT, order = 1) public static Component newTransactionNavbarButton(final Page page) { final NavbarDropDownButton navbarDropDownButton = new RepairedNavbarDropDownButton( new StringResourceModel("navbar.newTransaction", page, null, null)) { @Override/*w ww. jav a2 s.co m*/ public boolean isActive(final Component item) { return false; } @Override @SuppressWarnings("Convert2Diamond") protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) { final List<AbstractLink> list = new ArrayList<>(); list.add(new MenuHeader(new StringResourceModel("navbar.newTransaction.header", this, null, null))); list.add(new MenuDivider()); final DropDownSubMenu bilateralOda = new DropDownSubMenu( new StringResourceModel("navbar.newTransaction.bilateralOda", this, null, null)) { @Override public boolean isActive(final Component item) { return false; } @Override protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) { final List<String> values = new ArrayList<>(); values.add(SB.BILATERAL_ODA_ADVANCE_QUESTIONNAIRE); values.add(SB.BILATERAL_ODA_CRS); values.add(SB.BILATERAL_ODA_FORWARD_SPENDING); return getTransactionLinks(values, page); } }; bilateralOda.setIconType(IconType.resizehorizontal); list.add(bilateralOda); final DropDownSubMenu multilateralOda = new DropDownSubMenu(Model.of("Multilateral ODA")) { @Override public boolean isActive(final Component item) { return false; } @Override protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) { final List<String> values = new ArrayList<>(); values.add(SB.MULTILATERAL_ODA_ADVANCE_QUESTIONNAIRE); values.add(SB.MULTILATERAL_ODA_CRS); return getTransactionLinks(values, page); } }; multilateralOda.setIconType(IconType.fullscreen); list.add(multilateralOda); final DropDownSubMenu nonOda = new DropDownSubMenu( new StringResourceModel("navbar.newTransaction.nonOda", this, null, null)) { @Override protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) { final List<String> values = new ArrayList<>(); values.add(SB.NON_ODA_OOF_NON_EXPORT); values.add(SB.NON_ODA_OOF_EXPORT); values.add(SB.NON_ODA_PRIVATE_GRANTS); values.add(SB.NON_ODA_PRIVATE_MARKET); values.add(SB.NON_ODA_OTHER_FLOWS); return getTransactionLinks(values, page); } }; nonOda.setIconType(IconType.random); list.add(nonOda); final MenuBookmarkablePageLink<AggregateTransactionsPage> aggregateTransactions = new MenuBookmarkablePageLink<AggregateTransactionsPage>( AggregateTransactionsPage.class, null, new StringResourceModel("navbar.aggregate", page, null)); aggregateTransactions.setIconType(IconType.resizesmall); MetaDataRoleAuthorizationStrategy.authorize(aggregateTransactions, Component.RENDER, AuthConstants.Roles.ROLE_USER); list.add(aggregateTransactions); return list; } }; navbarDropDownButton.setIconType(IconType.plus); navbarDropDownButton.add(new DropDownAutoOpen()); MetaDataRoleAuthorizationStrategy.authorize(navbarDropDownButton, Component.RENDER, AuthConstants.Roles.ROLE_USER); return navbarDropDownButton; }
From source file:org.devgateway.eudevfin.dim.NavbarInitializer.java
License:Open Source License
@WicketNavbarComponentInitializer(position = Navbar.ComponentPosition.RIGHT, order = 20) public static Component newHelpMenu(final Page page) { final NavbarDropDownButton navbarDropDownButton = new NavbarDropDownButton( new StringResourceModel("navbar.help", page, null, null)) { @Override/*from www . j a v a2s. c o m*/ public boolean isActive(final Component item) { return false; } @Override protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) { final List<AbstractLink> list = new ArrayList<>(); list.add(new MenuHeader(new StringResourceModel("navbar.help.header", this, null))); list.add(new MenuDivider()); final MenuBookmarkablePageLink<EmanualPdf> eManualLink = new MenuBookmarkablePageLink<EmanualPdf>( EmanualPdf.class, null, new StringResourceModel("navbar.emanual", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; eManualLink.setIconType(IconType.download); list.add(eManualLink); final MenuBookmarkablePageLink<HelpPage> helpTutorialsPage = new MenuBookmarkablePageLink<HelpPage>( HelpPage.class, null, new StringResourceModel("navbar.help.videotut", page, null)); helpTutorialsPage.setIconType(IconType.download); list.add(helpTutorialsPage); final MenuBookmarkablePageLink<FAQPdf> faqLink = new MenuBookmarkablePageLink<FAQPdf>(FAQPdf.class, null, new StringResourceModel("navbar.faq", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; faqLink.setIconType(IconType.download); list.add(faqLink); final MenuBookmarkablePageLink<RecipientCountriesPdf> recipientCountriesLink = new MenuBookmarkablePageLink<RecipientCountriesPdf>( RecipientCountriesPdf.class, null, new StringResourceModel("navbar.recipientcountries", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; recipientCountriesLink.setIconType(IconType.download); list.add(recipientCountriesLink); final MenuBookmarkablePageLink<LitOfInternationalOrgs> listOfInternationalOrgs = new MenuBookmarkablePageLink<LitOfInternationalOrgs>( LitOfInternationalOrgs.class, null, new StringResourceModel("navbar.listofinternationalorgs", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; listOfInternationalOrgs.setIconType(IconType.download); list.add(listOfInternationalOrgs); final MenuBookmarkablePageLink<DacCrsListCodes> dacCrslistCodes = new MenuBookmarkablePageLink<DacCrsListCodes>( DacCrsListCodes.class, null, new StringResourceModel("navbar.daccrslistcodes", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; dacCrslistCodes.setIconType(IconType.download); list.add(dacCrslistCodes); final MenuBookmarkablePageLink<OecdDacDirectives> oecdDacDirectives = new MenuBookmarkablePageLink<OecdDacDirectives>( OecdDacDirectives.class, null, new StringResourceModel("navbar.oecdacdirectives", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; oecdDacDirectives.setIconType(IconType.download); list.add(oecdDacDirectives); final MenuBookmarkablePageLink<DacGlossary> dacGlossary = new MenuBookmarkablePageLink<DacGlossary>( DacGlossary.class, null, new StringResourceModel("navbar.dacglossary", this, null)) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("target", "_blank"); } }; dacGlossary.setIconType(IconType.download); list.add(dacGlossary); return list; } }; navbarDropDownButton.setIconType(IconType.book); navbarDropDownButton.add(new DropDownAutoOpen()); MetaDataRoleAuthorizationStrategy.authorize(navbarDropDownButton, Component.RENDER, AuthConstants.Roles.ROLE_USER); return navbarDropDownButton; }