Class FileBufferContainer

java.lang.Object
dk.gtz.graphedit.viewmodel.FileBufferContainer
All Implemented Interfaces:
IBufferContainer

public class FileBufferContainer extends Object implements IBufferContainer
Buffer container implementation using filepaths as keys.
  • Constructor Details

    • FileBufferContainer

      public FileBufferContainer(IModelSerializer serializer)
      Constructs a new filepath keyed buffer container.
      Parameters:
      serializer - The serializer to use when deserializing the buffers
  • Method Details

    • getBuffers

      public javafx.collections.ObservableMap<String,ViewModelProjectResource> 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 interface IBufferContainer
      Returns:
      the underlying obserable map
    • get

      public ViewModelProjectResource get(String filename) throws dk.yalibs.yaerrors.NotFoundException
      Description copied from interface: IBufferContainer
      Get an instance with a lookup key
      Specified by:
      get in interface IBufferContainer
      Parameters:
      filename - the key that the project resource was loaded / inserted with
      Returns:
      the associated project resource instance
      Throws:
      dk.yalibs.yaerrors.NotFoundException
    • contains

      public boolean contains(String filename)
      Description copied from interface: IBufferContainer
      Check if the collection contains a project resource instance with the provided key
      Specified by:
      contains in interface IBufferContainer
      Parameters:
      filename - the key to lookup
      Returns:
      true if the collection contains a project resource instance with the associated key, otherwise false
    • close

      public void close(String filename)
      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 interface IBufferContainer
      Parameters:
      filename - the key to remove
    • open

      public void open(String filename)
      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 interface IBufferContainer
      Parameters:
      filename - the key to open
    • open

      public void open(String filename, ViewModelProjectResource model)
      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 interface IBufferContainer
      Parameters:
      filename - the key to open
      model - the project resource to insert
    • getCurrentlyFocusedBuffer

      public javafx.beans.property.ObjectProperty<ViewModelProjectResource> 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 interface IBufferContainer
      Returns:
      the currently focused buffer object property