本文整理汇总了Java中org.apache.wicket.markup.html.link.AbstractLink类的典型用法代码示例。如果您正苦于以下问题:Java AbstractLink类的具体用法?Java AbstractLink怎么用?Java AbstractLink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractLink类属于org.apache.wicket.markup.html.link包,在下文中一共展示了AbstractLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addUserMenu
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
protected Component addUserMenu() {
DropDownButton userMenu = new NavbarDropDownButton(Model.of("Username")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
List<AbstractLink> subMenu = Lists.newArrayList();
subMenu.add(new MenuBookmarkablePageLink<Void>(UserSettingsPage.class,
new ResourceModel("navbar.userMenu.settings"))
.setIconType(FontAwesomeIconType.gear));
subMenu.add(new MenuDivider());
subMenu.add(new MenuBookmarkablePageLink<Void>(LogOutPage.class,
new ResourceModel("navbar.userMenu.logout"))
.setIconType(FontAwesomeIconType.power_off));
return subMenu;
}
}.setIconType(FontAwesomeIconType.user);
return userMenu;
}
示例2: addUserInfo
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
private void addUserInfo() {
// Enable only for signed in users
SamlAddon samlAddon = addonsManager.addonByType(SamlAddon.class);
AbstractLink logoutLink = samlAddon.getLogoutLink("logoutPage");
add(logoutLink);
// Enable only if signed in as anonymous
AbstractLink loginLink = samlAddon.getLoginLink("loginPage");
add(loginLink);
// logged in or not logged in
add(new Label("loggedInLabel", getLoggedInMessage()));
// update profile link
WebApplicationAddon applicationAddon = addonsManager.addonByType(WebApplicationAddon.class);
AbstractLink profileLink = applicationAddon.getProfileLink("profilePage");
add(profileLink);
}
示例3: addLinks
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
@Override
protected void addLinks(List<AbstractLink> links, final UserModel userModel, String linkId) {
//Do not add the delete and edit links to the anonymous user
if (!userModel.isAnonymous()) {
super.addLinks(links, userModel, linkId);
}
// add view user permissions link
ModalShowLink viewPermissionsLink = new ModalShowLink(linkId, "Permissions") {
@Override
protected BaseModalPanel getModelPanel() {
return newViewUserPermissionsPanel(userModel);
}
};
viewPermissionsLink.add(new CssClass("icon-link"));
viewPermissionsLink.add(new CssClass("ViewUserPermissionsAction"));
links.add(viewPermissionsLink);
}
示例4: addRepoList
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
/**
* Adds a list of virtual repositories, using a RepoAwareActionableItem for information
*
* @param item The selected item from the tree
*/
private void addRepoList(final RepoAwareActionableItem item) {
RepositoryService repositoryService = ContextHelper.get().getRepositoryService();
List<VirtualRepoDescriptor> reposToDisplay = repositoryService.getVirtualReposContainingRepo(item.getRepo());
add(new ListView<VirtualRepoDescriptor>("items", reposToDisplay) {
@Override
protected void populateItem(ListItem<VirtualRepoDescriptor> virtualRepo) {
VirtualRepoDescriptor virtualRepoDescriptor = virtualRepo.getModelObject();
final String hrefPrefix = RequestUtils.getWicketServletContextUrl();
String path = getRepoPath(item);
String href = hrefPrefix + "/" + virtualRepoDescriptor.getKey() + "/" + path;
if (!href.endsWith("/")) {
href += "/";
}
AbstractLink link = new ExternalLink("link", href, virtualRepoDescriptor.getKey());
link.add(new CssClass("repository-virtual"));
virtualRepo.add(link);
}
});
}
示例5: addLinks
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
protected void addLinks(List<AbstractLink> links, final T itemObject, String linkId) {
// add edit link
TitledAjaxLink editLink = getEditItemLink(itemObject, linkId);
editLink.add(new CssClass("icon-link"));
editLink.add(new CssClass("UpdateAction"));
links.add(editLink);
// add delete link
if (canAddDeleteItemLink(itemObject)) {
TitledAjaxLink deleteLink = new TitledAjaxLink(linkId, "Delete") {
@Override
public void onClick(AjaxRequestTarget target) {
deleteItem(itemObject, target);
target.add(BaseListPanel.this);
}
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new ConfirmationAjaxCallDecorator(getDeleteConfirmationText(itemObject));
}
};
deleteLink.add(new CssClass("icon-link"));
deleteLink.add(new CssClass("DeleteAction"));
links.add(deleteLink);
}
}
示例6: addLinkFor
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
public LinksPanel addLinkFor(final Class<? extends Page> pageClass) {
WebMarkupContainer item = new WebMarkupContainer(repeatingView.newChildId());
repeatingView.add(item);
String className = pageClass.getSimpleName();
ResourceModel linkTitleModel = new ResourceModel(className, className);
AbstractLink link = new TitledAjaxLink(LINK_ID, linkTitleModel) {
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(pageClass);
}
};
item.add(link);
return this;
}
示例7: getLocaleChangeLink
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
private AbstractLink getLocaleChangeLink(final Language language) {
Locale locale = language.getLocale();
PageParameters params = new PageParameters(
containingPage.getPageParameters());
params.remove("lang");
params.add("lang", language.getLocale().getLanguage());
BootstrapBookmarkablePageLink<Page> link = new MenuBookmarkablePageLink<Page>(
containingPage.getPageClass(), params, Model.of(locale
.getDisplayLanguage(locale))).setIconType(new IconType(
"please-ignore-me"));
link.add(new CssClassNameAppender("language ", locale.getLanguage()));
if (Language.fromSession().equals(language)) {
link.add(new CssClassNameAppender("active"));
}
return link;
}
示例8: getLink
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
@Override
public AbstractLink getLink(String id) {
return new AjaxLink<Void>(id) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (widget.hasSettings()) {
WidgetPanel widgetPanel = findParent(WidgetPanel.class);
Panel settingsPanel = widgetPanel.getSettingsPanel();
settingsPanel.setVisible(true);
target.add(settingsPanel);
}
}
};
}
示例9: onInitialize
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
if(pageClass!=null){
AbstractLink link = new BookmarkablePageLink<WebPage>("link", pageClass);
add(link);
}
add(new Behavior() {
@Override
public void onComponentTag(Component component, ComponentTag tag) {
super.onComponentTag(component, tag);
if(isActive()) tag.append("class", "active", " ");
}
});
}
示例10: createNavbarContents
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
@Override
protected void createNavbarContents(Navbar navbar) {
NavbarButton<Page> edit = new NavbarButton<Page>(EditProductPage.class, getResolver().expand(getModel().getObject()), Model.of("Edit"));
edit.setIconType(GlyphIconType.edit);
NavbarDropDownButton create = new NavbarDropDownButton(Model.of("Create")) {
@Override
protected List<AbstractLink> newSubMenuButtons(String buttonMarkupId) {
List<AbstractLink> submenus = new ArrayList<>();
BookmarkablePageLink<EditVersionPage> createHotfix = new BookmarkablePageLink<EditVersionPage>(buttonMarkupId,EditVersionPage.class,getResolver().expand(getModel().getObject()));
createHotfix.setBody(Model.of("Hotfix"));
submenus.add(createHotfix);
BookmarkablePageLink<EditVersionPage> createVersion = new BookmarkablePageLink<EditVersionPage>(buttonMarkupId,EditVersionPage.class,getResolver().expand(getModel().getObject()));
createVersion.setBody(Model.of("Version"));
submenus.add(createVersion);
return submenus;
}
};
create.setIconType(GlyphIconType.plus);
navbar.addComponents(NavbarComponents.transform(Navbar.ComponentPosition.LEFT, edit, create));
}
示例11: newSubmitButton
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
/**
* Creates a new submit button, can be overridden by subclasses to provide their own submit button. By default, this
* is a JsButton that triggers the submit event on the provided form.
*
* @param id the button component id
* @param model the model object
* @param formComponent the form
* @return a new submit button
*/
protected AbstractLink newSubmitButton(String id, IModel<T> model, final Form<T> formComponent) {
return new JsLink(id) {
private static final long serialVersionUID = 1L;
@Override
protected void onInitialize() {
super.onInitialize();
add(new ButtonBehavior(Buttons.Type.PRIMARY));
}
@Override
public IJavaScript onClick() {
return $(formComponent).call("submit");
}
}.setBody(getSubmitButtonModel());
}
示例12: newDropDownButton
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
/**
* Creates the drop-down button that stores the actions.
*
* @param componentId the component id for the button
* @param rowModel the model of the row the button is created for
* @param cell the actual cell item
* @return a new drop down button
*/
protected DropDownButton newDropDownButton(String componentId, final IModel<T> rowModel,
final DataTableCell<T, S> cell) {
return new DropDownButton(componentId, getButtonDisplayModel(), getButtonIconTypeModel()) {
private static final long serialVersionUID = 1L;
@Override
protected List<AbstractLink> newSubMenuButtons(String id) {
return createActions(id, rowModel, cell);
}
@Override
protected void onInitialize() {
super.onInitialize();
onDropDownButtonInitialize(this, rowModel);
}
};
}
示例13: hasActiveButton
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
/**
* checks whether there is a button that is active or not.
*
* @param activeButton the current active button
* @return true, if at least one button of button list is active
*/
public final boolean hasActiveButton(final Component activeButton) {
final Class<? extends Page> pageClass = activeButton.getPage().getPageClass();
for (final AbstractLink link : getList()) {
if (link instanceof IActivatable) {
if (((IActivatable) link).isActive(activeButton)) {
return true;
}
} else if (link instanceof BookmarkablePageLink) {
if (((BookmarkablePageLink<?>) link).getPageClass().equals(pageClass)) {
return true;
}
}
}
return false;
}
示例14: getColumns
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
@Override
protected List<IColumn<Person, String>> getColumns() {
IColumn<Person, String> column = new ActionsColumn<Person, String>(Model.of("Links"), Model.of("Dropdown")) {
private static final long serialVersionUID = 1L;
@Override
protected List<AbstractLink> createActions(String id, IModel<Person> rowModel,
DataTableCell<Person, String> cell) {
return Arrays.asList(
new BookmarkablePageLink<>(id, DummyHomePage.class).setBody(Model.of("HomeLink")),
new BookmarkablePageLink<>(id, DummyPanelPage.class).setBody(Model.of("PanelLink")));
}
};
return Arrays.asList(column);
}
示例15: setUp
import org.apache.wicket.markup.html.link.AbstractLink; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
dropDownButton = new DropDownButton("dropdown-button", Model.of("Model")) {
private static final long serialVersionUID = 1L;
@Override
protected List<AbstractLink> newSubMenuButtons(String buttonMarkupId) {
button1 = new BookmarkablePageButton<>(buttonMarkupId, DummyHomePage.class);
button2 = new BookmarkablePageButton<>(buttonMarkupId, DummyPanelPage.class);
button1.setBody(Model.of("Button 1")).setOutputMarkupId(true).setMarkupId("button-1");
button2.setBody(Model.of("Button 2")).setOutputMarkupId(true).setMarkupId("button-2");
return Arrays.asList(button1, button2);
}
};
dropDownButton.setOutputMarkupId(true).setMarkupId("dropdown-button");
container = renderAndCreateTag(dropDownButton);
}