package de.lessvoid.nifty.controls.dynamic;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.NiftyIdCreator;
import de.lessvoid.nifty.controls.StandardControl;
import de.lessvoid.nifty.controls.dynamic.attributes.ControlAttributes;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.loaderv2.types.ElementType;
import de.lessvoid.nifty.loaderv2.types.ImageType;
import de.lessvoid.nifty.screen.Screen;
public class ImageCreator extends ControlAttributes {
public ImageCreator() {
setAutoId(NiftyIdCreator.generate());
}
public ImageCreator(final String id) {
setId(id);
}
public Element create(
final Nifty nifty,
final Screen screen,
final Element parent) {
nifty.addControl(screen, parent, new StandardControl() {
public Element createControl(final Nifty nifty, final Screen screen, final Element parent) throws Exception {
return createImage(nifty, screen, parent);
}
});
nifty.addControlsWithoutStartScreen();
return parent.findElementByName(attributes.get("id"));
}
public ElementType createType() {
return new ImageType(attributes);
}
}