From 56070bc27a15bd016e2a9ac15d1a281131bfc8b5 Mon Sep 17 00:00:00 2001 From: Radek Jajko Date: Wed, 16 Jun 2021 11:05:33 +0200 Subject: [PATCH 1/4] #1707 FIX z-index auto change and button background --- WebContent/WEB-INF/tags/displayView.tag | 12 +- WebContent/WEB-INF/tags/pointComponent.tag | 166 +++++++++--------- WebContent/resources/view.js | 8 +- .../view/component/ButtonComponent.java | 40 ++--- 4 files changed, 109 insertions(+), 117 deletions(-) diff --git a/WebContent/WEB-INF/tags/displayView.tag b/WebContent/WEB-INF/tags/displayView.tag index fc89d791d4..8bfa086de3 100644 --- a/WebContent/WEB-INF/tags/displayView.tag +++ b/WebContent/WEB-INF/tags/displayView.tag @@ -37,8 +37,8 @@ -
+
@@ -56,8 +56,8 @@ -
+
@@ -107,8 +107,8 @@ -
+
${vc.staticContent}
diff --git a/WebContent/WEB-INF/tags/pointComponent.tag b/WebContent/WEB-INF/tags/pointComponent.tag index dc91430808..29bb8165ed 100644 --- a/WebContent/WEB-INF/tags/pointComponent.tag +++ b/WebContent/WEB-INF/tags/pointComponent.tag @@ -1,84 +1,84 @@ -<%-- - Mango - Open Source M2M - http://mango.serotoninsoftware.com - Copyright (C) 2006-2011 Serotonin Software Technologies Inc. - @author Matthew Lohbihler - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see http://www.gnu.org/licenses/. - - Used only for non-compound view components. ---%><%@include file="/WEB-INF/tags/decl.tagf"%><%-- ---%><%@tag body-content="empty"%><%-- ---%><%@attribute name="vc" type="com.serotonin.mango.view.component.ViewComponent" required="true" rtexprvalue="true"%> - - - -
onmouseover="vcOver('c${vc.id}');" onmouseout="vcOut('c${vc.id}');"> -
- -
-
- - - - - - - -
- -
- -
-
- -
- -
-
- -
- -
-
- -
- - -
-
- - -
${vc.staticContent}
-
- -
-
-
- - -
-
-
+<%-- + Mango - Open Source M2M - http://mango.serotoninsoftware.com + Copyright (C) 2006-2011 Serotonin Software Technologies Inc. + @author Matthew Lohbihler + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/. + + Used only for non-compound view components. +--%><%@include file="/WEB-INF/tags/decl.tagf"%><%-- +--%><%@tag body-content="empty"%><%-- +--%><%@attribute name="vc" type="com.serotonin.mango.view.component.ViewComponent" required="true" rtexprvalue="true"%> + + + +
onmouseover="vcOver('c${vc.id}');" onmouseout="vcOut('c${vc.id}', ${vc.z});"> +
+ +
+ + + + + + + + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+
+ + +
+
+
+ +
${vc.staticContent}
+
+ +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/WebContent/resources/view.js b/WebContent/resources/view.js index 2cc3f1e32d..1fae774e22 100644 --- a/WebContent/resources/view.js +++ b/WebContent/resources/view.js @@ -159,15 +159,13 @@ mango.view.hideChart = function(componentId, event, source) { hideLayer('c'+ componentId +'ChartLayer'); } -function vcOver(base, amt) { - if (!amt) - amt = 10; +function vcOver(base, amt = 99) { setZIndex(base, amt); showLayer(base + 'Controls'); }; -function vcOut(base) { - setZIndex(base, 0); +function vcOut(base, zIndex = 0) { + setZIndex(base, zIndex); hideLayer(base +'Controls'); }; diff --git a/src/br/org/scadabr/view/component/ButtonComponent.java b/src/br/org/scadabr/view/component/ButtonComponent.java index 6b7334be92..f08179d973 100644 --- a/src/br/org/scadabr/view/component/ButtonComponent.java +++ b/src/br/org/scadabr/view/component/ButtonComponent.java @@ -67,32 +67,26 @@ public int getHeight() { private void createButtonScript() { StringBuilder sb = new StringBuilder(); - sb.append("var s = '';"); - sb.append("if (value) "); + sb.append("var s = '';").append("if (value) "); + sb.append(" s += \"\";"); - sb.append(" else"); - sb - .append(" s += \"\";"); - } else { - sb - .append(" s += \"\";"); - sb.append(" else"); - sb - .append(" s += \"\";"); + sb.append("width:").append(width).append("px; "); + sb.append("height:").append(height).append("px; "); } + sb.append("background-color:").append(getBkgdColorOverride()).append(";"); + sb.append("'/>").append("\"; "); + sb.append("else"); + + sb.append(" s += \"").append("\"; "); sb.append(" return s;"); setScript(sb.toString()); } From a4f2d9e0d80aa90c7cda96c9652bfa91a1421786 Mon Sep 17 00:00:00 2001 From: Radek Jajko Date: Wed, 16 Jun 2021 11:56:15 +0200 Subject: [PATCH 2/4] #1707 ADD z-index label and fixed overlapping components menus. During the editing the graphical component while changing the z-index value the current z-index is displayed. --- WebContent/WEB-INF/jsp/viewEdit.jsp | 18 +++++++++++++++++- WebContent/WEB-INF/tags/displayView.tag | 6 +++--- WebContent/WEB-INF/tags/pointComponent.tag | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/WebContent/WEB-INF/jsp/viewEdit.jsp b/WebContent/WEB-INF/jsp/viewEdit.jsp index f0b3d00979..27564fffff 100644 --- a/WebContent/WEB-INF/jsp/viewEdit.jsp +++ b/WebContent/WEB-INF/jsp/viewEdit.jsp @@ -187,8 +187,11 @@ function moveUpComponent(viewComponentId) { var div = $("c" + viewComponentId); - div.style.zIndex = Number(div.style.zIndex) + 1; + if(div.style.zIndex < 99) { + div.style.zIndex = Number(div.style.zIndex) + 1; + } ViewDwr.setViewComponentZIndex(div.viewComponentId, Number(div.style.zIndex)); + updateZIndexLabel(viewComponentId, div.style.zIndex); } function moveDownComponent(viewComponentId) { @@ -197,6 +200,13 @@ div.style.zIndex = div.style.zIndex - 1; } ViewDwr.setViewComponentZIndex(div.viewComponentId, Number(div.style.zIndex)); + updateZIndexLabel(viewComponentId, div.style.zIndex); + } + + function updateZIndexLabel(viewComponentId, value) { + var spanIndex = document.getElementById("c" + viewComponentId + "zindex"); + spanIndex.parentNode.parentNode.style.display = "initial"; + spanIndex.innerText = Number(value); } function positionEditor(compId, editorId) { @@ -587,6 +597,7 @@ title="viewEdit.deletePointView"/> + @@ -613,6 +624,7 @@ title="viewEdit.deleteStaticView"/> + @@ -632,6 +644,7 @@ title="viewEdit.deletePointView"/> + @@ -655,6 +668,7 @@ title="viewEdit.deletePointView"/> + @@ -682,6 +696,7 @@ title="viewEdit.deletePointView"/> + @@ -706,6 +721,7 @@ title="viewEdit.deleteStaticView"/> + diff --git a/WebContent/WEB-INF/tags/displayView.tag b/WebContent/WEB-INF/tags/displayView.tag index 8bfa086de3..abacf2b213 100644 --- a/WebContent/WEB-INF/tags/displayView.tag +++ b/WebContent/WEB-INF/tags/displayView.tag @@ -38,7 +38,7 @@
+ onmouseover="vcOver('c${vc.id}', ${vc.z+1});" onmouseout="vcOut('c${vc.id}', ${vc.z});"> @@ -57,7 +57,7 @@
+ onmouseover="vcOver('c${vc.id}', ${vc.z+1});" onmouseout="vcOut('c${vc.id}, ${vc.z}');">
@@ -108,7 +108,7 @@
+ onmouseover="vcOver('c${vc.id}', ${vc.z+1});" onmouseout="vcOut('c${vc.id}', ${vc.z});"> ${vc.staticContent}
diff --git a/WebContent/WEB-INF/tags/pointComponent.tag b/WebContent/WEB-INF/tags/pointComponent.tag index 29bb8165ed..fbba850231 100644 --- a/WebContent/WEB-INF/tags/pointComponent.tag +++ b/WebContent/WEB-INF/tags/pointComponent.tag @@ -24,7 +24,7 @@
onmouseover="vcOver('c${vc.id}');" onmouseout="vcOut('c${vc.id}', ${vc.z});"> + onmouseover="vcOver('c${vc.id}', ${vc.z+1});" onmouseout="vcOut('c${vc.id}', ${vc.z});">
From 4653bd16acb3f17e2a5120b415d5b913a107a607 Mon Sep 17 00:00:00 2001 From: Radek Jajko Date: Thu, 17 Jun 2021 09:44:28 +0200 Subject: [PATCH 3/4] #1707 FIX z-index label to be displayed on point layer reveal. --- WebContent/WEB-INF/jsp/viewEdit.jsp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/WebContent/WEB-INF/jsp/viewEdit.jsp b/WebContent/WEB-INF/jsp/viewEdit.jsp index 27564fffff..80039d1e75 100644 --- a/WebContent/WEB-INF/jsp/viewEdit.jsp +++ b/WebContent/WEB-INF/jsp/viewEdit.jsp @@ -394,6 +394,12 @@ } + function revealPointControls(viewComponentId) { + showLayer("c" + viewComponentId + "Controls"); + var div = $("c" + viewComponentId); + updateZIndexLabel(viewComponentId, div.style.zIndex); + } + function deleteConfirm(){ if(document.getElementById("deleteCheckbox").checked) { document.getElementById("deleteButton").style.visibility = 'visible'; @@ -574,7 +580,7 @@
-
- -
-
- -