Java Code Examples for org.apache.wicket.markup.html.link.ExternalLink#add()

The following examples show how to use org.apache.wicket.markup.html.link.ExternalLink#add() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
Source File: ListAccessors.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public ListAccessors() {
    String userId = sessionManager.getCurrentSessionUserId();
    Collection<Accessor> accessors = oAuthService.getAccessAccessorForUser(userId);
    ListView<Accessor> accessorList = new ListView<Accessor>("accessorlist", new ArrayList<>(accessors)) {
        @Override
        protected void populateItem(ListItem<Accessor> components) {
            try {
                final Consumer consumer = oAuthService.getConsumer(components.getModelObject().getConsumerId());
                ExternalLink consumerHomepage = new ExternalLink("consumerUrl", consumer.getUrl(),
                        consumer.getName());
                consumerHomepage.add(new AttributeModifier("target", "_blank"));
                consumerHomepage.setEnabled(consumer.getUrl() != null && !consumer.getUrl().isEmpty());
                components.add(consumerHomepage);
                components.add(new Label("consumerDescription", consumer.getDescription()));
                components.add(new Label("creationDate", new StringResourceModel("creation.date", new Model<>(components.getModelObject().getCreationDate()))));
                components.add(new Label("expirationDate", new StringResourceModel("expiration.date", new Model<>(components.getModelObject().getExpirationDate()))));

                components.add(new Link<Accessor>("delete", components.getModel()) {
                    @Override
                    public void onClick() {
                        try {
                            oAuthService.revokeAccessor(getModelObject().getToken());
                            setResponsePage(getPage().getClass());
                            getSession().info(consumer.getName() + "' token has been removed.");
                        } catch (Exception e) {
                            warn("Couldn't remove " + consumer.getName() + "'s token': " + e.getLocalizedMessage());
                        }
                    }
                });
            } catch (InvalidConsumerException invalidConsumerException) {
                // Invalid consumer, it is probably deleted
                // For security reasons, this token should be revoked
                oAuthService.revokeAccessor(components.getModelObject().getToken());
                components.setVisible(false);
            }
        }

        @Override
        public boolean isVisible() {
            return !getModelObject().isEmpty() && super.isVisible();
        }
    };
    add(accessorList);

    Label noAccessorLabel = new Label("noAccessor", new ResourceModel("no.accessor"));
    noAccessorLabel.setVisible(!accessorList.isVisible());
    add(noAccessorLabel);
}
 
Example 11
Source File: ListAccessors.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public ListAccessors() {
    String userId = sessionManager.getCurrentSessionUserId();
    Collection<Accessor> accessors = oAuthService.getAccessAccessorForUser(userId);
    ListView<Accessor> accessorList = new ListView<Accessor>("accessorlist", new ArrayList<>(accessors)) {
        @Override
        protected void populateItem(ListItem<Accessor> components) {
            try {
                final Consumer consumer = oAuthService.getConsumer(components.getModelObject().getConsumerId());
                ExternalLink consumerHomepage = new ExternalLink("consumerUrl", consumer.getUrl(),
                        consumer.getName());
                consumerHomepage.add(new AttributeModifier("target", "_blank"));
                consumerHomepage.setEnabled(consumer.getUrl() != null && !consumer.getUrl().isEmpty());
                components.add(consumerHomepage);
                components.add(new Label("consumerDescription", consumer.getDescription()));
                components.add(new Label("creationDate", new StringResourceModel("creation.date", new Model<>(components.getModelObject().getCreationDate()))));
                components.add(new Label("expirationDate", new StringResourceModel("expiration.date", new Model<>(components.getModelObject().getExpirationDate()))));

                components.add(new Link<Accessor>("delete", components.getModel()) {
                    @Override
                    public void onClick() {
                        try {
                            oAuthService.revokeAccessor(getModelObject().getToken());
                            setResponsePage(getPage().getClass());
                            getSession().info(consumer.getName() + "' token has been removed.");
                        } catch (Exception e) {
                            warn("Couldn't remove " + consumer.getName() + "'s token': " + e.getLocalizedMessage());
                        }
                    }
                });
            } catch (InvalidConsumerException invalidConsumerException) {
                // Invalid consumer, it is probably deleted
                // For security reasons, this token should be revoked
                oAuthService.revokeAccessor(components.getModelObject().getToken());
                components.setVisible(false);
            }
        }

        @Override
        public boolean isVisible() {
            return !getModelObject().isEmpty() && super.isVisible();
        }
    };
    add(accessorList);

    Label noAccessorLabel = new Label("noAccessor", new ResourceModel("no.accessor"));
    noAccessorLabel.setVisible(!accessorList.isVisible());
    add(noAccessorLabel);
}
 
Example 12
Source File: ActionLinkPanel.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
private ExternalLink getSmsLink(final String number)
{
  final ExternalLink smsLink = new ExternalLink("sms", "sms:" + number);
  smsLink.add(new PresizedImage("smsImage", ImageDef.SMS));
  return smsLink;
}