Skip to content

Commit

Permalink
Merge pull request eclipse-archived#990 from resetnow/basicui-rollerb…
Browse files Browse the repository at this point in the history
…lind-value

BasicUI: display rollerblind state if required, fixes eclipse-archived#976
  • Loading branch information
kaikreuzer authored and Vlad Ivanov committed Feb 8, 2016
1 parent 93b5027 commit 71c6f0c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<span class="mdl-form__label">
%label%
</span>
<div class="mdl-form__control mdl-form__rollerblind" data-control-type="rollerblind" data-item="%item%">
<span class="mdl-form__value mdl-form__value--rollerblind">
%value%
</span>
<div class="mdl-form__control mdl-form__rollerblind" data-control-type="rollerblind" data-item="%item%" data-has-value="%has_value%">
<button class="mdl-button mdl-button--raised mdl-js-button mdl-js-ripple-effect mdl-form__rollerblind--up">
<!-- keyboard_arrow_up -->
<i class="material-icons">&#xe987;</i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderExcep

String snippet = getSnippet(snippetName);
State state = itemUIRegistry.getState(w);
String value = getValue(w);

snippet = StringUtils.replace(snippet, "%id%", itemUIRegistry.getWidgetId(w));
snippet = StringUtils.replace(snippet, "%category%", getCategory(w));
snippet = StringUtils.replace(snippet, "%icon_type%", config.getIconType());
snippet = StringUtils.replace(snippet, "%state%", getState(w));
snippet = StringUtils.replace(snippet, "%value%", value);
snippet = StringUtils.replace(snippet, "%has_value%", new Boolean(value != "").toString());
snippet = StringUtils.replace(snippet, "%item%", w.getItem());
snippet = StringUtils.replace(snippet, "%label%", getLabel(w));
snippet = StringUtils.replace(snippet, "%servletname%", WebAppServlet.SERVLET_NAME);
Expand Down
14 changes: 14 additions & 0 deletions extensions/ui/org.eclipse.smarthome.ui.basic/web-src/smarthome.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,20 @@
_t.buttonDown = _t.parentNode.querySelector(o.rollerblind.down);
_t.buttonStop = _t.parentNode.querySelector(o.rollerblind.stop);

_t.hasValue = _t.parentNode.getAttribute("data-has-value") === "true";
_t.valueNode = _t.parentNode.parentNode.querySelector(o.formValue);
_t.setValuePrivate = function(value) {
if (!_t.hasValue) {
return;
}
if (value === "DOWN") {
value = "100";
} else if (value === "UP") {
value = "0";
}
_t.valueNode.innerHTML = value;
};

function emitEvent(value) {
_t.parentNode.dispatchEvent(createEvent(
"control-change", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@
&--setpoint {
padding: 0 10px 0 5px;
}
&--rollerblind {
padding: 0 10px 0 5px;
}
}
&--no-label {
.mdl-form__title {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

0 comments on commit 71c6f0c

Please sign in to comment.