use of com.vaadin.flow.component.html.Anchor in project flow by vaadin.
the class RouterLinkView method addImageLink.
private void addImageLink() {
Anchor anchor = new Anchor("image/link", null);
anchor.getElement().setAttribute("router-link", true);
anchor.getStyle().set("display", "block");
Image image = new Image("", "IMAGE");
image.setWidth("200px");
image.setHeight("200px");
anchor.add(image);
add(anchor);
}
use of com.vaadin.flow.component.html.Anchor in project flow by vaadin.
the class StreamResourceView method onAttach.
@Override
protected void onAttach(AttachEvent attachEvent) {
StreamResource resource = new StreamResource("filename", () -> new ByteArrayInputStream("Hello world".getBytes(StandardCharsets.UTF_8)));
Anchor download = new Anchor("", "Download file");
download.setHref(resource);
download.setId("download");
add(download);
}
use of com.vaadin.flow.component.html.Anchor in project flow by vaadin.
the class DemoNavigationBar method addLink.
/**
* Adds a menu item inside the navigation bar.
*
* @param text
* the text shown for the anchor
* @param href
* the href of the anchor
*/
public void addLink(String text, String href) {
Element item = new Element(Tag.LI);
Anchor anchor = new Anchor(href, text);
item.appendChild(anchor.getElement());
list.appendChild(item);
anchors.put(href, anchor);
}
use of com.vaadin.flow.component.html.Anchor in project flow by vaadin.
the class ScrollView method createAnchorUrl.
static Anchor createAnchorUrl(boolean isRouterLink, String id, String url, String text) {
Anchor result = new Anchor(url, text);
result.getElement().setAttribute(ROUTER_LINK_ATTRIBUTE_NAME, isRouterLink);
result.getStyle().set("display", "block");
result.setId(id);
return result;
}
Aggregations