001/* 002 * Copyright (c) 2005 Einar Pehrson 003 * 004 * This file is part of 005 * CleanSheets Extension for Style 006 * 007 * CleanSheets Extension for Style is free software; you can 008 * redistribute it and/or modify it under the terms of the GNU General Public 009 * License as published by the Free Software Foundation; either version 2 of 010 * the License, or (at your option) any later version. 011 * 012 * CleanSheets Extension for Style is distributed in the hope that 013 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 014 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 015 * See the GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with CleanSheets Extension for Style; if not, write to the 019 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 020 * Boston, MA 02111-1307 USA 021 */ 022package csheets.ext.style.ui; 023 024import javax.swing.Icon; 025import javax.swing.ImageIcon; 026import javax.swing.JMenu; 027import javax.swing.JToolBar; 028 029import csheets.ext.style.StyleExtension; 030import csheets.ui.ctrl.UIController; 031import csheets.ui.ext.UIExtension; 032 033/** 034 * The user interface extension for style. 035 * @author Einar Pehrson 036 */ 037public class StyleUIExtension extends UIExtension { 038 039 /** The icon to display with the extension's name */ 040 private Icon icon; 041 042 /** A menu that provides editing of style */ 043 private StyleMenu menu; 044 045 /** A toolbar that provides editing of style */ 046 private StyleToolBar toolBar; 047 048 /** 049 * Creates a new user interface extension for style. 050 * @param extension the extension for which components are provided 051 * @param uiController the user interface controller 052 */ 053 public StyleUIExtension(StyleExtension extension, UIController uiController) { 054 super(extension, uiController); 055 } 056 057 /** 058 * Returns an icon to display with the extension's name. 059 * @return an icon with style 060 */ 061 public Icon getIcon() { 062 if (icon == null) 063 icon = new ImageIcon( 064 StyleExtension.class.getResource("res/img/logo.gif")); 065 return icon; 066 } 067 068 /** 069 * Returns a menu that provides editing of style. 070 * @return a JMenu component 071 */ 072 public JMenu getMenu() { 073 if (menu == null) 074 menu = new StyleMenu(uiController); 075 return menu; 076 } 077 078 /** 079 * Returns a toolbar that provides editing of style. 080 * @return a JToolBar component 081 */ 082 public JToolBar getToolBar() { 083 if (toolBar == null) 084 toolBar = new StyleToolBar(uiController); 085 return toolBar; 086 } 087}