1 /* 2 * Copyright (c) 2003-2008 by Cosylab d. d. 3 * 4 * This file is part of CosyBeans-Common. 5 * 6 * CosyBeans-Common is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * CosyBeans-Common is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with CosyBeans-Common. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package com.cosylab.gui.components.customizer; 21 22 import javax.swing.JComponent; 23 24 25 /** 26 * <p> 27 * <code>Editor</code> controls editor panel, which prowides GUI editor for 28 * some aspect of displayer. 29 * </p> 30 * 31 * <p> 32 * Implementator of this interface must provide defult constructor for 33 * implementation class. 34 * </p> 35 * 36 * @author <a href="mailto:igor.kriznar@cosylab.com">Igor Kriznar</a> 37 * @author <a href="mailto:jernej.kamenik@cosylab.com">Jernej Kamenik</a> 38 * @version $id$ 39 */ 40 public interface Editor 41 { 42 /** List of names of editable aspects with this editor.*/ 43 public static String[] ASPECTS = { }; 44 45 /** 46 * Starts editing <b>session</b> and returns conponent, which will provide 47 * GUI for editing some <code>aspect</code>, given with parameter, of 48 * the given displayer. IF displayer is not design to edit given component 49 * in given aspect, <code>IllegalArgumentException</code> is thrown. 50 * 51 * @param aspect the aspect in which displayer will be edited 52 * 53 * @return editor editor component 54 */ 55 JComponent getEditorComponent(Object object, String aspect) 56 throws IllegalArgumentException; 57 58 /** 59 * Applies current settings to the edited displayer. This does not stop 60 * current editing session. 61 */ 62 void applySettings(); 63 64 /** 65 * Test if this editor can edit given displayer with given aspect. 66 * 67 * @param aspect the aspect in which displayer should be edited 68 * 69 * @return true if this editor can edit given displayer 70 */ 71 boolean canEdit(Object object, String aspect); 72 73 /** 74 * Reverts editor values to currently used settings. This does not stop 75 * current editing session. 76 */ 77 void revertSettings(); 78 79 /** 80 * Stop current editing session and release edited displayer. 81 */ 82 void stopEditing(); 83 } 84 85 /* __oOo__ */