Class LayoutStorage

java.lang.Object
net.sf.jailer.util.LayoutStorage

public class LayoutStorage extends Object
Stores and restores graph layout.
Author:
Ralf Wisser
  • Field Details

    • enabled

      public volatile boolean enabled
      If storage is disabled, no persistent layout is available.
  • Constructor Details

    • LayoutStorage

      public LayoutStorage()
  • Method Details

    • setPosition

      public void setPosition(String rootTable, String table, double[] position)
      Sets position.
      Parameters:
      rootTable - root table
      table - table
      position - position: x, y, isFixed
    • checkSignificance

      public void checkSignificance(String rootTable)
      Removes layout if it is not significant.
      Parameters:
      rootTable - root table for which the layout is
    • getPosition

      public double[] getPosition(String rootTable, String table)
      Gets position.
      Parameters:
      rootTable - root table
      table - table
      Returns:
      position: x, y, isFixed
    • getPositions

      public Map<String,double[]> getPositions(String root)
      Gets positions of all tables for a given root-table.
      Parameters:
      root - the root table
      Returns:
      positions of all tables for a the root-table
    • removeAll

      public void removeAll(String root)
      Removes all position information for a given root table.
      Parameters:
      root - the root table
    • removeAll

      public void removeAll()
      Removes all position information.
    • store

      public void store(PrintWriter out)
      Stores the layout into a stream.
      Parameters:
      out - the stream to write to
    • store

      public void store(PrintWriter out, Map<String,Map<String,double[]>> positions)
      Stores the given layout positions into a stream.
      Parameters:
      out - the stream to write to
      positions - the positions to store, keyed by root table and then table name
    • restore

      public void restore(String file)
      Restores a layout from a file.
      Parameters:
      file - the file path to restore from
    • setTempStorage

      public void setTempStorage(Map<String,double[]> tmp)
      Sets temporary storage for positions (used for undo/redo). When set to a non-null value, all position reads and writes use this map instead of the persistent storage.
      Parameters:
      tmp - the temporary position map, or null to disable temporary storage