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 TypeMethodDescriptionvoid
Close and remove a project resource instance from the collection.boolean
Check 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.void
Open and add a new project resource instance to the collection.void
open
(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:IBufferContainer
Get the underlying obserable buffer map. This is useful if you want to add eventhandlers to certain events.- Specified by:
getBuffers
in interfaceIBufferContainer
- Returns:
- the underlying obserable map
-
get
Description copied from interface:IBufferContainer
Get an instance with a lookup key- Specified by:
get
in 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:IBufferContainer
Check if the collection contains a project resource instance with the provided key- Specified by:
contains
in interfaceIBufferContainer
- Parameters:
filename
- the key to lookup- Returns:
true
if the collection contains a project resource instance with the associated key, otherwisefalse
-
close
Description copied from interface:IBufferContainer
Close 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:
close
in interfaceIBufferContainer
- Parameters:
filename
- the key to remove
-
open
Description copied from interface:IBufferContainer
Open 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:
open
in interfaceIBufferContainer
- Parameters:
filename
- the key to open
-
open
Description copied from interface:IBufferContainer
Open and add a new project resource instance to the collection. This will fire an event to all event handlers.- Specified by:
open
in interfaceIBufferContainer
- Parameters:
filename
- the key to openmodel
- the project resource to insert
-
getCurrentlyFocusedBuffer
Description copied from interface:IBufferContainer
Get the currently focused buffer object property. This is useful if you want to react when the focused buffer changes.- Specified by:
getCurrentlyFocusedBuffer
in interfaceIBufferContainer
- Returns:
- the currently focused buffer object property
-