use of org.openremote.app.client.widget.IconLabel in project openremote by openremote.
the class MapInfoPanel method setItems.
public void setItems(List<MapInfoItem> infoItems) {
contentPanel.clear();
int itemLineHeightPixels = 20;
int itemMarginPixels = 8;
int itemHeightPixels = itemLineHeightPixels + (itemMarginPixels * 2);
int totalMaxHeight = itemHeightPixels * MAX_ITEMS_BEFORE_SCROLLING;
for (MapInfoItem infoItem : infoItems) {
IconLabel itemIcon = new IconLabel(infoItem.getIcon());
itemIcon.addStyleName(style.infoItemIcon());
FormLabel itemLabel = new FormLabel(TextUtil.ellipsize(infoItem.getLabel(), 35));
itemLabel.addStyleName("flex");
itemLabel.addStyleName(style.infoItemLabel());
Widget itemValue = createItemValue(infoItem);
itemValue.addStyleName(style.infoItemValue());
FlowPanel itemPanel = new FlowPanel();
itemPanel.addStyleName("flex-none layout horizontal center");
itemPanel.addStyleName(style.infoItem());
itemPanel.add(itemIcon);
itemPanel.add(itemLabel);
itemPanel.add(itemValue);
contentPanel.add(itemPanel);
}
// Show up to 6 items, then start scrolling
panel.setHeight(Math.min((infoItems.size() * itemHeightPixels), totalMaxHeight) + "px");
// If the panel is already shown, "blink" it so users know there is an update
if (isOpen()) {
contentPanel.addStyleName(widgetStyle.HighlightBackground());
Browser.getWindow().setTimeout(() -> {
contentPanel.removeStyleName(widgetStyle.HighlightBackground());
}, 250);
}
}
use of org.openremote.app.client.widget.IconLabel in project openremote by openremote.
the class JsonEditorImpl method parseValue.
protected Value parseValue() {
errorPanel.clear();
Value value = null;
String error = null;
try {
value = Values.parse(editor.getText()).orElse(null);
if (value == null)
error = managerMessages.emptyJsonData();
} catch (ValueException ex) {
error = ex.getMessage();
}
if (error != null) {
errorPanel.add(new IconLabel("warning"));
InlineLabel errorMessage = new InlineLabel(error);
errorPanel.add(errorMessage);
errorPanel.setVisible(true);
return null;
}
errorPanel.setVisible(false);
return value;
}
Aggregations