use of com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.interfaces.DragAndDropAwareState in project cuba by cuba-platform.
the class VDragCaptionProvider method getDragCaptionElement.
public Element getDragCaptionElement(Widget w) {
ComponentConnector component = Util.findConnectorFor(w);
DDLayoutState state = ((DragAndDropAwareState) root.getState()).getDragAndDropState();
DragCaptionInfo dci = state.dragCaptions.get(component);
Document document = Document.get();
Element dragCaptionImage = document.createDivElement();
Element dragCaption = document.createSpanElement();
String dragCaptionText = dci.caption;
if (dragCaptionText != null) {
if (dci.contentMode == ContentMode.TEXT) {
dragCaption.setInnerText(dragCaptionText);
} else if (dci.contentMode == ContentMode.HTML) {
dragCaption.setInnerHTML(dragCaptionText);
} else if (dci.contentMode == ContentMode.PREFORMATTED) {
PreElement preElement = document.createPreElement();
preElement.setInnerText(dragCaptionText);
dragCaption.appendChild(preElement);
}
}
String dragIconKey = state.dragCaptions.get(component).iconKey;
if (dragIconKey != null) {
String resourceUrl = root.getResourceUrl(dragIconKey);
Icon icon = component.getConnection().getIcon(resourceUrl);
dragCaptionImage.appendChild(icon.getElement());
}
dragCaptionImage.appendChild(dragCaption);
return dragCaptionImage;
}
Aggregations