Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Manager UI improvements
  • Loading branch information
Christian Bauer committed May 21, 2017
1 parent 872868e commit 2ca0f62
Show file tree
Hide file tree
Showing 75 changed files with 6,792 additions and 1,973 deletions.
Expand Up @@ -72,6 +72,10 @@ interface AttributesEditorStyle extends CssResource, AttributesEditor.Style {
String stringEditor();

String booleanEditor();

String regularAttribute();

String highlightAttribute();
}

@UiField
Expand Down
Expand Up @@ -39,6 +39,12 @@

.booleanEditor {
}

.regularAttribute {
}

.highlightAttribute {
}
</ui:style>

<w:FlexSplitPanel ui:field="splitPanel"
Expand Down
Expand Up @@ -66,6 +66,10 @@ interface AttributesBrowserStyle extends CssResource, AttributesBrowser.Style {
String stringEditor();

String booleanEditor();

String regularAttribute();

String highlightAttribute();
}

@UiField
Expand Down
Expand Up @@ -31,6 +31,14 @@

.booleanEditor {
}

.regularAttribute {
border-left: 4px solid;
}

.highlightAttribute {
border-left: 4px solid;
}
</ui:style>

<w:FlexSplitPanel ui:field="splitPanel"
Expand Down
Expand Up @@ -32,9 +32,11 @@
import org.openremote.model.attribute.AttributeEvent;
import org.openremote.model.attribute.AttributeExecuteStatus;
import org.openremote.model.attribute.AttributeState;
import org.openremote.model.attribute.AttributeType;
import org.openremote.model.datapoint.DatapointInterval;
import org.openremote.model.datapoint.NumberDatapoint;
import org.openremote.model.event.bus.EventRegistration;
import org.openremote.model.util.TextUtil;
import org.openremote.model.value.ValueType;

import java.util.ArrayList;
Expand Down
Expand Up @@ -69,7 +69,6 @@ protected void createAttributeGroups() {

protected FormLabel createAttributeLabel(AssetAttribute attribute) {
FormLabel formLabel = new FormLabel(TextUtil.ellipsize(getAttributeLabel(attribute), 30));
formLabel.setIcon("edit");
formLabel.addStyleName("larger");
return formLabel;
}
Expand Down Expand Up @@ -145,7 +144,13 @@ protected FormGroup createNewAttributeEditor() {
List<ValidationFailure> failures = attribute.getValidationFailures();
if (failures.isEmpty()) {
formGroup.setError(false);

attribute.getType().ifPresent(attributeType ->
attribute.addMeta(attributeType.getDefaultMetaItems())
);

getAttributes().add(attribute);

showInfo(environment.getMessages().attributeAdded(attribute.getName().get()));
build();
} else {
Expand Down
Expand Up @@ -71,6 +71,10 @@ public interface Style {
String numberEditor();

String booleanEditor();

String regularAttribute();

String highlightAttribute();
}

public interface AttributeEditor extends IsWidget {
Expand Down Expand Up @@ -284,7 +288,20 @@ protected void createAttributeGroups() {
protected FormGroup createAttributeGroup(AssetAttribute attribute) {
FormGroup formGroup = new FormGroup();

formGroup.addFormLabel(createAttributeLabel(attribute));
if (attribute.hasAgentLink()) {
formGroup.addStyleName(container.getStyle().highlightAttribute());
formGroup.addStyleName(environment.getWidgetStyle().HighlightBorder());
} else {
formGroup.addStyleName(container.getStyle().regularAttribute());
formGroup.addStyleName(environment.getWidgetStyle().RegularBorder());
}

FormLabel formLabel = createAttributeLabel(attribute);
formLabel.setIcon(attribute.isExecutable()
? "cog"
: attribute.getType().map(AttributeType::getIcon).orElse(AttributeType.DEFAULT_ICON)
);
formGroup.addFormLabel(formLabel);

StringBuilder infoText = new StringBuilder();
if (attribute.isExecutable()) {
Expand Down
Expand Up @@ -36,6 +36,7 @@
import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetAttribute;
import org.openremote.model.attribute.AttributeEvent;
import org.openremote.model.attribute.AttributeType;
import org.openremote.model.event.bus.EventBus;
import org.openremote.model.event.bus.EventRegistration;
import org.openremote.model.geo.GeoJSON;
Expand Down Expand Up @@ -198,6 +199,7 @@ protected void showAssetInfoItems() {
List<MapInfoItem> infoItems = dashboardAttributes.stream()
.filter(attribute -> attribute.getLabel().isPresent())
.map(attribute -> new MapInfoItem(
attribute.getType().map(AttributeType::getIcon).orElse(AttributeType.DEFAULT_ICON),
attribute.getLabel().get(),
attribute.getFormat().orElse(null),
attribute.getValue().orElse(null)
Expand All @@ -207,6 +209,7 @@ protected void showAssetInfoItems() {
.collect(Collectors.toList());
if (asset.hasGeoFeature()) {
infoItems.add(0, new MapInfoItem(
"map-marker",
environment.getMessages().location(),
null,
Values.create(asset.getCoordinatesLabel())
Expand Down
Expand Up @@ -25,16 +25,22 @@

public class MapInfoItem {

final protected String icon;
final protected String label;
final protected String format;
final protected Value value;

public MapInfoItem(String label, String format, Value value) {
public MapInfoItem(String icon, String label, String format, Value value) {
this.icon = icon;
this.label = label;
this.format = format;
this.value = value;
}

public String getIcon() {
return icon;
}

public String getLabel() {
return label;
}
Expand Down
Expand Up @@ -55,6 +55,8 @@ public interface Style extends CssResource {
String panel();

String content();

String infoItemIcon();
}

@UiField
Expand Down Expand Up @@ -85,6 +87,9 @@ public void setItems(List<MapInfoItem> infoItems) {
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)
);
Expand All @@ -95,8 +100,9 @@ public void setItems(List<MapInfoItem> infoItems) {
itemValue.addStyleName(style.infoItemValue());

FlowPanel itemPanel = new FlowPanel();
itemPanel.addStyleName("flex-none layout horizontal");
itemPanel.addStyleName("flex-none layout horizontal center");
itemPanel.addStyleName(style.infoItem());
itemPanel.add(itemIcon);
itemPanel.add(itemLabel);
itemPanel.add(itemValue);
contentPanel.add(itemPanel);
Expand Down
Expand Up @@ -23,6 +23,13 @@
margin: 8px;
}

.infoItemIcon {
width: 1.4em;
text-align: center;
margin-right: 0.4em;
opacity: 0.4;
}

.infoItemLabel {
font-size: 14px;
line-height: 16px;
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.openremote.manager.client.map;

import com.google.gwt.user.client.ui.IsWidget;
import org.openremote.model.util.Pair;
import org.openremote.model.geo.GeoJSON;
import org.openremote.model.value.ObjectValue;

Expand Down
Expand Up @@ -405,6 +405,14 @@ public String HighlightBackground() {
return "or-HighlightBackground";
}

public String HighlightBorder() {
return "or-HighlightBorder";
}

public String RegularBorder() {
return "or-RegularBorder";
}

public String JsonEditor() {
return "or-JsonEditor";
}
Expand Down
Expand Up @@ -92,7 +92,7 @@ public interface ClickListener {
offset.addAll(create(0), create(0.8));
layout.put("text-offset", offset);

layout.put("icon-image", "marker-15");
layout.put("icon-image", "marker_15");
offset = Values.createArray();
offset.addAll(create(0), create(-4));
layout.put("icon-offset", offset);
Expand All @@ -102,7 +102,7 @@ public interface ClickListener {
//paint.put("icon-color", "rgb(193, 215, 47)");
paint.put("text-color", "#000");
paint.put("text-halo-color", "#fff");
paint.put("text-halo-width", 4.0);
paint.put("text-halo-width", 2.0);
paint.put("text-halo-blur", 4.0);

LAYER_DROPPED_PIN.put("id", FEATURE_LAYER_DROPPED_PIN);
Expand Down
Expand Up @@ -219,9 +219,11 @@ validationFailure[INVALID_ATTRIBUTE_NAME]=Invalid attribute name.
validationFailure[MISSING_ATTRIBUTE_TYPE]=Missing attribute type.
validationFailure[MISSING_ATTRIBUTE_VALUE_TIMESTAMP]=Missing attribute value timestamp.
validationFailure[VALUE_DOES_NOT_MATCH_ATTRIBUTE_TYPE]=Value does not match attribute type.
validationFailure[PERCENTAGE_NOT_WITHIN_BOUNDS]=Percentage value must be a number between 0 and 100.
validationFailure[PERCENTAGE_OUT_OF_RANGE]=Percentage value must be a number between 0 and 100.
validationFailure[VALUE_DOES_NOT_MATCH_ASSET_META_TYPE]=Value does not match well-known meta item''s expected type.
validationFailure[NOT_A_VALID_NUMBER]=Must be a number.
validationFailure[WRONG_COLOR_FORMAT]=Wrong color format.
validationFailure[TEMPERATURE_OUT_OF_RANGE]=Temperature out of scale''s range.
syslog=System Log
filterLevel=Filter level
pauseLog=Pause
Expand Down
2 changes: 1 addition & 1 deletion manager/client/src/main/webapp/bower.json
Expand Up @@ -17,6 +17,6 @@
],
"dependencies": {
"iron-flex-layout": "~1.3.1",
"font-awesome": "~4.6.3"
"font-awesome": "~4.7.0"
}
}
Expand Up @@ -23,14 +23,14 @@
"Gemfile.lock",
"*.md"
],
"version": "4.6.3",
"_release": "4.6.3",
"version": "4.7.0",
"_release": "4.7.0",
"_resolution": {
"type": "version",
"tag": "v4.6.3",
"commit": "0f618911b105195c931ec5d5bef425a2a2806cab"
"tag": "v4.7.0",
"commit": "a3fe90fa5f6fac55d197f9cbd18e3f57dafb716c"
},
"_source": "https://github.com/FortAwesome/Font-Awesome.git",
"_target": "~4.6.3",
"_target": "~4.7.0",
"_originalSource": "font-awesome"
}

0 comments on commit 2ca0f62

Please sign in to comment.