- java.lang.Object
-
- eu.hansolo.tilesfx.TimeSection
-
- All Implemented Interfaces:
java.lang.Comparable<TimeSection>
public class TimeSection extends java.lang.Object implements java.lang.Comparable<TimeSection>
Created by hansolo on 31.01.16.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimeSection.TimeSectionEvent
-
Field Summary
Fields Modifier and Type Field Description TimeSection.TimeSectionEventENTERED_EVENTTimeSection.TimeSectionEventLEFT_EVENT
-
Constructor Summary
Constructors Constructor Description TimeSection()TimeSection(java.lang.String JSON_STRING)Represents an area of a given range, defined by a start and stop time.TimeSection(java.time.LocalTime START, java.time.LocalTime STOP)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.image.Image ICON, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color TEXT_COLOR)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.image.Image ICON, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color HIGHLIGHT_COLOR, javafx.scene.paint.Color TEXT_COLOR, boolean ACTIVE, java.time.DayOfWeek... DAYS)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.paint.Color COLOR)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color TEXT_COLOR)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.image.Image ICON, javafx.scene.paint.Color COLOR)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.paint.Color COLOR)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color HIGHLIGHT_COLOR)TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color HIGHLIGHT_COLOR, java.time.DayOfWeek... DAYS)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.property.ReadOnlyBooleanPropertyactiveProperty()voidaddDay(java.time.DayOfWeek DAY)voidcheckForTime(java.time.LocalTime VALUE)Checks if the section contains the given time and fires an event in case the value "entered" or "left" the section.voidcheckForTimeAndDate(java.time.ZonedDateTime DATE_TIME)Checks if the section days contains the day of week of the given ZonedDateTime object and if the section contains the time itself.voidcheckForTimeAndDay(java.time.LocalTime VALUE, java.time.DayOfWeek DAY)voidclearDays()javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>colorProperty()intcompareTo(TimeSection SECTION)booleancontains(java.time.LocalTime VALUE)Returns true if the given time is within the range between section.getStart() and section.getStop()booleanequals(TimeSection SECTION)voidfireTimeSectionEvent(TimeSection.TimeSectionEvent EVENT)javafx.scene.paint.ColorgetColor()Returns the color that will be used to colorize the section in a clock.java.util.Set<java.time.DayOfWeek>getDays()java.util.List<java.time.DayOfWeek>getDaysAsList()javafx.scene.paint.ColorgetHighlightColor()Returns the color that will be used to colorize the section in a gauge when it is highlighted.javafx.scene.image.ImagegetImage()Returns the image that was defined for the section.javafx.event.EventHandler<TimeSection.TimeSectionEvent>getOnTimeSectionEntered()javafx.event.EventHandler<TimeSection.TimeSectionEvent>getOnTimeSectionLeft()java.time.LocalTimegetStart()Returns the time when the section begins.java.time.LocalTimegetStop()Returns the time when the section ends.java.lang.StringgetText()Returns the text that was set for the section.javafx.scene.paint.ColorgetTextColor()Returns the color that will be used to colorize the section text.javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>highlightColorProperty()javafx.beans.property.ObjectProperty<javafx.scene.image.Image>iconProperty()booleanisActive()javafx.beans.property.ObjectProperty<javafx.event.EventHandler<TimeSection.TimeSectionEvent>>onTimeSectionEnteredProperty()javafx.beans.property.ObjectProperty<javafx.event.EventHandler<TimeSection.TimeSectionEvent>>onTimeSectionLeftProperty()voidremoveDay(java.time.DayOfWeek DAY)voidsetActive(boolean ACTIVE)voidsetColor(javafx.scene.paint.Color COLOR)Defines the color that will be used to colorize the section in a clock.voidsetDays(java.time.DayOfWeek... DAYS)voidsetDays(java.util.Set<java.time.DayOfWeek> DAYS)voidsetHighlightColor(javafx.scene.paint.Color COLOR)Defines the color that will be used to colorize a highlighted sectionvoidsetIcon(javafx.scene.image.Image IMAGE)Defines an image for the section.voidsetOnTimeSectionEntered(javafx.event.EventHandler<TimeSection.TimeSectionEvent> value)voidsetOnTimeSectionLeft(javafx.event.EventHandler<TimeSection.TimeSectionEvent> value)voidsetStart(java.time.LocalTime START)Defines the time when the section starts.voidsetStop(java.time.LocalTime STOP)Defines the time when the section endsvoidsetText(java.lang.String TEXT)Defines the text for the sectionvoidsetTextColor(javafx.scene.paint.Color COLOR)Defines the color that will be used to colorize the section textjavafx.beans.property.ObjectProperty<java.time.LocalTime>startProperty()javafx.beans.property.ObjectProperty<java.time.LocalTime>stopProperty()javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>textColorProperty()javafx.beans.property.StringPropertytextProperty()org.json.simple.JSONObjecttoJSON()java.lang.StringtoJSONString()java.lang.StringtoString()
-
-
-
Field Detail
-
ENTERED_EVENT
public final TimeSection.TimeSectionEvent ENTERED_EVENT
-
LEFT_EVENT
public final TimeSection.TimeSectionEvent LEFT_EVENT
-
-
Constructor Detail
-
TimeSection
public TimeSection(java.lang.String JSON_STRING)
Represents an area of a given range, defined by a start and stop time. This class is used for regions and areas in many clocks. It is possible to check a time against the defined range and fire events in case the value enters or leaves the defined region.
-
TimeSection
public TimeSection()
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.paint.Color COLOR)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color HIGHLIGHT_COLOR)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color HIGHLIGHT_COLOR, java.time.DayOfWeek... DAYS)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, javafx.scene.image.Image ICON, javafx.scene.paint.Color COLOR)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.paint.Color COLOR)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color TEXT_COLOR)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.image.Image ICON, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color TEXT_COLOR)
-
TimeSection
public TimeSection(java.time.LocalTime START, java.time.LocalTime STOP, java.lang.String TEXT, javafx.scene.image.Image ICON, javafx.scene.paint.Color COLOR, javafx.scene.paint.Color HIGHLIGHT_COLOR, javafx.scene.paint.Color TEXT_COLOR, boolean ACTIVE, java.time.DayOfWeek... DAYS)
-
-
Method Detail
-
getStart
public java.time.LocalTime getStart()
Returns the time when the section begins.- Returns:
- the time when the section begins
-
setStart
public void setStart(java.time.LocalTime START)
Defines the time when the section starts.- Parameters:
START-
-
startProperty
public javafx.beans.property.ObjectProperty<java.time.LocalTime> startProperty()
-
getStop
public java.time.LocalTime getStop()
Returns the time when the section ends.- Returns:
- the time when the section ends
-
setStop
public void setStop(java.time.LocalTime STOP)
Defines the time when the section ends- Parameters:
STOP-
-
stopProperty
public javafx.beans.property.ObjectProperty<java.time.LocalTime> stopProperty()
-
getText
public java.lang.String getText()
Returns the text that was set for the section.- Returns:
- the text that was set for the section
-
setText
public void setText(java.lang.String TEXT)
Defines the text for the section- Parameters:
TEXT-
-
textProperty
public javafx.beans.property.StringProperty textProperty()
-
getImage
public javafx.scene.image.Image getImage()
Returns the image that was defined for the section.- Returns:
- the image that was defined for the section
-
setIcon
public void setIcon(javafx.scene.image.Image IMAGE)
Defines an image for the section.- Parameters:
IMAGE-
-
iconProperty
public javafx.beans.property.ObjectProperty<javafx.scene.image.Image> iconProperty()
-
getColor
public javafx.scene.paint.Color getColor()
Returns the color that will be used to colorize the section in a clock.- Returns:
- the color that will be used to colorize the section
-
setColor
public void setColor(javafx.scene.paint.Color COLOR)
Defines the color that will be used to colorize the section in a clock.- Parameters:
COLOR-
-
colorProperty
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> colorProperty()
-
getHighlightColor
public javafx.scene.paint.Color getHighlightColor()
Returns the color that will be used to colorize the section in a gauge when it is highlighted.- Returns:
- the color that will be used to colorize a highlighted section
-
setHighlightColor
public void setHighlightColor(javafx.scene.paint.Color COLOR)
Defines the color that will be used to colorize a highlighted section- Parameters:
COLOR-
-
highlightColorProperty
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> highlightColorProperty()
-
getTextColor
public javafx.scene.paint.Color getTextColor()
Returns the color that will be used to colorize the section text.- Returns:
- the color that will bused to colorize the section text
-
setTextColor
public void setTextColor(javafx.scene.paint.Color COLOR)
Defines the color that will be used to colorize the section text- Parameters:
COLOR-
-
textColorProperty
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> textColorProperty()
-
isActive
public boolean isActive()
-
setActive
public void setActive(boolean ACTIVE)
-
activeProperty
public javafx.beans.property.ReadOnlyBooleanProperty activeProperty()
-
getDays
public java.util.Set<java.time.DayOfWeek> getDays()
-
getDaysAsList
public java.util.List<java.time.DayOfWeek> getDaysAsList()
-
setDays
public void setDays(java.time.DayOfWeek... DAYS)
-
setDays
public void setDays(java.util.Set<java.time.DayOfWeek> DAYS)
-
addDay
public void addDay(java.time.DayOfWeek DAY)
-
removeDay
public void removeDay(java.time.DayOfWeek DAY)
-
clearDays
public void clearDays()
-
contains
public boolean contains(java.time.LocalTime VALUE)
Returns true if the given time is within the range between section.getStart() and section.getStop()- Parameters:
VALUE-- Returns:
- true if the given time is within the range of the section
-
checkForTime
public void checkForTime(java.time.LocalTime VALUE)
Checks if the section contains the given time and fires an event in case the value "entered" or "left" the section. With this one can react if a time "enters"/"leaves" a section. This can be useful to control things like switching lights on if the time enters the region and switching it of again when the time left the region. When calling this method the days won't be taken into account but only the time!!! If the TimeSection is not active no event will be fired.- Parameters:
VALUE-
-
checkForTimeAndDay
public void checkForTimeAndDay(java.time.LocalTime VALUE, java.time.DayOfWeek DAY)
-
checkForTimeAndDate
public void checkForTimeAndDate(java.time.ZonedDateTime DATE_TIME)
Checks if the section days contains the day of week of the given ZonedDateTime object and if the section contains the time itself. With this one can react if a time "enters"/"leaves" a section.- Parameters:
DATE_TIME-
-
equals
public boolean equals(TimeSection SECTION)
-
compareTo
public int compareTo(TimeSection SECTION)
- Specified by:
compareToin interfacejava.lang.Comparable<TimeSection>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toJSON
public org.json.simple.JSONObject toJSON()
-
toJSONString
public java.lang.String toJSONString()
-
onTimeSectionEnteredProperty
public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<TimeSection.TimeSectionEvent>> onTimeSectionEnteredProperty()
-
setOnTimeSectionEntered
public final void setOnTimeSectionEntered(javafx.event.EventHandler<TimeSection.TimeSectionEvent> value)
-
getOnTimeSectionEntered
public final javafx.event.EventHandler<TimeSection.TimeSectionEvent> getOnTimeSectionEntered()
-
onTimeSectionLeftProperty
public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<TimeSection.TimeSectionEvent>> onTimeSectionLeftProperty()
-
setOnTimeSectionLeft
public final void setOnTimeSectionLeft(javafx.event.EventHandler<TimeSection.TimeSectionEvent> value)
-
getOnTimeSectionLeft
public final javafx.event.EventHandler<TimeSection.TimeSectionEvent> getOnTimeSectionLeft()
-
fireTimeSectionEvent
public void fireTimeSectionEvent(TimeSection.TimeSectionEvent EVENT)
-
-