All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
net.n2oapp.framework.config.io.common.BadgeAwareIO Maven / Gradle / Ivy
package net.n2oapp.framework.config.io.common;
import net.n2oapp.framework.api.metadata.global.view.widget.table.ShapeType;
import net.n2oapp.framework.api.metadata.io.IOProcessor;
import net.n2oapp.framework.api.metadata.meta.badge.BadgeAware;
import net.n2oapp.framework.api.metadata.meta.badge.Position;
import org.jdom2.Element;
/**
* Интерфейс чтения/записи компонентов {@link BadgeAware}
*/
public interface BadgeAwareIO {
/**
* Чтение/запись элемента, не использующего ссылки на поля
*/
default void badge(Element e, T m, IOProcessor p) {
p.attribute(e, "badge", m::getBadge, m::setBadge);
p.attribute(e, "badge-color", m::getBadgeColor, m::setBadgeColor);
p.attribute(e, "badge-image", m::getBadgeImage, m::setBadgeImage);
defaults(e, m, p);
}
/**
* Чтение/запись элемента, ссылающегося на поля
*/
default void refBadge(Element e, T m, IOProcessor p) {
p.attribute(e, "badge-field-id", m::getBadgeFieldId, m::setBadgeFieldId);
p.attribute(e, "badge-color-field-id", m::getBadgeColorFieldId, m::setBadgeColorFieldId);
p.attribute(e, "badge-image-field-id", m::getBadgeImageFieldId, m::setBadgeImageFieldId);
defaults(e, m, p);
}
/**
* Чтение/запись общих свойств
*/
private void defaults(Element e, T m, IOProcessor p) {
p.attributeEnum(e, "badge-position", m::getBadgePosition, m::setBadgePosition, Position.class);
p.attributeEnum(e, "badge-image-position", m::getBadgeImagePosition, m::setBadgeImagePosition, Position.class);
p.attributeEnum(e, "badge-shape", m::getBadgeShape, m::setBadgeShape, ShapeType.class);
p.attributeEnum(e, "badge-image-shape", m::getBadgeImageShape, m::setBadgeImageShape, ShapeType.class);
}
}