uk.ac.starlink.table.gui
Class PasteLoader
java.lang.Object
|
+--java.awt.event.MouseAdapter
|
+--uk.ac.starlink.util.gui.StringPaster
|
+--uk.ac.starlink.table.gui.PasteLoader
- All Implemented Interfaces:
- EventListener, MouseListener
- public abstract class PasteLoader
- extends StringPaster
MouseListener which will load a table when a string is pasted from
the system selection into a component its listening to.
To use this class, subclass it implementing the abstract
tableLoaded(uk.ac.starlink.table.StarTable, java.lang.String)
method and install it on a component using
Component.addMouseListener(java.awt.event.MouseListener)
.
Any time you paste a string into the component from the system
selection (by default, using a single click of the middle mouse button)
it will be submitted to the table factory using
StarTableFactory.makeStarTable(java.lang.String)
and loaded asynchronously. If it loads successfully then
tableLoaded(uk.ac.starlink.table.StarTable, java.lang.String)
will be called.
If the pasted text is very long, it's ignored.
- Since:
- 3 Dec 2004
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PasteLoader
public PasteLoader(Component parent)
- Constructor.
- Parameters:
parent
- parent component (may be used for placing windows)
getTableFactory
public abstract StarTableFactory getTableFactory()
- Provides the table factory to be used for loading tables.
- Returns:
- table factory
pasted
protected void pasted(String loc)
- Specified by:
pasted
in class StringPaster
getToolkit
protected Toolkit getToolkit()
- Overrides:
getToolkit
in class StringPaster
tableLoaded
protected abstract void tableLoaded(StarTable table,
String location)
- Invoked if a table specified by pasting a string into a component
watched by this listener is loaded successfully.
- Parameters:
table
- tablelocation
- the pasted string (trimmed of spaces)