001package csheets.ext.comments;
002
003import csheets.core.Cell;
004import csheets.ext.Extension;
005import csheets.ext.comments.ui.UIExtensionComments;
006import csheets.ui.ctrl.UIController;
007import csheets.ui.ext.UIExtension;
008
009/**
010 * An extension to support comments on cells.
011 * An extension must extend the Extension abstract class.
012 * The class that implements the Extension is the "bootstrap" of the extension.
013 * @see Extension
014 * @author Alexandre Braganca
015 * @author Einar Pehrson
016 */
017public class CommentsExtension extends Extension {
018
019        /** The name of the extension */
020        public static final String NAME = "Comments";
021
022        /**
023         * Creates a new Example extension.
024         */
025        public CommentsExtension() {
026                super(NAME);
027        }
028        
029        /**
030         * Makes the given cell commentable.
031         * @param cell the cell to comment
032         * @return a commentable cell
033         */
034        public CommentableCell extend(Cell cell) {
035                return new CommentableCell(cell);
036        }
037        
038        /**
039         * Returns the user interface extension of this extension 
040         * @param uiController the user interface controller
041         * @return a user interface extension, or null if none is provided
042         */
043        public UIExtension getUIExtension(UIController uiController) {
044                return new UIExtensionComments(this, uiController);
045        }
046}
047