public <C extends Page> SimpleBookmarkableLink( String id, Class<C> pageClass, IModel<?> labelModel, PageParameters params) { super(id, labelModel); add(link = new BookmarkablePageLink<Object>("link", pageClass, params)); link.add(label = new Label("label", labelModel)); }
/** * Gets the url to use for this link. * * @return The URL that this link links to * @see org.apache.wicket.markup.html.link.Link#getURL() */ protected CharSequence getURL() { if (pageMapName != null && getPopupSettings() != null) { throw new IllegalStateException("You cannot specify popup settings and a page map"); } PageParameters parameters = getPageParameters(); if (getPopupSettings() != null) { return urlFor(getPopupSettings().getPageMap(this), getPageClass(), parameters); } else { return urlFor(getPageMap(), getPageClass(), parameters); } } }
/** * Gets the url to use for this link. * * @return The URL that this link links to * @see org.apache.wicket.markup.html.link.Link#getURL() */ @Override protected CharSequence getURL() { PageParameters parameters = getPageParameters(); return urlFor(getPageClass(), parameters); } }
private void setParameterImpl(String key, Object value) { PageParameters parameters = getPageParameters(); parameters.put(key, value); this.parameters = pageParametersToMiniMap(parameters); }
protected MarkupContainer newLink(Class<? extends Page> pageClass) { if (pageClass == null) { return new WebMarkupContainer("homeLink"); } return new BookmarkablePageLink<>("homeLink", pageClass); }
private MarkupContainer createHistoryLink(String id, IModel<BoxItemDataMap> boxItemModel) { BoxItemDataMap boxItem = boxItemModel.getObject(); PageParameters pageParameters = new PageParameters(); if (boxItem.getFlowInstanceId() != null) { pageParameters.add(REQUIREMENT_ID, boxItem.getCod()); pageParameters.add(INSTANCE_ID, boxItem.getFlowInstanceId()); pageParameters.add(MODULE_PARAM_NAME, getModule().getCod()); pageParameters.add(MENU_PARAM_NAME, getMenu()); } BookmarkablePageLink<?> historiLink = new BookmarkablePageLink<>(id, getHistoricoPage(), pageParameters); historiLink.setVisible(boxItem.getProcessBeginDate() != null); return historiLink; }
@Override protected void populateItem(ListItem<String> item) { BookmarkablePageLink<String> link; if(item.getModelObject()==null || item.getModelObject().isEmpty()) { link = new BookmarkablePageLink<String>("link", getPageClass()); link.setBody(rootLabel); } else { crumbParams.set(item.getIndex()-1, item.getModelObject()); link = new BookmarkablePageLink<String>("link", getPageClass(), new PageParameters(crumbParams)); link.setBody(item.getModel()); } if(item.getIndex()==segments.size()-1) link.add(new AttributeModifier("class", "active")); item.add(link); } };
Session theSession = getSession(); PageParameters userLinkParams = new PageParameters(); userLink = new BookmarkablePageLink<String>("user-link", SettingsPage.class, userLinkParams); if(username==null) username = user.getName(); userLink.setVisible(true); Url returnUrl = RequestCycle.get().mapUrlFor(getPage().getClass(), getPage().getPageParameters()); BookmarkablePageLink<String> link = new BookmarkablePageLink<String>("link", LoginPage.class, new PageParameters().set("target", returnUrl)); link.add(new Label("link-label", new StringResourceModel(LOGIN_KEY, this,null))); add(link); userLink.setVisible(false); userLink.setBody(Model.of(username)); add(userLink);
@Override protected void populateItem(ListItem item) { Store store = (Store) item.getModelObject(); BookmarkablePageLink link = new BookmarkablePageLink("storeLink", store.getDestinationPage()); link.add(new Label("storeName", store.getStoreName(StoreChooserPage.this))); link.setEnabled(thereAreWorkspaces); item.add(link); item.add(new Label("storeDescription", store.getStoreDescription(StoreChooserPage.this))); Image icon = new Image("storeIcon", store.getStoreIcon()); icon.add(new AttributeModifier("alt", true, store.getStoreDescription(StoreChooserPage.this))); item.add(icon); } };
@Override protected void populateItem(final ListItem<PropertyPair> item) { IModel<PropertyPair> model = item.getModel(); String key = model.getObject().getKey(); Collection<Review> reviewList = reviewModel.getObject().get(key); BookmarkablePageLink<Object> link = new BookmarkablePageLink<Object>("edit",getPage().getClass(),new PageParameters(getPageParameters()).add("key", key)); item.add(link); link.setMarkupId(URLUtil.escapeToIdAttribute(key)); link.setOutputMarkupId(true); link.add(new AttributeModifier("name", link.getMarkupId())); Label keyLabel = new Label("key", key); keyLabel.add(new AttributeModifier("title", model.getObject().getTranslated())); item.add(keyLabel); Label translationLabel = new Label("translation", model.getObject().getTranslated()); translationLabel.add(new AttributeModifier("title", model.getObject().getTranslatedComment())); item.add(translationLabel); fillStatusColumn(model.getObject(), reviewList, item); }
/** * @param id component id * @param model model for contact * @param editClass The edit page to redirect to. * @param objectId The id of the object to edit in edit page. * @param label The label to show (additional to the row_pointer.png). The id of the label should be LABEL_ID. */ public TreeIconsActionPanel(final String id, final IModel< ? > model, final Class< ? extends AbstractEditPage< ? , ? , ? >> editClass, final Integer objectId, final Label label, final TreeTable< ? > treeTable) { super(id, model); this.treeTable = treeTable; final BookmarkablePageLink<Void> bookmarkablePagelink = new BookmarkablePageLink<Void>("select", editClass); bookmarkablePagelink.getPageParameters().add(AbstractEditPage.PARAMETER_KEY_ID, objectId); this.link = bookmarkablePagelink; add(link); add(label); }
public BootstrapSignInPanel(String id, boolean includeRememberMe) { super(id, includeRememberMe); WebMarkupContainer registerContainer = new WebMarkupContainer("register.container"); BookmarkablePageLink<Object> link = new BookmarkablePageLink<Object>("register.link", RegisterPage.class); link.setBody(new StringResourceModel("register.link.label",this,null)); registerContainer.add(link); registerContainer.setVisibilityAllowed(canRegister()); getForm().add(registerContainer); }
public LabelBookmarkablePageLinkPanel(final String id, final Class< ? extends WebPage> pageClass, final String label, final PageParameters params) { this(id, pageClass, params); link.add(new Label("label", label)); }
/** * creates a new brand name button. * * @param componentId The non-null id of a new navigation component * @return a new brand name page link instance */ protected Component newBrandNameLink(String componentId) { BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>(componentId, getHomePage()) { @Override protected void onConfigure() { super.onConfigure(); Component brandLabel = get("brandLabel"); brandLabel.configure(); if (brandLabel.isVisible()) { setVisible(true); } else { Component brandImage = get("brandImage"); brandImage.configure(); setVisible(brandImage.isVisible()); } } }; link.setOutputMarkupPlaceholderTag(true); link.add(newBrandLabel("brandLabel")); link.add(newBrandImage("brandImage")); return link; }
@Override protected void populateItem(ListItem<PropertyListMode> item) { String mode = item.getModelObject().name().toLowerCase(); String anchor = URLUtil.escapeToIdAttribute(mainModel.getObject().getKey()); PageParameters pageParams = new PageParameters(getPageParameters()).clearNamed().set("mode", mode); BookmarkablePageLink<Object> link = new AnchorBookmarkablePageLink<Object>("link", getPage().getClass(), pageParams, anchor); ReviewParticipant participant = item.getModel().getObject().getParticipant(); if(participant!=null) link.setBody(nls(participant.getClass(),participant.getName())); else link.setBody(new StringResourceModel(item.getModelObject().name(),item,null)); item.add(link); link.add(new AttributeModifier("onclick", "return confirmAction()")); if (item.getModelObject().equals(currentMode)) item.add(new AttributeModifier("class", "active")); } };
/** * Asserts that that the BookmarkablePageLink identified by "id" points to the page as expected * - including parameters. * * @param id * @param pageClass * @param parameters */ public void assertBookmarkablePageLink(final String id, final Class<? extends WebPage> pageClass, final String parameters) { BookmarkablePageLink<?> pageLink = null; try { pageLink = (BookmarkablePageLink<?>)getComponentFromLastRenderedPage(id); } catch (ClassCastException e) { throw new IllegalArgumentException("Component with id:" + id + " is not a BookmarkablePageLink"); } Assert.assertEquals("BookmarkablePageLink: " + id + " is pointing to the wrong page", pageClass, pageLink.getPageClass()); Assert.assertEquals( "One or more of the parameters associated with the BookmarkablePageLink: " + id + " do not match", new PageParameters(parameters), pageLink.getPageParameters()); }
@Override public Class<? extends Page> getPageIdentity() { return oldLink.getPageClass(); } }
@Override public final void onSubmit() { run(); BookmarkablePageLink<?> link = (BookmarkablePageLink<?>) get("viewLink"); link.setBody(new Model<String>(storyContext.getOutput())); link.getPageParameters().set("id", storyContext.getOutput()); } }
@Override public PageParameters getPageParameters() { return super.getPageParameters().add("clusterName", getModelObject().getName()); } }
policies.setOutputMarkupPlaceholderTag(true); MetaDataRoleAuthorizationStrategy.authorize(policies, WebPage.ENABLE, StandardEntitlement.POLICY_LIST); actions.add(policies); policies.setVisible( !confCompleteness.get(NumbersInfo.ConfItem.ACCOUNT_POLICY.name()) || !confCompleteness.get(NumbersInfo.ConfItem.PASSWORD_POLICY.name())); notifications.setOutputMarkupPlaceholderTag(true); MetaDataRoleAuthorizationStrategy.authorize( notifications, WebPage.ENABLE, StandardEntitlement.NOTIFICATION_LIST); actions.add(notifications); notifications.setVisible(!confCompleteness.get(NumbersInfo.ConfItem.NOTIFICATION.name())); types.setOutputMarkupPlaceholderTag(true); MetaDataRoleAuthorizationStrategy.authorize(types, WebPage.ENABLE, StandardEntitlement.SCHEMA_LIST); actions.add(types); types.setVisible( !confCompleteness.get(NumbersInfo.ConfItem.VIR_SCHEMA.name()) || !confCompleteness.get(NumbersInfo.ConfItem.ANY_TYPE.name())); securityquestions.setOutputMarkupPlaceholderTag(true); actions.add(securityquestions); securityquestions.setVisible(!confCompleteness.get(NumbersInfo.ConfItem.SECURITY_QUESTION.name())); roles.setOutputMarkupPlaceholderTag(true); MetaDataRoleAuthorizationStrategy.authorize(roles, WebPage.ENABLE, StandardEntitlement.ROLE_LIST); actions.add(roles); roles.setVisible(!confCompleteness.get(NumbersInfo.ConfItem.ROLE.name()));