Class TableSupport

java.lang.Object
chemaxon.marvin.view.swing.TableSupport

@PublicApi public class TableSupport extends Object
Viewer table support class.
Since:
Marvin 5.0
  • Field Details

    • scheduler

      public final TaskScheduler scheduler
      Record access task scheduler. To prevent multithreading problems when the user scrolls the molecule table, record access operations should be performed only in tasks running on the scheduler's thread. Example:
       final MDocStorage ds = tableSupport.getDocStorage();
       final int start = 0;
       final int end = ds.getSize();
       Runnable task = new Runnable() {
           public void run() {
           try {
               for(int i = start; i < end; ++i) {
               MDocument d = ds.getMainDoc(i);
               ...
                  }
              } catch(MDocStorage.RecordUnavailableException ex) {
               ...
              } catch(IOException ex) {
               ...
              }
           }
       };
       tableSupport.scheduler.invokeLater(task, start);
       try {
           tableSupport.scheduler.waitForAll();
       } catch(InterruptedException ex) {
           ex.printStackTrace();
       }
       
  • Method Details

    • getTableOptions

      public TableOptions getTableOptions()
      Gets the table options component.
      Returns:
      the table options
    • setCellSize

      public void setCellSize(Dimension size)
      Sets the molecule cell size for GridBagView.
      Parameters:
      size - the molecule cell size
    • setSDFColoring

      public void setSDFColoring(String tag, Properties props)
      Sets SDF coloring.
      Parameters:
      tag - ?
      props - ?
    • start

      public void start(MDocSource dsrc, String inputLocName)
      Starts loading molecules. Note that molecule loading is performed asynchronously, on a different thread.
      Parameters:
      dsrc - the document source
      inputLocName - input file name or other identifier
    • startNow

      public void startNow(MDocSource dsrc, String inputLocName) throws InterruptedException, InvocationTargetException
      Starts loading molecules immediately. This method must not be called from the AWT event dispatch thread.
      Parameters:
      dsrc - the document source
      inputLocName - input file name or other identifier
      Throws:
      InterruptedException - if another thread has interrupted the task thread
      InvocationTargetException - if an throwable is thrown when running runnable
    • enqueueUpdate

      public void enqueueUpdate()
      Enqueues an update task.
    • setDocument

      public boolean setDocument(int k, MDocument doc)
      Sets the k-th record directly.

      Note that this method should normally not be used if the input is an MDocSource; use start(MDocSource, String) instead.

      Parameters:
      k - record index
      doc - the document
      Returns:
      true if setting was successful, false if no ViewHandler found
    • getDocStorage

      public MDocStorage getDocStorage()
      Gets the sparse dynamic document storage.

      Note that MDocStorage should only be used via record access tasks,

      Returns:
      the storage object
      See Also:
    • getDefaultSize

      public Dimension getDefaultSize()
      Gets the default size of an MViewPane containing the generated table.
      Returns:
      the size
    • makeTableMenu

      public void makeTableMenu(Container menu)
      Creates Table menu items.
      Parameters:
      menu - the Table menu