當前位置: 首頁>>代碼示例>>Java>>正文


Java Link.add方法代碼示例

本文整理匯總了Java中org.apache.wicket.markup.html.link.Link.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Link.add方法的具體用法?Java Link.add怎麽用?Java Link.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.wicket.markup.html.link.Link的用法示例。


在下文中一共展示了Link.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAddLocationLink

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
private void createAddLocationLink() {
    Link<Void> link = new Link<Void>("addLocation") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            LocationAddPage page = new LocationAddPage(LocationViewPage.this, current);
            setResponsePage(page);
        }
    };
    if (LocationUtil.isTrash(current)) {
        link.setEnabled(false);
        link.setVisible(false);
    }

    LocationType type = LocationType.getByCaption(LocationRenderer.getLocationType(current));
    if (LocationType.RACK.equals(type)) {
        link.add(new Label("label", ""));
    } else {
        link.add(new Label("label", "Add child location"));
    }
    add(link);
}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:24,代碼來源:LocationViewPage.java

示例2: addFacetValue

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
/**
 * Adds an individual facet value selection link to a dataview item
 *
 * @param item item to add link to
 */
private void addFacetValue(String id, final ListItem<Count> item) {
    item.setDefaultModel(new CompoundPropertyModel<>(item.getModel()));

    // link to select an individual facet value
    final Link selectLink = new IndicatingAjaxFallbackLink(id) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            // reset filter
            ((NameAndCountFieldValuesFilter) filterModel.getObject()).setName(null);

            // call callback
            onValuesSelected(
                    // for now only single values can be selected
                    Collections.singleton(item.getModelObject().getName()),
                    target);
        }
    };
    item.add(selectLink);

    // 'name' field from Count (name of value)
    selectLink.add(new FieldValueLabel("name", fieldNameModel));
    // 'count' field from Count (document count for value)
    selectLink.add(new Label("count"));
}
 
開發者ID:acdh-oeaw,項目名稱:vlo-curation,代碼行數:31,代碼來源:FacetValuesPanel.java

示例3: AjaxFallbackLinkLabel

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
public AjaxFallbackLinkLabel(String id, IModel<T> linkModel, IModel<?> contentModel, boolean indicator) {
    super(id);
    final Link link;
    if (indicator) {
        link = new IndicatingAjaxFallbackLink<T>("link", linkModel) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                AjaxFallbackLinkLabel.this.onClick(target);
            }
        };
    } else {
        link = new AjaxFallbackLink<T>("link", linkModel) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                AjaxFallbackLinkLabel.this.onClick(target);
            }
        };
    }
    add(link);

    link.add(new Label("content", contentModel));
}
 
開發者ID:acdh-oeaw,項目名稱:vlo-curation,代碼行數:25,代碼來源:AjaxFallbackLinkLabel.java

示例4: LinkBreadCrumbElementPanel

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
public LinkBreadCrumbElementPanel(String id, BreadCrumbElement breadCrumbElement, BreadCrumbMarkupTagRenderingBehavior renderingBehavior) {
	super(id, breadCrumbElement.getLabelModel());
	
	Link<Void> breadCrumbLink = new BookmarkablePageLink<Void>("breadCrumbElementLink", breadCrumbElement.getPageClass(),
			breadCrumbElement.getPageParameters()) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			
			setVisible(Session.get().getAuthorizationStrategy().isInstantiationAuthorized(getPageClass()));
		}
	};
	breadCrumbLink.setBody(getModel());
	breadCrumbLink.add(renderingBehavior);
	add(breadCrumbLink);
	
	add(
			Condition.componentVisible(breadCrumbLink).thenShowInternal()
	);
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:23,代碼來源:LinkBreadCrumbElementPanel.java

示例5: populateItem

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
@SuppressWarnings({"unchecked"})
@Override
public void populateItem(final Item cellItem, String componentId, IModel model) {
    final ActionableArchiveSearchResult result =
            (ActionableArchiveSearchResult) cellItem.getParent().getParent().getDefaultModelObject();
    final String relDirPath = result.getSearchResult().getRelDirPath();
    Link linkToTreeView = new Link<String>(componentId, Model.of(relDirPath)) {
        @Override
        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
            replaceComponentTagBody(markupStream, openTag, relDirPath);
        }

        @Override
        public void onClick() {
            RequestCycle.get().setResponsePage(new BrowseRepoPage(result.getArchiveRepoPath()));
        }
    };
    linkToTreeView.add(new CssClass("item-link"));
    cellItem.add(linkToTreeView);
}
 
開發者ID:alancnet,項目名稱:artifactory,代碼行數:21,代碼來源:ArchiveSearchPanel.java

示例6: productDetailImageLink

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
private Component productDetailImageLink() {
    Link<Void> detailPageLink = new Link<Void>("productDetailLink") {
        @Override
        public void onClick() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.set("urlname", productUrlModel.getObject());
            setResponsePage(new ProductDetailPage(pageParameters));
        }
    };
    WebMarkupContainer image = new WebMarkupContainer("image");
    image.add(new AttributeModifier("src", new ImageLinkModel(productInfoModel, this)));
    image.add(new AttributeModifier("title", new PropertyModel<String>(productInfoModel, "description")));
    image.add(new AttributeModifier("alt", new PropertyModel<String>(productInfoModel, "name")));
    image.setOutputMarkupId(true);

    detailPageLink.add(image);
    return detailPageLink;
}
 
開發者ID:zutherb,項目名稱:AppStash,代碼行數:19,代碼來源:ProductItemPanel.java

示例7: DefaultLoginStatusBar

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
/**
 * Instantiates a new login status bar.
 *
 * @param id the id
 */
public DefaultLoginStatusBar(String id) {
	super(id);
	final Label userStatus = new Label("loggedin", new AbstractReadOnlyModel<String>() {
		@Override
		public String getObject() {
			final DefaultLoginStatusBar bar = DefaultLoginStatusBar.this;
			return isLoggedIn() ? getLoggedInUserName() : bar.getString("notloggedin");
		}
	});
	add(userStatus);
	final Link<WebPage> actionLink = new Link<WebPage>("actionlink") {
		@Override
		public void onClick() {
			Class<? extends WebPage> resp =	(isLoggedIn() ? doLogout() : getLoginPage());
			if(resp != null)
				setResponsePage(resp);
		}
	};
	final Label loginactionlabel = new MyLabel("loginactionlabel", new ResourceModel("login"), false);
	final Label logoutactionlabel = new MyLabel("logoutactionlabel", new ResourceModel("logout"), true);
	actionLink.add(loginactionlabel);
	actionLink.add(logoutactionlabel);
	add(actionLink);
}
 
開發者ID:Nocket,項目名稱:nocket,代碼行數:30,代碼來源:DefaultLoginStatusBar.java

示例8: LinkPanel

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
/**
 * Instantiates a new link panel.
 *
 * @param id the id
 * @param column the column
 * @param rowModel the row model
 */
public LinkPanel(String id, final ActionColumn<T> column, IModel<T> rowModel) {
    super(id);
    Link<T> link = new Link<T>("link", rowModel) {
        @Override
        public void onClick() {
            column.onClick(getModel());
        }

        @Override
        public boolean isEnabled() {
            return column.isEnabled(getModel());
        }

        @Override
        public boolean isVisible() {
            return column.isVisible(getModel());
        }

    };
    add(link);
    link.add(new Label("label", column.getCellLabel(rowModel)));
}
 
開發者ID:Nocket,項目名稱:nocket,代碼行數:30,代碼來源:ActionColumn.java

示例9: LinkPanel

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
public LinkPanel(String wicketId, String bootstrapIcon, String linkCssClass, IModel<String> model,
		Class<? extends WebPage> clazz, PageParameters parameters, boolean newWindow) {
	super(wicketId);
	this.labelModel = model;
	Link<Void> link = null;
	if (parameters == null) {
		link = new BookmarkablePageLink<Void>("link", clazz);
	} else {
		link = new BookmarkablePageLink<Void>("link", clazz, parameters);
	}
	if (newWindow) {
		link.add(new SimpleAttributeModifier("target", "_blank"));
	}
	if (linkCssClass != null) {
		link.add(new SimpleAttributeModifier("class", linkCssClass));
	}
	Label icon = new Label("icon");
	if (StringUtils.isEmpty(bootstrapIcon)) {
		link.add(icon.setVisible(false));
	} else {
		WicketUtils.setCssClass(icon, bootstrapIcon);
		link.add(icon);
	}
	link.add(new Label("label", labelModel).setRenderBodyOnly(true));
	add(link);
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:27,代碼來源:LinkPanel.java

示例10: GravatarImage

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
public GravatarImage(String id, PersonIdent person, int width, boolean linked) {
	super(id);

	String email = person.getEmailAddress() == null ? person.getName().toLowerCase() : person.getEmailAddress().toLowerCase();
	String hash = StringUtils.getMD5(email);
	Link<Void> link = new BookmarkablePageLink<Void>("link", GravatarProfilePage.class,
			WicketUtils.newObjectParameter(hash));
	link.add(new SimpleAttributeModifier("target", "_blank"));
	String url = ActivityUtils.getGravatarThumbnailUrl(email, width);
	ExternalImage image = new ExternalImage("image", url);
	WicketUtils.setCssClass(image, "gravatar");
	link.add(image);
	if (linked) {
		WicketUtils.setHtmlTooltip(link,
			MessageFormat.format("View Gravatar profile for {0}", person.getName()));
	} else {
		WicketUtils.setHtmlTooltip(link, person.getName());
	}
	add(link.setEnabled(linked));
	setVisible(GitBlit.getBoolean(Keys.web.allowGravatar, true));
}
 
開發者ID:BullShark,項目名稱:IRCBlit,代碼行數:22,代碼來源:GravatarImage.java

示例11: onRenderPosition

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
@SuppressWarnings("serial")
@Override
protected void onRenderPosition(final WebMarkupContainer item, final RechnungsPositionDO position)
{
  // item.add(new AuftragsPositionFormComponent("orderPosition", new PropertyModel<AuftragsPositionDO>(position, "auftragsPosition"),
  // false));

  final Link<String> orderLink = new Link<String>("orderLink") {
    @Override
    public void onClick()
    {
      if (position.getAuftragsPosition() != null) {
        final PageParameters parameters = new PageParameters();
        parameters.add(AbstractEditPage.PARAMETER_KEY_ID, position.getAuftragsPosition().getAuftrag().getId());
        final AuftragEditPage auftragEditPage = new AuftragEditPage(parameters);
        auftragEditPage.setReturnToPage(getParentPage());
        setResponsePage(auftragEditPage);
      }
    }
  };
  item.add(orderLink);
  if (position.getAuftragsPosition() == null) {
    orderLink.setVisible(false);
  }
  orderLink.add(new PresizedImage("linkImage", WebConstants.IMAGE_FIND));
}
 
開發者ID:micromata,項目名稱:projectforge-webapp,代碼行數:27,代碼來源:RechnungEditForm.java

示例12: addBreadCrumbs

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
@SuppressWarnings("serial")
private void addBreadCrumbs(final RepeatingView breadcrumbItems, final AbstractSecuredPage page)
{
  final WebPage returnTo = page.getReturnToPage();
  if (returnTo != null && returnTo instanceof AbstractSecuredPage) {
    addBreadCrumbs(breadcrumbItems, (AbstractSecuredPage) returnTo);
  }
  final WebMarkupContainer li = new WebMarkupContainer(breadcrumbItems.newChildId());
  breadcrumbItems.add(li);
  final Link<Void> pageLink = new Link<Void>("link") {

    @Override
    public void onClick()
    {
      setResponsePage(page);
    }
  };
  li.add(pageLink);
  pageLink.add(new Label("label", page.getTitle()));
}
 
開發者ID:micromata,項目名稱:projectforge-webapp,代碼行數:21,代碼來源:AbstractSecuredPage.java

示例13: SwitchSearchMethod

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
public SwitchSearchMethod(String id, SimpleSearch search) {
	super(id);
	boolean isSimple = search.getAdvancedSearchRule() == null;
	SimpleSearch clonedSimpleSearch = search.clone();
	String linkLabelResource;
	
	RecordCollectionServices recordCollectionServices = ConstellioSpringUtils.getRecordCollectionServices();
	RecordCollection recordCollection = recordCollectionServices.get(search.getCollectionName());
	setVisible(recordCollection != null && recordCollection.isAdvancedSearchEnabled());
	
	if (isSimple) {
		linkLabelResource = "toAdvancedSearch";
		clonedSimpleSearch.setAdvancedSearchRule(SearchRulesFactory.getInitialSearchRuleFor(recordCollection));
	} else {
		linkLabelResource = "toSimpleSearch";
		clonedSimpleSearch.setAdvancedSearchRule(null);
	}

       PageFactoryPlugin pageFactoryPlugin = PluginFactory.getPlugin(PageFactoryPlugin.class);
	Link link = new BookmarkablePageLink("link", pageFactoryPlugin.getSearchFormPage(), SearchFormPage.getParameters(clonedSimpleSearch));
	link.add(new Label("label", new StringResourceModel(linkLabelResource, SwitchSearchMethod.this, null)));
	add(link);
}
 
開發者ID:BassJel,項目名稱:Jouve-Project,代碼行數:24,代碼來源:SwitchSearchMethod.java

示例14: createDetachLink

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
private Link createDetachLink(final IModel<Widget> model) {
	Link<Void> link = new Link<Void>(MenuPanel.LINK_ID) {

		private static final long serialVersionUID = 1L;

		@Override
		public void onClick() {
			setResponsePage(new WidgetZoomPage(model.getObject().getId()));
		}

	};		
	
	// see busy-indicator.js
	// we do not want a busy indicator in this situation
	link.add(new AttributeAppender("class", new Model<String>("noBusyIndicator"), " "));
	
	PopupSettings popupSettings = new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS);
	popupSettings.setWidth(POPUP_WIDTH).setHeight(POPUP_HEIGHT);
	link.setPopupSettings(popupSettings);
	return link;
}
 
開發者ID:nextreports,項目名稱:nextreports-server,代碼行數:22,代碼來源:WidgetPopupMenuModel.java

示例15: PageTabLink

import org.apache.wicket.markup.html.link.Link; //導入方法依賴的package包/類
public PageTabLink(String id, PageTab tab) {
	super(id);
	
	Link<?> pageLink = newLink("link", tab.getMainPageClass());
	add(pageLink);
	pageLink.add(new Label("label", tab.getTitleModel()));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:8,代碼來源:PageTabLink.java


注:本文中的org.apache.wicket.markup.html.link.Link.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。