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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Enqueues 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.void
makeTableMenu
(Container menu) Creates Table menu items.void
setCellSize
(Dimension size) Sets the molecule cell size for GridBagView.boolean
setDocument
(int k, MDocument doc) Sets the k-th record directly.void
setSDFColoring
(String tag, Properties props) Sets SDF coloring.void
start
(MDocSource dsrc, String inputLocName) Starts loading molecules.void
startNow
(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 < 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:
true
if setting was successful,false
if no ViewHandler found
-
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
Gets the default size of an MViewPane containing the generated table.- Returns:
- the size
-
makeTableMenu
Creates Table menu items.- Parameters:
menu
- the Table menu
-