Package chemaxon.marvin.view.swing
Class TableSupport
java.lang.Object
chemaxon.marvin.view.swing.TableSupport
Viewer table support class.
- Since:
- Marvin 5.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidEnqueues an update task.Gets the default size of an MViewPane containing the generated table.Gets the sparse dynamic document storage.Gets the table options component.voidmakeTableMenu(Container menu) Creates Table menu items.voidsetCellSize(Dimension size) Sets the molecule cell size for GridBagView.booleansetDocument(int k, MDocument doc) Sets the k-th record directly.voidsetSDFColoring(String tag, Properties props) Sets SDF coloring.voidstart(MDocSource dsrc, String inputLocName) Starts loading molecules.voidstartNow(MDocSource dsrc, String inputLocName) Starts loading molecules immediately.
-
Field Details
-
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 invalid input: '<' 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
Gets the table options component.- Returns:
- the table options
-
setCellSize
Sets the molecule cell size for GridBagView.- Parameters:
size- the molecule cell size
-
setSDFColoring
Sets SDF coloring.- Parameters:
tag- ?props- ?
-
start
Starts loading molecules. Note that molecule loading is performed asynchronously, on a different thread.- Parameters:
dsrc- the document sourceinputLocName- 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 sourceinputLocName- input file name or other identifier- Throws:
InterruptedException- if another thread has interrupted the task threadInvocationTargetException- if an throwable is thrown when runningrunnable
-
enqueueUpdate
public void enqueueUpdate()Enqueues an update task. -
setDocument
Sets the k-th record directly.Note that this method should normally not be used if the input is an
MDocSource; usestart(MDocSource, String)instead.- Parameters:
k- record indexdoc- the document- Returns:
trueif setting was successful,falseif no ViewHandler found
-
getDocStorage
Gets the sparse dynamic document storage.Note that
MDocStorageshould only be used via record access tasks,- Returns:
- the storage object
- See Also:
-
getDefaultSize
Gets the default size of an MViewPane containing the generated table.- Returns:
- the size
-
makeTableMenu
Creates Table menu items.- Parameters:
menu- the Table menu
-