Package dk.gtz.graphedit.viewmodel
Class FileBufferContainer
java.lang.Object
dk.gtz.graphedit.viewmodel.FileBufferContainer
- All Implemented Interfaces:
IBufferContainer
Buffer container implementation using filepaths as keys.
-
Constructor Summary
ConstructorsConstructorDescriptionFileBufferContainer(IModelSerializer serializer) Constructs a new filepath keyed buffer container. -
Method Summary
Modifier and TypeMethodDescriptionvoidClose and remove a project resource instance from the collection.booleanCheck if the collection contains a project resource instance with the provided keyGet an instance with a lookup keyjavafx.collections.ObservableMap<String,ViewModelProjectResource> Get the underlying obserable buffer map.javafx.beans.property.ObjectProperty<ViewModelProjectResource>Get the currently focused buffer object property.voidOpen and add a new project resource instance to the collection.voidopen(String filename, ViewModelProjectResource model) Open and add a new project resource instance to the collection.
-
Constructor Details
-
FileBufferContainer
Constructs a new filepath keyed buffer container.- Parameters:
serializer- The serializer to use when deserializing the buffers
-
-
Method Details
-
getBuffers
Description copied from interface:IBufferContainerGet the underlying obserable buffer map. This is useful if you want to add eventhandlers to certain events.- Specified by:
getBuffersin interfaceIBufferContainer- Returns:
- the underlying obserable map
-
get
Description copied from interface:IBufferContainerGet an instance with a lookup key- Specified by:
getin interfaceIBufferContainer- Parameters:
filename- the key that the project resource was loaded / inserted with- Returns:
- the associated project resource instance
- Throws:
dk.yalibs.yaerrors.NotFoundException
-
contains
Description copied from interface:IBufferContainerCheck if the collection contains a project resource instance with the provided key- Specified by:
containsin interfaceIBufferContainer- Parameters:
filename- the key to lookup- Returns:
trueif the collection contains a project resource instance with the associated key, otherwisefalse
-
close
Description copied from interface:IBufferContainerClose and remove a project resource instance from the collection. This will fire an event to all event handlers. If the key is not present in the collection, this action should do nothing- Specified by:
closein interfaceIBufferContainer- Parameters:
filename- the key to remove
-
open
Description copied from interface:IBufferContainerOpen and add a new project resource instance to the collection. This will fire an event to all event handlers. This will try to infer the project resource from the key.- Specified by:
openin interfaceIBufferContainer- Parameters:
filename- the key to open
-
open
Description copied from interface:IBufferContainerOpen and add a new project resource instance to the collection. This will fire an event to all event handlers.- Specified by:
openin interfaceIBufferContainer- Parameters:
filename- the key to openmodel- the project resource to insert
-
getCurrentlyFocusedBuffer
Description copied from interface:IBufferContainerGet the currently focused buffer object property. This is useful if you want to react when the focused buffer changes.- Specified by:
getCurrentlyFocusedBufferin interfaceIBufferContainer- Returns:
- the currently focused buffer object property
-