use of com.evolveum.midpoint.gui.impl.component.icon.LayerIcon in project midpoint by Evolveum.
the class CompositedIconPanel method initLayout.
private void initLayout() {
WebMarkupContainer layeredIcon = new WebMarkupContainer(ID_LAYERED_ICON);
layeredIcon.add(AttributeAppender.append("title", (IModel<String>) () -> {
if (getModelObject() != null && org.apache.commons.lang3.StringUtils.isNotBlank(getModelObject().getTitle())) {
return getModelObject().getTitle();
}
return null;
}));
add(layeredIcon);
WebComponent basicIcon = new WebComponent(ID_BASIC_ICON);
basicIcon.add(AttributeAppender.append("class", (IModel<String>) () -> {
if (getModelObject() != null && getModelObject().hasBasicIcon()) {
return getModelObject().getBasicIcon();
}
return null;
}));
basicIcon.add(AttributeAppender.append("style", (IModel<String>) () -> {
if (getModelObject() != null && getModelObject().hasBasicIcon() && getModelObject().hasBasicIconHtmlColor()) {
return "color:" + getModelObject().getBasicIconHtmlColor();
}
return null;
}));
layeredIcon.add(basicIcon);
ListView<LayerIcon> validationItems = new ListView<LayerIcon>(ID_LAYER_ICONS, new PropertyModel(getModel(), CompositedIcon.F_LAYER_ICONS)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<LayerIcon> item) {
if (item.getModelObject() == null) {
return;
}
if (StringUtils.isNotEmpty(item.getModelObject().getIconType().getCssClass())) {
WebComponent icon = new WebComponent(ID_LAYER_ICON);
icon.add(AttributeAppender.append("class", item.getModelObject().getIconType().getCssClass()));
if (StringUtils.isNotEmpty(item.getModelObject().getIconType().getColor())) {
icon.add(AttributeAppender.append("style", "color: " + item.getModelObject().getIconType().getColor()));
}
item.add(icon);
}
}
};
layeredIcon.add(validationItems);
add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null;
}
});
}
use of com.evolveum.midpoint.gui.impl.component.icon.LayerIcon in project midpoint by Evolveum.
the class AjaxCompositedIconButton method onComponentTagBody.
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
StringBuilder sb = new StringBuilder();
CompositedIcon icon = this.icon;
if (icon == null) {
icon = buttonModel.getObject().getCompositedIcon();
}
if (icon.hasBasicIcon()) {
sb.append("<i class=\"").append(icon.getBasicIcon()).append("\"");
if (icon.hasBasicIconHtmlColor()) {
sb.append(" style=\"color: " + icon.getBasicIconHtmlColor() + ";\"");
}
sb.append("></i> ");
if (titleAsLabel) {
sb.append("<span class=\"operationalButtonLabel\">").append(title.getObject()).append("</span>");
}
}
if (icon.hasLayerIcons()) {
for (LayerIcon entry : icon.getLayerIcons()) {
if (entry == null) {
continue;
}
if (StringUtils.isNotEmpty(entry.getIconType().getCssClass())) {
sb.append("<i class=\"").append(entry.getIconType().getCssClass()).append("\"");
if (StringUtils.isNotEmpty(entry.getIconType().getColor())) {
sb.append(" style=\"color: ").append(entry.getIconType().getColor()).append(";\"");
}
sb.append(">").append(entry.hasLabel() ? entry.getLabelModel().getObject() : "").append("</i> ");
}
}
}
replaceComponentTagBody(markupStream, openTag, sb.toString());
}
use of com.evolveum.midpoint.gui.impl.component.icon.LayerIcon in project midpoint by Evolveum.
the class AjaxCompositedIconSubmitButton method onComponentTagBody.
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
StringBuilder sb = new StringBuilder();
CompositedIcon icon = this.icon;
if (icon.hasBasicIcon()) {
sb.append("<i class=\"").append(icon.getBasicIcon() != null ? icon.getBasicIcon().trim() : "").append("\"");
if (icon.hasBasicIconHtmlColor()) {
sb.append(" style=\"color: " + icon.getBasicIconHtmlColor() + ";\"");
}
sb.append("></i> ");
if (titleAsLabel) {
sb.append("<span class=\"operationalButtonLabel\">").append(title.getObject()).append("</span>");
}
}
if (icon.hasLayerIcons()) {
for (LayerIcon entry : icon.getLayerIcons()) {
if (entry == null) {
continue;
}
if (StringUtils.isNotEmpty(entry.getIconType().getCssClass())) {
sb.append("<i class=\"").append(entry.getIconType().getCssClass()).append("\"");
if (StringUtils.isNotEmpty(entry.getIconType().getColor())) {
sb.append(" style=\"color: ").append(entry.getIconType().getColor()).append(";\"");
}
sb.append(">").append(entry.hasLabel() ? entry.getLabelModel().getObject() : "").append("</i> ");
}
}
}
replaceComponentTagBody(markupStream, openTag, sb.toString());
}
Aggregations