Class EnvironmentMonitor

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.orderedlayout.HorizontalLayout
in.virit.EnvironmentMonitor
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.orderedlayout.HorizontalLayout>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.orderedlayout.FlexComponent, com.vaadin.flow.component.orderedlayout.ThemableLayout, Serializable

public class EnvironmentMonitor extends com.vaadin.flow.component.orderedlayout.HorizontalLayout
A reusable component that displays both temperature and humidity gauges with appropriate titles. Provides methods to update the environmental values.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent

    com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment, com.vaadin.flow.component.orderedlayout.FlexComponent.JustifyContentMode
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    EnvironmentMonitor(double initialTemperature, double initialHumidity)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the current humidity gauge component.
    Gets the current temperature gauge component.
    void
    setEnvironmentValues(double temperature, double humidity)
    Updates both temperature and humidity values.
    void
    setHumidity(double humidity)
    Updates the humidity value displayed on the gauge.
    void
    setTemperature(double temperature)
    Updates the temperature value displayed on the gauge.
    void
    setTemperatureRange(double minTemp, double maxTemp)
    Sets the temperature range for the temperature gauge.
    void
    Sets the temperature unit for the temperature gauge.

    Methods inherited from class com.vaadin.flow.component.orderedlayout.HorizontalLayout

    add, add, addAndExpand, addComponentAtIndex, addToEnd, addToEnd, addToMiddle, addToMiddle, addToStart, addToStart, getAlignItems, getAlignSelf, getDefaultVerticalComponentAlignment, getVerticalComponentAlignment, replace, setAlignItems, setAlignSelf, setDefaultVerticalComponentAlignment, setSpacing, setVerticalComponentAlignment

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent

    expand, getFlexGrow, getFlexShrink, getJustifyContentMode, setFlexGrow, setFlexShrink, setJustifyContentMode

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, addComponentAsFirst, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasOrderedComponents

    getChildren, getComponentAt, getComponentCount, indexOf

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.orderedlayout.ThemableLayout

    getBoxSizing, getSpacing, getThemeList, isMargin, isPadding, isSpacing, isWrap, setBoxSizing, setMargin, setPadding, setSpacing, setSpacing, setWrap
  • Constructor Details

    • EnvironmentMonitor

      public EnvironmentMonitor()
    • EnvironmentMonitor

      public EnvironmentMonitor(double initialTemperature, double initialHumidity)
  • Method Details

    • setTemperature

      public void setTemperature(double temperature)
      Updates the temperature value displayed on the gauge.
      Parameters:
      temperature - the new temperature value
    • setHumidity

      public void setHumidity(double humidity)
      Updates the humidity value displayed on the gauge.
      Parameters:
      humidity - the new humidity value (0-100)
    • setEnvironmentValues

      public void setEnvironmentValues(double temperature, double humidity)
      Updates both temperature and humidity values.
      Parameters:
      temperature - the new temperature value
      humidity - the new humidity value (0-100)
    • getTemperatureGauge

      public TemperatureGauge getTemperatureGauge()
      Gets the current temperature gauge component.
      Returns:
      the TemperatureGauge instance
    • getHumidityGauge

      public HumidityGauge getHumidityGauge()
      Gets the current humidity gauge component.
      Returns:
      the HumidityGauge instance
    • setTemperatureUnit

      public void setTemperatureUnit(TemperatureGauge.TemperatureUnit unit)
      Sets the temperature unit for the temperature gauge.
      Parameters:
      unit - the temperature unit (CELSIUS or FAHRENHEIT)
    • setTemperatureRange

      public void setTemperatureRange(double minTemp, double maxTemp)
      Sets the temperature range for the temperature gauge.
      Parameters:
      minTemp - minimum temperature value
      maxTemp - maximum temperature value