Package io.jmix.flowui.devserver
Class ThemeFilesSynchronizer
java.lang.Object
io.jmix.flowui.devserver.ThemeFilesSynchronizer
- All Implemented Interfaces:
Serializable
Watches for the file or sub-directory changes in the given directory.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory) Creates an instance of the file watcher for the given directory taking into account the given file filter.ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, File... watchDirectory) Creates an instance of the file watcher for the given directory.ThemeFilesSynchronizer(org.apache.commons.io.monitor.FileAlterationListener listener, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory) Creates an instance of the file watcher for the given directory taking into account the given file filter. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetTimeout(long timeout) Sets the time interval between file/directory checks.voidstart()Starts the file watching.voidstop()Stops the file watching.voidstop(long stopInterval) Stops the file watching and waits for a given stop interval for watching thread to finish.
-
Constructor Details
-
ThemeFilesSynchronizer
public ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, File... watchDirectory) Creates an instance of the file watcher for the given directory.Reports the changed file or directory as a
Fileinstance to the provided consumer.Watches the files create/delete and directory create/delete events.
- Parameters:
onChangeConsumer- to be called when any change detectedwatchDirectory- the directory to watch for the changes, cannot be empty
-
ThemeFilesSynchronizer
public ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory) Creates an instance of the file watcher for the given directory taking into account the given file filter.Reports the changed file or directory as a
Fileinstance to the provided consumer.Watches the files create/delete and directory create/delete events.
- Parameters:
fileFilter- defined if the given file or directory should be watchedonChangeConsumer- to be called when any change detectedwatchDirectory- the directory to watch for the changes, cannot be empty
-
ThemeFilesSynchronizer
public ThemeFilesSynchronizer(org.apache.commons.io.monitor.FileAlterationListener listener, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory) Creates an instance of the file watcher for the given directory taking into account the given file filter.Reports the changed file or directory as a
Fileinstance to the provided consumer.Reports file and directory changes to the given listener.
- Parameters:
fileFilter- defined if the given file or directory should be watchedlistener- to be invoked once any changes detectedwatchDirectory- the directory to watch for the changes, cannot be empty
-
-
Method Details
-
start
Starts the file watching.- Throws:
Exception- if an error occurs during startup
-
stop
Stops the file watching.- Throws:
Exception- if an error occurs during stop
-
stop
Stops the file watching and waits for a given stop interval for watching thread to finish.- Parameters:
stopInterval- time interval to wait for the watching thread- Throws:
Exception- if an error occurs during stop
-
setTimeout
public void setTimeout(long timeout) Sets the time interval between file/directory checks.- Parameters:
timeout- time interval between file/directory checks
-