org.apache.wicket.markup.html.link.ExternalLink Java Examples

The following examples show how to use org.apache.wicket.markup.html.link.ExternalLink. 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: LinkProvider.java    From inception with Apache License 2.0 6 votes vote down vote up
public static ExternalLink createDocumentPageLink(Project aProject, long aDocId, String aId,
        String aLinkLabel, Class<? extends WebPage> aPageClass)
{
    String url = "";
    if (aDocId >= 0) {
        url = String.format("%s#!p=%d&d=%d",
                RequestCycle.get().urlFor(aPageClass, new PageParameters()), aProject.getId(),
                aDocId);
    }
    if (aLinkLabel == null) {
        new ExternalLink(aId, url);
    }
    
    return new ExternalLink(aId, url, aLinkLabel);
    
}
 
Example #2
Source File: NavigationPanel.java    From AppStash with Apache License 2.0 6 votes vote down vote up
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 #3
Source File: JiraIssuesPanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
public JiraIssuesPanel(final String id, final IModel<String> model)
{
  super(id);
  setRenderBodyOnly(true);
  if (WicketUtils.isJIRAConfigured() == false) {
    final WebMarkupContainer dummy = new WebMarkupContainer("issues");
    setVisible(false);
    dummy.add(new ExternalLink("jiraLink", "dummy"));
    add(dummy);
    return;
  }
  final RepeatingView jiraIssuesRepeater = new RepeatingView("issues");
  add(jiraIssuesRepeater);
  final String[] jiraIssues = JiraUtils.checkForJiraIssues(model.getObject());
  if (jiraIssues == null) {
    jiraIssuesRepeater.setVisible(false);
  } else {
    for (final String issue : jiraIssues) {
      final WebMarkupContainer item = new WebMarkupContainer(jiraIssuesRepeater.newChildId());
      item.setRenderBodyOnly(true);
      jiraIssuesRepeater.add(item);
      item.add(new ExternalLink("jiraLink", JiraUtils.buildJiraIssueBrowseLinkUrl(issue), issue));
    }
  }
}
 
Example #4
Source File: FooterPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public FooterPanel(String id) {
	super(id);
	
	ExternalLink link = new ExternalLink("home", ReleaseInfo.getHome()) {
           protected void onComponentTag(ComponentTag componentTag) {
               super.onComponentTag(componentTag);
               componentTag.put("target", "_blank");
           }
       };
	link.add(new Label("company", ReleaseInfo.getCompany()));
	add(link);
	
	Label version = new Label("version", getVersion());
	version.add(new SimpleTooltipBehavior(getBuildDate()));
	add(version);		
}
 
Example #5
Source File: FooterPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
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 #6
Source File: InvitationTemplate.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
private InvitationTemplate(Locale locale, String invitorName, String message, String link) {
	super(locale);

	add(new Label("titleLbl", getString("500", locale)));
	add(new Label("userLbl", getString("501", locale)));
	add(new Label("user", invitorName));
	add(new Label("messageLbl", getString("502", locale)));
	add(new Label("message", message).setEscapeModelStrings(false));

	add(new WebMarkupContainer("links")
		.add(new Label("comment_for_link1", getString("503", locale)))
		.add(new ExternalLink("invitation_link1", link).add(new Label("clickMe", getString("504", locale))))
		.add(new Label("comment_for_link2", getString("505", locale)))
		.add(new Label("invitation_link2", link))
		.setVisible(link != null)
		);
}
 
Example #7
Source File: ResetPasswordHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
public ResetPasswordHtmlNotificationPanel(String id, IModel<User> userModel) {
	super(id, userModel);
	
	WebMarkupContainer title = new WebMarkupContainer("title");
	title.add(new StyleAttributeAppender(STYLE_TITLE));
	add(title);
	
	WebMarkupContainer contentContainer = new CustomWebMarkupContainer("contentContainer", STYLE_CONTENT);
	add(contentContainer);
	
	contentContainer.add(new Label("text", new StringResourceModel("notification.panel.resetPassword.text", getModel())));
	
	contentContainer.add(new Label("confirmText", new ResourceModel("notification.panel.resetPassword.confirm")));
	
	ExternalLink confirmLink = new ExternalLink("confirmLink", getResetPasswordUrl());
	confirmLink.add(new StyleAttributeAppender(STYLE_LINK));
	confirmLink.add(new Label("confirmLabel", new ResourceModel("notification.panel.resetPassword.confirm.label")));
	contentContainer.add(confirmLink);
}
 
Example #8
Source File: AbstractHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
public AbstractHtmlNotificationPanel(String id, IModel<T> model) {
	super(id, model);
	
	WebMarkupContainer root = new TransparentWebMarkupContainer("root");
	root.add(new StyleAttributeAppender(STYLE_ROOT));
	add(root);
	
	WebMarkupContainer mainContainer = new TransparentWebMarkupContainer("mainContainer");
	mainContainer.add(new StyleAttributeAppender(STYLE_MAIN_CONTAINER));
	root.add(mainContainer);
	
	mainContainer.add(new CustomWebMarkupContainer("mainTitle", STYLE_MAIN_TITLE));
	
	WebMarkupContainer footer = new CustomWebMarkupContainer("footer", STYLE_FOOTER);
	mainContainer.add(footer);
	
	ExternalLink aboutLink = new ExternalLink("aboutLink", notificationUrlBuilderService.getAboutUrl());
	aboutLink.add(new StyleAttributeAppender(STYLE_LINK_FOOTER));
	footer.add(aboutLink);
}
 
Example #9
Source File: NavigationPanel.java    From the-app with Apache License 2.0 6 votes vote down vote up
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 #10
Source File: ConfirmRegistrationHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
public ConfirmRegistrationHtmlNotificationPanel(String id, IModel<User> userModel) {
	super(id, userModel);
	
	WebMarkupContainer title = new WebMarkupContainer("title");
	title.add(new StyleAttributeAppender(STYLE_TITLE));
	add(title);
	
	WebMarkupContainer contentContainer = new CustomWebMarkupContainer("contentContainer", STYLE_CONTENT);
	add(contentContainer);
	
	contentContainer.add(new Label("text", new StringResourceModel("notification.panel.confirmRegistration.text", getModel())));
	
	contentContainer.add(new Label("confirmText", new ResourceModel("notification.panel.confirmRegistration.confirm")));
	
	ExternalLink confirmLink = new ExternalLink("confirmLink", getConfirmUrl());
	confirmLink.add(new StyleAttributeAppender(STYLE_LINK));
	confirmLink.add(new Label("confirmLabel", new ResourceModel("notification.panel.confirmRegistration.confirm.label")));
	contentContainer.add(confirmLink);
}
 
Example #11
Source File: ImageSidebar.java    From inception with Apache License 2.0 5 votes vote down vote up
public ImageSidebar(String aId, IModel<AnnotatorState> aModel,
        AnnotationActionHandler aActionHandler, CasProvider aCasProvider,
        AnnotationPage aAnnotationPage)
{
    super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage);

    mainContainer = new WebMarkupContainer("mainContainer");
    mainContainer.setOutputMarkupId(true);
    add(mainContainer);

    ListView<ImageHandle> images = new ListView<ImageHandle>("images")
    {
        private static final long serialVersionUID = -1203277069357712752L;

        @Override
        protected void populateItem(ListItem<ImageHandle> item)
        {
            item.add(new ExternalLink("open", item.getModelObject().getUrl()));
            LambdaAjaxLink jumpToLink = new LambdaAjaxLink("jumpTo",
                _target -> actionJumpTo(_target, item.getModelObject()));
            item.add(jumpToLink);
            jumpToLink.add(new ExternalImage("image", item.getModelObject().getUrl()));
        }
    };
    images.setModel(LoadableDetachableModel.of(this::listImageUrls));
    
    mainContainer.add(images);
}
 
Example #12
Source File: UrlLinkVisualizer.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel, IModel<OProperty> propertyModel, IModel<V> valueModel)
{
    switch (mode)
    {
        case VIEW:
            return new ExternalLink(id, (IModel<String>) valueModel,valueModel);
        case EDIT:
            return new TextField<String>(id, (IModel<String>) valueModel);
        default:
            return null;
    }
}
 
Example #13
Source File: ActionLinkPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public ActionLinkPanel(final String id, final ActionLinkType actionLinkType, final String value)
{
  super(id);
  AbstractLink link1;
  if (actionLinkType == ActionLinkType.CALL) {
    add(link1 = getCallLink(value));
    add(getInvisibleSmsLink());
  } else if (actionLinkType == ActionLinkType.SMS) {
    add(new Label("link", "[invisible]").setVisible(false));
    add(getSmsLink(value));
  } else if (actionLinkType == ActionLinkType.CALL_AND_SMS) {
    add(link1 = getCallLink(value));
    add(getSmsLink(value));
  } else if (actionLinkType == ActionLinkType.MAIL) {
    add(link1 = new ExternalLink("link", "mailto:" + value, value));
    add(getInvisibleSmsLink());
  } else {
    final String url;
    if (value != null && value.contains("://") == true) {
      url = value;
    } else {
      url = "http://" + value;
    }
    add(link1 = new ExternalLink("link", url, value));
    link1.add(AttributeModifier.append("target", "_blank"));
    add(getInvisibleSmsLink());
  }
}
 
Example #14
Source File: NavigationPanel.java    From AppStash with Apache License 2.0 5 votes vote down vote up
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 #15
Source File: OmnigatorLinkFunctionBoxPanel.java    From ontopia with Apache License 2.0 5 votes vote down vote up
@Override
protected Component getLink(String id) {
  String url = new ResourceModel("omnigator.url").getObject().toString()+"?tm="+getTopicMapId()+"&id="+getTopicId();
  
  return new ExternalLink(id, url, new ResourceModel("omnigator.link.label").getObject().toString()) {
    @Override
    protected void onComponentTag(ComponentTag tag) {
      tag.setName("a");
      tag.put("target", "_blank");
      super.onComponentTag(tag);
    }
  };
}
 
Example #16
Source File: LinkProvider.java    From inception with Apache License 2.0 5 votes vote down vote up
/**
 * Create an external link to a page which opens a document, codes the url as
 * {@code aPageClass?params#!p=projectId&d=docId}.
 */
public static ExternalLink createDocumentPageLink(DocumentService aDocService, Project aProject,
        String aDocId, String aId, String aLinkLabel, Class<? extends WebPage> aPageClass)
{
    long docId = -1;
    if (aDocService.existsSourceDocument(aProject, aDocId)) {
        docId = aDocService.getSourceDocument(aProject, aDocId).getId();
    }
    
    return createDocumentPageLink(aProject, docId, aId, aLinkLabel, aPageClass);
}
 
Example #17
Source File: DocumentationPage.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds BookmarkablePageLink with given id to the given parentContainer.
 * @param id id of the link (shouldn't bee "newsLink" in body, because it's already used by DocumentationPage).
 * @param parentContainer Page (normally body)
 */
public static final AbstractLink addNewsLink(final WebMarkupContainer parentContainer, final String id)
{
  final AbstractLink link = new ExternalLink(id, WicketUtils.getUrl(parentContainer.getRequestCycle(), "secure/doc/News.html", true));
  parentContainer.add(link);
  return link;
}
 
Example #18
Source File: ImageLink.java    From webanno with Apache License 2.0 5 votes vote down vote up
public ImageLink(String aId, ResourceReference aImageRes, IModel<String> aUrl)
{
    super(aId, aUrl);
    ExternalLink link = new ExternalLink("link", aUrl);
    link.add(new Image("image", aImageRes));
    add(link);
}
 
Example #19
Source File: AccessSpecificSettingsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
private WebMarkupContainer createKbInfoContainer(String aId)
{
    WebMarkupContainer wmc = new WebMarkupContainer(aId);
    wmc.add(new Label("description", kbInfoModel.bind("description"))
        .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null)));
    wmc.add(new Label("hostInstitutionName", kbInfoModel.bind("hostInstitutionName"))
        .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null)));
    wmc.add(new Label("authorName", kbInfoModel.bind("authorName"))
        .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null)));
    wmc.add(new ExternalLink("websiteURL", kbInfoModel.bind("websiteURL"),
        kbInfoModel.bind("websiteURL"))
        .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null)));
    return wmc;
}
 
Example #20
Source File: RegisterUserTemplate.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
private RegisterUserTemplate(String username, String email, String verificationUrl) {
	super(getOmSession().getLocale());
	add(new Label("registrationLbl", getString("506", locale)));
	add(new Label("username", username));
	add(new Label("email", email));
	WebMarkupContainer verification = new WebMarkupContainer("verification");
	add(verification.add(new Label("verification_url2", verificationUrl))
		.add(new ExternalLink("verification_url1", verificationUrl))
		.setVisible(verificationUrl != null));
	add(new Label("groupLbl", getString("511", locale)));
}
 
Example #21
Source File: ConceptFeatureEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
public ConceptFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel,
        IModel<AnnotatorState> aStateModel, AnnotationActionHandler aHandler)
{
    super(aId, aItem, new CompoundPropertyModel<>(aModel));
    
    IModel<String> iriModel = LoadableDetachableModel.of(this::iriTooltipValue);
    
    iriBadge = new IriInfoBadge("iriInfoBadge", iriModel);
    iriBadge.add(visibleWhen(() -> isNotBlank(iriBadge.getModelObject())));
    add(iriBadge);
    
    openIriLink = new ExternalLink("openIri", iriModel);
    openIriLink.add(visibleWhen(() -> isNotBlank(iriBadge.getModelObject())));
    add(openIriLink);

    add(new DisabledKBWarning("disabledKBWarning", Model.of(getModelObject().feature)));

    add(focusComponent = new AutoCompleteField(MID_VALUE, _query -> 
            getCandidates(aStateModel, aHandler, _query)));
    
    AnnotationFeature feat = getModelObject().feature;
    ConceptFeatureTraits traits = readFeatureTraits(feat);
    
    add(new KeyBindingsPanel("keyBindings", () -> traits.getKeyBindings(), aModel, aHandler)
            // The key bindings are only visible when the label is also enabled, i.e. when the
            // editor is used in a "normal" context and not e.g. in the keybindings 
            // configuration panel
            .add(visibleWhen(() -> getLabelComponent().isVisible())));
    
    description = new Label("description", LoadableDetachableModel.of(this::descriptionValue));
    description.setOutputMarkupPlaceholderTag(true);
    description.add(visibleWhen(
        () -> getLabelComponent().isVisible() && getModelObject().getValue() != null));
    add(description);
}
 
Example #22
Source File: FeedbackTemplate.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
private FeedbackTemplate(String username, String email, String message) {
	super(getOmSession().getLocale());
	add(new Label("appname", getApplicationName()));
	add(new Label("username", username));
	add(new Label("email", email));
	add(new Label("message", message));
	add(new ExternalLink("invitation_link", ""));
}
 
Example #23
Source File: ActivitiesDashlet.java    From inception with Apache License 2.0 5 votes vote down vote up
public ActivitiesDashlet(String aId, IModel<Project> aCurrentProject)
{
    super(aId);
    
    projectModel = aCurrentProject;
    
    if (aCurrentProject == null || aCurrentProject.getObject() == null) {
        return;
    }
    
    annotationEvents = new HashSet<>();
    Collections.addAll(annotationEvents, SPAN_CREATED_EVENT, FEATURE_UPDATED_EVENT, 
            RELATION_CREATED_EVENT);
    
    WebMarkupContainer activitiesList = new WebMarkupContainer("activities",
            new StringResourceModel("activitiesHeading", this));
    activitiesList.setOutputMarkupPlaceholderTag(true);
    
    ListView<LoggedEvent> listView = new ListView<LoggedEvent>("activity",
            LoadableDetachableModel.of(this::listActivities))
    {
        private static final long serialVersionUID = -8613360620764882858L;

        @Override
        protected void populateItem(ListItem<LoggedEvent> aItem)
        {
            SourceDocument document = getSourceDocument(aItem.getModelObject());
            ExternalLink eventLink = createLastActivityLink("eventLink", aItem.getModelObject(),
                    document);
            aItem.add(eventLink);
        }
    };

    add(visibleWhen(() -> !listView.getList().isEmpty()));
    setOutputMarkupPlaceholderTag(true);
    activitiesList.add(listView);
    add(activitiesList);
}
 
Example #24
Source File: RequestContactTemplate.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
private RequestContactTemplate(User userToAdd, User user) {
	super(LocaleHelper.getLocale(userToAdd));
	add(new Label("hi", getString("1192", locale)));
	add(new Label("addedFirstName", userToAdd.getFirstname()));
	add(new Label("addedLastName", userToAdd.getLastname()));
	add(new Label("firstName", user.getFirstname()));
	add(new Label("lastName", user.getLastname()));
	add(new Label("likeToAdd", getString("1193", locale)));
	add(new Label("check", getString("1194", locale)));
	add(new ExternalLink("link", app.getOmContactsLink()).add(new Label("contactList", getString("1196", locale))));
}
 
Example #25
Source File: AbstractRegisteredEmailHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 5 votes vote down vote up
public AbstractRegisteredEmailHtmlNotificationPanel(String id, IModel<T> model,
		IModel<EmailAddress> emailAddressModel) {
	super(id, model);
	this.emailAddressModel = emailAddressModel;
	
	WebMarkupContainer unsubscribe = new WebMarkupContainer("unsubscribe");
	unsubscribe.add(new StyleAttributeAppender(STYLE_UNSUBSCRIBE));
	add(unsubscribe);
	
	unsubscribe.add(new Label("unsubscribeText", getUnsubscribeText()));
	
	ExternalLink unsubscribeLink = new ExternalLink("unsubscribeLink", getUnsubscribeUrl());
	unsubscribeLink.add(new StyleAttributeAppender(STYLE_LINK_FOOTER));
	unsubscribe.add(unsubscribeLink);
}
 
Example #26
Source File: DeleteEmailHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 5 votes vote down vote up
public DeleteEmailHtmlNotificationPanel(String id, IModel<EmailAddress> emailModel) {
	super(id, emailModel);
	
	add(new CustomWebMarkupContainer("titleContainer", STYLE_TITLE));
	
	WebMarkupContainer contentContainer = new CustomWebMarkupContainer("contentContainer", STYLE_CONTENT);
	add(contentContainer);
	
	ExternalLink confirmLink = new ExternalLink("confirmLink", getConfirmUrl());
	confirmLink.add(new StyleAttributeAppender(STYLE_LINK));
	contentContainer.add(confirmLink);
}
 
Example #27
Source File: ConfirmEmailHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 5 votes vote down vote up
public ConfirmEmailHtmlNotificationPanel(String id, IModel<EmailAddress> emailModel) {
	super(id, emailModel);
	
	add(new CustomWebMarkupContainer("titleContainer", STYLE_TITLE));
	
	WebMarkupContainer contentContainer = new CustomWebMarkupContainer("contentContainer", STYLE_CONTENT);
	add(contentContainer);
	
	contentContainer.add(new Label("intro", new StringResourceModel("notification.panel.confirmEmail.text", getModel())));
	
	ExternalLink confirmLink = new ExternalLink("confirmLink", getConfirmUrl());
	confirmLink.add(new StyleAttributeAppender(STYLE_LINK));
	contentContainer.add(confirmLink);
}
 
Example #28
Source File: NavigationPanel.java    From the-app with Apache License 2.0 5 votes vote down vote up
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 #29
Source File: RecommendedArtifactPortfolioPanel.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
@Override
protected void addItemColumns(final Item<Artifact> item, IModel<? extends Artifact> itemModel) {
	item.setOutputMarkupId(true);
	
	Artifact artifact = item.getModelObject();
	final IModel<Artifact> artifactModel = new ArtifactModel(Model.of(item.getModelObject().getArtifactKey()));
	final ArtifactLastVersionModel artifactLastVersionModel = new ArtifactLastVersionModel(artifactModel);
	
	item.add(new ClassAttributeAppender(new LoadableDetachableModel<String>() {
		private static final long serialVersionUID = 1L;
		
		@Override
		protected String load() {
			User user = MavenArtifactNotifierSession.get().getUser();
			boolean isFollowed = user != null && userService.isFollowedArtifact(user, item.getModelObject());
			boolean isDeprecated = artifactModel.getObject() != null &&
					ArtifactDeprecationStatus.DEPRECATED.equals(artifactModel.getObject().getDeprecationStatus());
			return isFollowed ? "success" : (isDeprecated ? "warning" : null);
		}
	}));
	
	// GroupId column
	item.add(new Label("groupId", BindingModel.of(artifactModel, Binding.artifact().group().groupId())));
	item.add(new ExternalLink("groupLink", mavenCentralSearchUrlService.getGroupUrl(artifact.getGroup().getGroupId())));

	// ArtifactId column
	Link<Void> localArtifactLink = ArtifactDescriptionPage.linkDescriptor(artifactModel).link("localArtifactLink");
	localArtifactLink.add(new Label("artifactId", BindingModel.of(artifactModel, Binding.artifact().artifactId())));
	item.add(localArtifactLink);
	
	item.add(new ExternalLink("artifactLink", mavenCentralSearchUrlService.getArtifactUrl(artifact.getGroup().getGroupId(), artifact.getArtifactId())));
	
	// LastVersion, lastUpdateDate columns
	item.add(new Label("synchronizationPlannedPlaceholder", new ResourceModel("artifact.follow.synchronizationPlanned")) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(artifactModel.getObject() != null && !artifactLastVersionModel.isLastVersionAvailable());
		}
	});
	
	WebMarkupContainer localContainer = new WebMarkupContainer("followedArtifact") {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(artifactLastVersionModel.isLastVersionAvailable());
		}
	};
	localContainer.add(new ArtifactVersionTagPanel("latestVersion", Model.of(artifactLastVersionModel.getLastVersion())));
	String latestVersion = (artifact.getLatestVersion() != null ? artifact.getLatestVersion().getVersion() : "");
	localContainer.add(new ExternalLink("versionLink", mavenCentralSearchUrlService.getVersionUrl(artifact.getGroup().getGroupId(),
			artifact.getArtifactId(), latestVersion)));
	
	localContainer.add(new DateLabelWithPlaceholder("lastUpdateDate",
			Model.of(artifactLastVersionModel.getLastVersionUpdateDate()), DatePattern.SHORT_DATE));
	item.add(localContainer);

	// Followers count column
	Label followersCount = new CountLabel("followersCount", "artifact.follow.dataView.followers",
			BindingModel.of(artifactModel, Binding.artifact().followersCount()));
	followersCount.add(new AttributeModifier("class", new LoadableDetachableModel<String>() {
		private static final long serialVersionUID = 1L;

		@Override
		protected String load() {
			if (artifactModel.getObject() != null && artifactModel.getObject().getFollowersCount() > 0) {
				return "badge";
			}
			return null;
		}
	}));
	item.add(followersCount);
	
	// Follow actions
	item.add(new ArtifactFollowActionsPanel("followActions", artifactModel));
}
 
Example #30
Source File: ExternalLinkPanel.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public ExternalLink getLink()
{
  return link;
}