001package csheets.ext.comments.ui; 002 003import javax.swing.*; 004 005import csheets.ext.Extension; 006import csheets.ext.simple.ui.ExampleMenu; 007import csheets.ui.ctrl.UIController; 008import csheets.ui.ext.*; 009 010/** 011 * This class implements the UI interface extension for the comments extension. 012 * A UI interface extension must extend the UIExtension abstract class. 013 * 014 * @see UIExtension 015 * @author Alexandre Braganca 016 * @author Einar Pehrson 017 */ 018public class UIExtensionComments extends UIExtension { 019 020 /** The icon to display with the extension's name */ 021 // private Icon icon; 022 023 /** A cell decorator that visualizes comments on cells */ 024 private CellDecorator cellDecorator; 025 026 /** A side bar that provides editing of comments */ 027 private JComponent sideBar; 028 029 /** The menu of the extension */ 030 // private ExampleMenu menu; 031 032 public UIExtensionComments(Extension extension, UIController uiController) { 033 super(extension, uiController); 034 } 035 036 /** 037 * Returns an icon to display with the extension's name. 038 * 039 * @return an icon with style 040 */ 041 @Override 042 public Icon getIcon() { 043 return null; 044 } 045 046 /** 047 * Returns an instance of a class that implements JMenu. In this simple case 048 * this class only supplies one menu option. 049 * 050 * @see ExampleMenu 051 * @return a JMenu component 052 */ 053 @Override 054 public JMenu getMenu() { 055 return null; 056 } 057 058 /** 059 * Returns a cell decorator that visualizes comments on cells. 060 * 061 * @return decorator for cells with comments 062 */ 063 @Override 064 public CellDecorator getCellDecorator() { 065 if (cellDecorator == null) 066 cellDecorator = new CommentedCellDecorator(); 067 return cellDecorator; 068 } 069 070 /** 071 * Returns a table decorator that visualizes the data added by the 072 * extension. 073 * 074 * @return a table decorator, or null if the extension does not provide one 075 */ 076 @Override 077 public TableDecorator getTableDecorator() { 078 return null; 079 } 080 081 /** 082 * Returns a toolbar that gives access to extension-specific functionality. 083 * 084 * @return a JToolBar component, or null if the extension does not provide 085 * one 086 */ 087 @Override 088 public JToolBar getToolBar() { 089 return null; 090 } 091 092 /** 093 * Returns a side bar that provides editing of comments. 094 * 095 * @return a side bar 096 */ 097 @Override 098 public JComponent getSideBar() { 099 if (sideBar == null) 100 sideBar = new CommentPanel(uiController); 101 return sideBar; 102 } 103}