");
-// }
+
+ // Wrap content in
+ HTMLUtil.indent(html, indent+1);
+ html.println("
");
for (final Widget child : children)
child.getHTML(html, indent+2);
-// if (style != 3)
-// { // Close the content-div
- HTMLUtil.indent(html, indent+1);
- html.println("
");
-// }
+ // Close the content-div
+ HTMLUtil.indent(html, indent+1);
+ html.println("
");
HTMLUtil.indent(html, indent);
}
diff --git a/src/main/java/dbwr/widgets/Version.java b/src/main/java/dbwr/widgets/Version.java
new file mode 100644
index 0000000..14c202c
--- /dev/null
+++ b/src/main/java/dbwr/widgets/Version.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Oak Ridge National Laboratory.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the LICENSE
+ * which accompanies this distribution
+ ******************************************************************************/
+package dbwr.widgets;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/** Widget version info
+ * @author Kay Kasemir
+ */
+public class Version
+{
+ private static final Pattern VERSION_PATTERN = Pattern.compile("([0-9]+)\\.([0-9]+)\\.([0-9]+)");
+ // Some older displays used a shorter "1.0" format without patch level
+ private static final Pattern SHORT_VERSION_PATTERN = Pattern.compile("([0-9]+)\\.([0-9]+)");
+
+ public final int major, minor, patch;
+
+ public Version(final int major, final int minor, final int patch)
+ {
+ this.major = major;
+ this.minor = minor;
+ this.patch = patch;
+ }
+
+ /** Parse version from text
+ * @param version "Major.Minor.Patch" type of text or null for "0.0.0"
+ * @return {@link Version}
+ * @throws IllegalArgumentException on error
+ */
+ public static Version parse(final String version)
+ {
+ if (version == null)
+ return new Version(0, 0, 0);
+
+ // First try the long format
+ Matcher matcher = VERSION_PATTERN.matcher(version);
+ if (matcher.matches())
+ return new Version(Integer.parseInt(matcher.group(1)),
+ Integer.parseInt(matcher.group(2)),
+ Integer.parseInt(matcher.group(3)));
+
+ matcher = SHORT_VERSION_PATTERN.matcher(version);
+ if (matcher.matches())
+ return new Version(Integer.parseInt(matcher.group(1)),
+ Integer.parseInt(matcher.group(2)),
+ 0);
+ throw new IllegalArgumentException("Invalid version string '" + version + "'");
+ }
+
+ public int compareTo(final Version other)
+ {
+ if (major != other.major)
+ return major - other.major;
+ if (minor != other.minor)
+ return minor - other.minor;
+ return patch - other.patch;
+ }
+
+ @Override
+ public String toString()
+ {
+ return major + "." + minor + "." + patch;
+ }
+}
+
+
diff --git a/src/main/java/dbwr/widgets/Widget.java b/src/main/java/dbwr/widgets/Widget.java
index 2d55840..66a1173 100644
--- a/src/main/java/dbwr/widgets/Widget.java
+++ b/src/main/java/dbwr/widgets/Widget.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 Oak Ridge National Laboratory.
+ * Copyright (c) 2019-2024 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the LICENSE
* which accompanies this distribution
@@ -59,6 +59,9 @@ public class Widget implements ParentWidget
/** Styles (inline) to add to the HTML for this widget */
protected final Map
styles = new LinkedHashMap<>();
+ /** Widget version */
+ protected final Version version;
+
/** Widget position and size */
protected final int x, y, width, height;
@@ -88,6 +91,8 @@ public Widget(final ParentWidget parent, final Element xml, final String type) t
public Widget(final ParentWidget parent, final Element xml, final String type, final int default_width, final int default_height) throws Exception
{
this.parent = parent;
+
+ version = Version.parse(xml.getAttribute("version"));
x = XMLUtil.getChildInteger(xml, "x").orElse(0);
y = XMLUtil.getChildInteger(xml, "y").orElse(0);
width = XMLUtil.getChildInteger(xml, "width").orElse(default_width);
diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp
index 725c823..c70815f 100644
--- a/src/main/webapp/index.jsp
+++ b/src/main/webapp/index.jsp
@@ -120,6 +120,7 @@ view.jsp?cache=false&display=file:/Path/to/Display+Builder/01_main.bob
+ 2024-01-31 Group widget: Correct inset for style 'None' and fix colors for newly added example.
2023-09-11 LED only displayed values above zero instead of non-zero, incl. negative. Byte monitor layout float calc
2023-08-15 Preserve spaces in labels, text updates
2023-07-28 Cache invalidates entry based on modification time