001    package jigcell.compare;
002    
003    import javax.swing.Icon;
004    
005    /**
006     * A generic transfer agent for a source of data that supports writing.
007     * 
008     * <p>
009     * This code is licensed under the DARPA BioCOMP Open Source License.  See LICENSE for more details.
010     * </p>
011     *
012     * @author Nicholas Allen
013     */
014    
015    public interface IWriteableDataSource extends IDataSource {
016    
017       /**
018        * Option indicating the suggested description for acting on this data source
019        */
020    
021       String OPTION_WRITEDESCRIPTION = "IWriteableDataSource.description";
022    
023       /**
024        * Option indicating the suggested icon for this data source
025        */
026    
027       String OPTION_WRITEICON = "IWriteableDataSource.icon";
028    
029       /**
030        * A prediction on whether this data source can hold a particular type.
031        *
032        * @param clazz Type
033        */
034    
035       boolean getPredictedCompatibility (Class clazz);
036    
037       /**
038        * A prediction on whether this data source can hold a particular type.
039        *
040        * @param instance Type
041        */
042    
043       boolean getPredictedCompatibility (Object instance);
044    
045       /**
046        * The write description option.
047        */
048    
049       String getWriteDescriptionOption ();
050    
051       /**
052        * The write description icon.
053        */
054    
055       Icon getWriteIconOption ();
056    
057       /**
058        * Sets the write description option.
059        *
060        * @param description Description
061        */
062    
063       void setWriteDescriptionOption (String description);
064    
065       /**
066        * Sets the write description icon.
067        *
068        * @param icon Icon
069        */
070    
071       void setWriteIconOption (Icon icon);
072    
073       /**
074        * Writes data to the source destroying the previous contents if multiple objects are not supported.
075        *
076        * @param data Data
077        */
078    
079       void write (Object data) throws Exception;
080    }