org.apache.wicket.markup.html.link.BookmarkablePageLink Java Examples
The following examples show how to use
org.apache.wicket.markup.html.link.BookmarkablePageLink.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VizigatorLinkFunctionBoxPanel.java From ontopia with Apache License 2.0 | 6 votes |
@Override protected Component getLink(String id) { PageParameters pageParameters = new PageParameters(); pageParameters.put("topicMapId", getTopicMapId()); pageParameters.put("topicId", getTopicId()); return new BookmarkablePageLink<Page>(id, VizigatorPage.class, pageParameters) { @Override protected void onComponentTag(ComponentTag tag) { tag.setName("a"); //tag.put("target", "_blank"); super.onComponentTag(tag); } @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, new ResourceModel("vizigator.text2").getObject().toString()); } }; }
Example #2
Source File: LogoutPanel.java From webanno with Apache License 2.0 | 6 votes |
public LogoutPanel(String id) { super(id); add(new StatelessLink<Void>("logout") { private static final long serialVersionUID = -4031945370627254798L; @Override public void onClick() { AuthenticatedWebSession.get().signOut(); getSession().invalidate(); setResponsePage(getApplication().getHomePage()); } }); String username = Optional.ofNullable(userRepository.getCurrentUser()) .map(User::getUsername).orElse(""); BookmarkablePageLink<Void> profileLink = new BookmarkablePageLink<>("profile", ManageUsersPage.class, new PageParameters().add( ManageUsersPage.PARAM_USER, username)); profileLink.add(enabledWhen(SecurityUtil::isProfileSelfServiceAllowed)); profileLink.add(visibleWhen(() -> isNotBlank(username))); profileLink.add(new Label("username", username)); add(profileLink); WebMarkupContainer logoutTimer = new WebMarkupContainer("logoutTimer"); logoutTimer.add(visibleWhen(() -> getAutoLogoutTime() > 0)); add(logoutTimer); }
Example #3
Source File: HistoryAwarePagingNavigator.java From onedev with MIT License | 6 votes |
@Override protected AbstractLink newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { AbstractLink link; if (pagingHistorySupport != null) { int pageNumber = (int) pageable.getCurrentPage() + increment; link = new BookmarkablePageLink<Void>(id, getPage().getClass(), pagingHistorySupport.newPageParameters(pageNumber)) { @Override protected void onConfigure() { super.onConfigure(); setEnabled(pageNumber >= 0 && pageNumber < getPageable().getPageCount()); } }; link.add(new DisabledAttributeLinkBehavior()); } else { link = new PagingNavigationIncrementLink<Void>(id, pageable, increment); } return link; }
Example #4
Source File: HistoryAwarePagingNavigator.java From onedev with MIT License | 6 votes |
@Override protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { AbstractLink link; int absolutePageNumber; if (pageNumber == -1) absolutePageNumber = (int) (getPageable().getPageCount()-1); else absolutePageNumber = pageNumber; if (pagingHistorySupport != null) { link = new BookmarkablePageLink<Void>(id, getPage().getClass(), pagingHistorySupport.newPageParameters(absolutePageNumber)) { @Override protected void onConfigure() { super.onConfigure(); setEnabled(absolutePageNumber != pageable.getCurrentPage()); } }; link.add(new DisabledAttributeLinkBehavior()); } else { link = new PagingNavigationLink<Void>(id, pageable, pageNumber); } return link; }
Example #5
Source File: NavigationPanel.java From AppStash with Apache License 2.0 | 6 votes |
private WebMarkupContainer navigationLink(NavigationEntry navigationEntry) { String navigationEntryPageClassName = navigationEntry.getPageClass().getName(); if (((ShopSession) ShopSession.get()).isMicroServiceMode()) { switch (navigationEntryPageClassName) { case "io.github.zutherb.appstash.shop.ui.page.catalog.ProductCatalogPage": return new ExternalLink("link", new ProductCatalogPageStringResourceModel(new StringResourceModel(navigationEntryPageClassName, this, null), Model.of(navigationEntry))); default: return new ExternalLink("link", new StringResourceModel(navigationEntryPageClassName, this, null)); } } if (((ShopSession) ShopSession.get()).isDockerMode()) { String resourceKey = "docker." + navigationEntryPageClassName; switch (navigationEntryPageClassName) { case "io.github.zutherb.appstash.shop.ui.page.catalog.ProductCatalogPage": return new ExternalLink("link", new ProductCatalogPageStringResourceModel(new StringResourceModel(resourceKey, this, null), Model.of(navigationEntry))); default: return new ExternalLink("link", new StringResourceModel(resourceKey, this, null)); } } return new BookmarkablePageLink<>("link", navigationEntry.getPageClass(), navigationEntry.getPageParameters()); }
Example #6
Source File: FooterPanel.java From artifact-listener with Apache License 2.0 | 6 votes |
public FooterPanel(String id) { super(id); add(new Label("smile", new StringResourceModel("footer.links.smile", Model.of(ExternalLinks.get(configurer)))).setEscapeModelStrings(false)); add(new BookmarkablePageLink<Void>("aboutLink", AboutPage.class)); WebMarkupContainer gitHubProjectContainer = new WebMarkupContainer("gitHubProjectContainer") { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); setVisible(StringUtils.hasText(ExternalLinks.get(configurer).getGitHubProject())); } }; add(gitHubProjectContainer); gitHubProjectContainer.add(new Label("gitHubProject", new StringResourceModel("footer.links.gitHubProject", Model.of(ExternalLinks.get(configurer)))).setEscapeModelStrings(false)); add(new Label("twitter", new StringResourceModel("footer.links.twitter", Model.of(ExternalLinks.get(configurer)))).setEscapeModelStrings(false)); add(new ObfuscatedEmailLink("contactUsLink", Model.of(configurer.getLinkContactUs()))); add(new ExternalLink("smileLink", configurer.getLinkSmile())); }
Example #7
Source File: NavigationPanel.java From the-app with Apache License 2.0 | 6 votes |
private WebMarkupContainer navigationLink(NavigationEntry navigationEntry) { String navigationEntryPageClassName = navigationEntry.getPageClass().getName(); if (((ShopSession) ShopSession.get()).isMicroServiceMode()) { switch (navigationEntryPageClassName) { case "io.github.zutherb.appstash.shop.ui.page.catalog.ProductCatalogPage": return new ExternalLink("link", new ProductCatalogPageStringResourceModel(new StringResourceModel(navigationEntryPageClassName, this, null), Model.of(navigationEntry))); default: return new ExternalLink("link", new StringResourceModel(navigationEntryPageClassName, this, null)); } } if (((ShopSession) ShopSession.get()).isDockerMode()) { String resourceKey = "docker." + navigationEntryPageClassName; switch (navigationEntryPageClassName) { case "io.github.zutherb.appstash.shop.ui.page.catalog.ProductCatalogPage": return new ExternalLink("link", new ProductCatalogPageStringResourceModel(new StringResourceModel(resourceKey, this, null), Model.of(navigationEntry))); default: return new ExternalLink("link", new StringResourceModel(resourceKey, this, null)); } } return new BookmarkablePageLink<>("link", navigationEntry.getPageClass(), navigationEntry.getPageParameters()); }
Example #8
Source File: LinksSupportImpl.java From yes-cart with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public Link newRemoveFromWishListLink(final String linkId, final String supplier, final String skuCode, final Long itemId, final Class<Page> target, final PageParameters pageParameters) { final PageParameters params = getFilteredCurrentParameters(pageParameters); params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST, skuCode); params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier); params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST_P_ID, itemId); return new BookmarkablePageLink(linkId, target, params); }
Example #9
Source File: SchemaPageHeader.java From Orienteer with Apache License 2.0 | 6 votes |
public SchemaPageHeader(String id, IModel<OClass> oClassModel) { super(id, oClassModel); add(new BookmarkablePageLink<Object>("schema", SchemaPage.class) .setBody(new ResourceModel("menu.list.schema"))); add(new ListView<OClass>("classes", classPathModel) { @Override protected void populateItem(ListItem<OClass> item) { item.add(new OClassPageLink("link", item.getModel()).setClassNameAsBody(false)); } }); childRepeatingView = new RepeatingView("child"); add(childRepeatingView); add(UpdateOnActionPerformedEventBehavior.INSTANCE_ALWAYS_FOR_CHANGING); add(new DefaultPageHeaderMenu("menu")); }
Example #10
Source File: LinksSupportImpl.java From yes-cart with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public Link newAddToCartLink(final String linkId, final String supplier, final String skuCode, final String quantity, final String wishlistId, final Class<Page> target, final PageParameters pageParameters) { final PageParameters params = getFilteredCurrentParameters(pageParameters); params.set(ShoppingCartCommand.CMD_ADDTOCART, skuCode); params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier); params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST, skuCode); params.set(ShoppingCartCommand.CMD_REMOVEFROMWISHLIST_P_ID, wishlistId); if (quantity != null) { // null quantity will pick min from product params.set(ShoppingCartCommand.CMD_P_QTY, quantity); } return new BookmarkablePageLink(linkId, target, params); }
Example #11
Source File: LinksSupportImpl.java From yes-cart with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public Link newAddToCartLink(final String linkId, final String supplier, final String skuCode, final String quantity, final PageParameters pageParameters) { final PageParameters params = getFilteredCurrentParameters(pageParameters); params.set(ShoppingCartCommand.CMD_ADDTOCART, skuCode); params.set(ShoppingCartCommand.CMD_P_SUPPLIER, supplier); if (quantity != null) { // null quantity will pick min from product params.set(ShoppingCartCommand.CMD_P_QTY, quantity); } return new BookmarkablePageLink(linkId, getHomePage(), params); }
Example #12
Source File: UserRequestFormsWidget.java From syncope with Apache License 2.0 | 5 votes |
@Override protected AbstractLink getEventsLink(final String linkid) { BookmarkablePageLink<UserRequests> userRequests = BookmarkablePageLinkBuilder.build(linkid, UserRequests.class); MetaDataRoleAuthorizationStrategy.authorize( userRequests, WebPage.ENABLE, FlowableEntitlement.USER_REQUEST_FORM_LIST); return userRequests; }
Example #13
Source File: ConsoleNotificationIndexPage.java From artifact-listener with Apache License 2.0 | 5 votes |
public ConsoleNotificationIndexPage(PageParameters parameters) { super(parameters); addHeadPageTitleKey("console.notifications"); add(new ListView<PageProvider>("notifications", getNotificationPages()) { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override protected void populateItem(ListItem<PageProvider> item) { Class<? extends Page> pageClass = (Class<? extends Page>) item.getModelObject().getPageClass(); Link<Void> link = new BookmarkablePageLink<Void>("link", pageClass); link.add(new Label("label", new ResourceModel("console.notifications." + pageClass.getSimpleName(), pageClass.getSimpleName()))); item.add(link); } }); add(new WebMarkupContainer("emptyList") { private static final long serialVersionUID = 6700720373087584498L; @Override public boolean isVisible() { return getNotificationPages().isEmpty(); } }); }
Example #14
Source File: MenuItem.java From sakai with Educational Community License v2.0 | 5 votes |
public MenuItem(String id, IModel itemText, Class itemPageClass, PageParameters pageParameters, boolean first, Class menusCurrentPageClass) { super(id); boolean currentPage = itemPageClass.equals(menusCurrentPageClass); // link version menuItemLinkHolder = new WebMarkupContainer("menuItemLinkHolder"); menuItemLink = new BookmarkablePageLink("menuItemLink", itemPageClass, pageParameters); menuLinkText = new Label("menuLinkText", itemText); menuLinkText.setRenderBodyOnly(true); menuItemLink.add(menuLinkText); menuItemLinkHolder.add(menuItemLink); menuItemLinkHolder.setVisible(!currentPage); add(menuItemLinkHolder); // span version menuItemLabel = new Label("menuItemLabel", itemText); menuItemLabel.setVisible(currentPage); add(menuItemLabel); //add current page styling AttributeModifier currentPageStyling = new AttributeModifier("class", new Model("current")); if(currentPage) { menuItemLabel.add(currentPageStyling); } if(first) { add(new AttributeModifier("class", new Model("firstToolBarItem"))); } }
Example #15
Source File: SiteLinkPanel.java From sakai with Educational Community License v2.0 | 5 votes |
public SiteLinkPanel(String id, IModel model) { super(id); final String siteId = ((Site) model.getObject()).getId(); final String siteTitle = ((Site) model.getObject()).getTitle(); PageParameters param = new PageParameters().set("siteId", siteId); BookmarkablePageLink link = new BookmarkablePageLink("link", OverviewPage.class, param); link.add(new Label("label", siteTitle)); add(link); }
Example #16
Source File: MenuItem.java From sakai with Educational Community License v2.0 | 5 votes |
public MenuItem(String id, IModel itemText, Class itemPageClass, PageParameters pageParameters, boolean first, Class menusCurrentPageClass) { super(id); boolean currentPage = itemPageClass.equals(menusCurrentPageClass); // link version menuItemLinkHolder = new WebMarkupContainer("menuItemLinkHolder"); menuItemLink = new BookmarkablePageLink("menuItemLink", itemPageClass, pageParameters); menuLinkText = new Label("menuLinkText", itemText); menuLinkText.setRenderBodyOnly(true); menuItemLink.add(menuLinkText); menuItemLinkHolder.add(menuItemLink); menuItemLinkHolder.setVisible(!currentPage); add(menuItemLinkHolder); // span version menuItemLabel = new Label("menuItemLabel", itemText); menuItemLabel.setVisible(currentPage); add(menuItemLabel); //add current page styling AttributeModifier currentPageStyling = new AttributeModifier("class", new Model("current")); if(currentPage) { menuItemLabel.add(currentPageStyling); } if(first) { add(new AttributeModifier("class", new Model("firstToolBarItem"))); } }
Example #17
Source File: BookmarkablePageLinkBuilder.java From syncope with Apache License 2.0 | 5 votes |
public static <T extends BasePage> BookmarkablePageLink<T> build( final String key, final String id, final Class<T> defaultPageClass) { @SuppressWarnings("unchecked") Class<T> pageClass = (Class<T>) SyncopeWebApplication.get().getPageClass(key); return new BookmarkablePageLink<>( id, Optional.ofNullable(pageClass).orElse(defaultPageClass)); }
Example #18
Source File: BookmarkablePageLinkCommand.java From Orienteer with Apache License 2.0 | 5 votes |
@Override protected AbstractLink newLink(String id) { return new BookmarkablePageLink<T>(id, pageClass) { @Override public PageParameters getPageParameters() { return BookmarkablePageLinkCommand.this.getPageParameters(); } }; }
Example #19
Source File: CheckoutPage.java From AppStash with Apache License 2.0 | 5 votes |
private Component backToShopLink() { return new BookmarkablePageLink<Void>("backToShopLink", HomePage.class) { @Override protected void onBeforeRender() { super.onBeforeRender(); setVisible(isReadOnly()); } }; }
Example #20
Source File: NavigationPanel.java From AppStash with Apache License 2.0 | 5 votes |
private Component homePageLink() { BookmarkablePageLink<Void> pageLink = new BookmarkablePageLink<>("home", ShopApplication.get().getHomePage()); pageLink.add(new AttributeAppender("class", Model.of("homePageLink"), " ")); if (((ShopSession) ShopSession.get()).isMicroServiceMode()) { return new ExternalLink("home", "http://shop.microservice.io"); } return pageLink; }
Example #21
Source File: SpringSecurityAuthorizationStrategy.java From AppStash with Apache License 2.0 | 5 votes |
@Override public boolean isActionAuthorized(Component component, Action action) { Class<? extends Component> componentClass = component.getClass(); if (hasSpringSecuredAnnotation(componentClass)) { return isAuthorized(componentClass); } if (component instanceof BookmarkablePageLink) { BookmarkablePageLink<?> pageLink = (BookmarkablePageLink<?>) component; Class<? extends Page> pageClass = pageLink.getPageClass(); if (hasSpringSecuredAnnotation(pageClass)) { return isAuthorized(pageClass); } } return true; }
Example #22
Source File: SiteLinkPanel.java From sakai with Educational Community License v2.0 | 5 votes |
public SiteLinkPanel(String id, IModel model) { super(id); final String siteId = ((Site) model.getObject()).getId(); final String siteTitle = ((Site) model.getObject()).getTitle(); PageParameters param = new PageParameters().set("siteId", siteId); BookmarkablePageLink link = new BookmarkablePageLink("link", OverviewPage.class, param); link.add(new Label("label", siteTitle)); add(link); }
Example #23
Source File: MyAccountEditPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public MyAccountEditPage(final PageParameters parameters) { super(parameters, "user.myAccount"); if (Login.getInstance().isPasswordChangeSupported(getUser()) == true) { final BookmarkablePageLink<Void> showChangePasswordLink = new BookmarkablePageLink<Void>("link", ChangePasswordPage.class); final ContentMenuEntryPanel menu = new ContentMenuEntryPanel(getNewContentMenuChildId(), showChangePasswordLink, getString("menu.changePassword")); addContentMenuEntry(menu); } final PFUserDO loggedInUser = userDao.internalGetById(PFUserContext.getUserId()); super.init(loggedInUser); this.showHistory = false; }
Example #24
Source File: CustomerListPage.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
private AbstractColumn<Customer, CustomerSort> actionColumn() { return new AbstractColumn<Customer, CustomerSort>(Model.of("Action")) { @Override public void populateItem(Item<ICellPopulator<Customer>> cellItem, String componentId, IModel<Customer> rowModel) { List<AbstrractActionItem> abstractItems = new ArrayList<>(); PageParameters params = new PageParameters(); params.add(CustomerEditPage.CUSTOMER_ID_PARAM, rowModel.getObject().getId()); params.add(CustomerEditPage.PAGE_REFERENCE_ID, getPageId()); abstractItems.add(new ActionItemLink(Model.of("edit"), IconType.EDIT, new BookmarkablePageLink<Customer>("link", CustomerEditPage.class, params ))); abstractItems.add(new YesNoLink<String>(Model.of("xx"), IconType.DELETE) { @Override protected void yesClicked(AjaxRequestTarget target) { customerRepositoryService.delete(rowModel.getObject().getId()); setResponsePage(CustomerListPage.this); } }); ActionPanel actionPanel = new ActionPanel(componentId, abstractItems); cellItem.add(actionPanel); } }; }
Example #25
Source File: CustomerListPage.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
public CustomerListPage() { FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); add(feedbackPanel); add(new WebSocketBehavior() { @Override protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) { if (message instanceof CustomerChangedEvent) { CustomerChangedEvent event = (CustomerChangedEvent)message; info("changed/created " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); handler.add(feedbackPanel); } } }); customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter()); CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel); queue(new BookmarkablePageLink<Customer>("create", CustomerCreatePage.class)); queue(new ValidationForm<>("form", customerFilterModel)); queue(new LabeledFormBorder<>(getString("id"), new TextField<>("id"))); queue(new LabeledFormBorder<>(getString("username"), new UsernameSearchTextField("usernameLike"))); queue(new LabeledFormBorder<>(getString("firstname"), new TextField<String>("firstnameLike").add(StringValidator.minimumLength(3)))); queue(new LabeledFormBorder<>(getString("lastname"), new TextField<String>("lastnameLike").add(StringValidator.minimumLength(3)))); queue(new LabeledFormBorder<>(getString("active"), new CheckBox("active"))); queue(cancelButton()); customerDataTable(customerDataProvider); }
Example #26
Source File: TreeIconsActionPanel.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @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); }
Example #27
Source File: TemplatePage.java From etcd-viewer with Apache License 2.0 | 5 votes |
private <C extends Page> WebMarkupContainer createMenuItem(String menuId, String linkId, final Class<C> pageClass) { WebMarkupContainer menuItem = new WebMarkupContainer(menuId) { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); if (getPageClass().equals(pageClass)) { add(AttributeAppender.append("class", "active")); } } }; menuItem.add(new BookmarkablePageLink<>(linkId, pageClass)); return menuItem; }
Example #28
Source File: ProjektListPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override protected void init() { dataTable = createDataTable(createColumns(this, true), "kost", SortOrder.ASCENDING); form.add(dataTable); final BookmarkablePageLink<Void> addTemplatesLink = UserPrefListPage.createLink("link", UserPrefArea.PROJEKT_FAVORITE); final ContentMenuEntryPanel menuEntry = new ContentMenuEntryPanel(getNewContentMenuChildId(), addTemplatesLink, getString("favorites")); addContentMenuEntry(menuEntry); }
Example #29
Source File: CustomerListPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override protected void init() { dataTable = createDataTable(createColumns(this, true), "kost", SortOrder.ASCENDING); form.add(dataTable); final BookmarkablePageLink<Void> addTemplatesLink = UserPrefListPage.createLink(ContentMenuEntryPanel.LINK_ID, UserPrefArea.KUNDE_FAVORITE); final ContentMenuEntryPanel menuEntry = new ContentMenuEntryPanel(getNewContentMenuChildId(), addTemplatesLink, getString("favorites")); addContentMenuEntry(menuEntry); }
Example #30
Source File: ToDoListPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override protected void init() { dataTable = createDataTable(createColumns(this, true), "lastUpdate", SortOrder.DESCENDING); form.add(dataTable); final BookmarkablePageLink<Void> addTemplatesLink = UserPrefListPage.createLink("link", ToDoPlugin.USER_PREF_AREA); final ContentMenuEntryPanel menuEntry = new ContentMenuEntryPanel(getNewContentMenuChildId(), addTemplatesLink, getString("templates")); addContentMenuEntry(menuEntry); }