org.bklab.flow.factory.ImageFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-vaadin-flow Show documentation
Show all versions of fluent-vaadin-flow Show documentation
Broderick Labs for fluent vaadin flow. Inherits common Vaadin components.
/*
* Copyright (c) 2008 - 2020. - Broderick Labs.
* Author: Broderick Johansson
* E-mail: [email protected]
* Modify date:2020-06-24 16:33:55
* _____________________________
* Project name: fluent-vaadin-flow
* Class name:org.bklab.flow.factory.ImageFactory
* Copyright (c) 2008 - 2020. - Broderick Labs.
*/
package org.bklab.flow.factory;
import com.vaadin.flow.component.html.Image;
import com.vaadin.flow.server.AbstractStreamResource;
import com.vaadin.flow.server.StreamResource;
import org.bklab.flow.FlowFactory;
import org.bklab.flow.base.ClickNotifierFactory;
import org.bklab.flow.base.HtmlContainerFactory;
import org.bklab.flow.image.ImageBase;
public class ImageFactory extends FlowFactory
implements ClickNotifierFactory, HtmlContainerFactory {
public ImageFactory() {
this(new Image());
}
public ImageFactory(Class> base, String name) {
this();
get().setSrc(new StreamResource(name, () -> base.getResourceAsStream(name)));
}
public ImageFactory(Image component) {
super(component);
}
public ImageFactory(String src, String alt) {
this(new Image(src, alt));
}
public ImageFactory(AbstractStreamResource src, String alt) {
this(new Image(src, alt));
}
public ImageFactory src(String src) {
get().setSrc(src);
return this;
}
public ImageFactory src(AbstractStreamResource src) {
get().setSrc(src);
return this;
}
public ImageFactory alt(String alt) {
get().setAlt(alt);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy