1 /*==================================================================== 2 3 Objectweb Explorer Framework 4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL 5 Contact: openccm@objectweb.org 6 7 This library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Lesser General Public 9 License as published by the Free Software Foundation; either 10 version 2.1 of the License, or any later version. 11 12 This library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with this library; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 USA 21 22 Initial developer(s): Jerome Moroy, Philippe Merle. 23 Contributor(s): ______________________________________. 24 25 ====================================================================*/ 26 27 package org.objectweb.util.explorer.swing.gui.api; 28 29 /** 30 * This interface is mainly used for complicated actions. 31 * In other word, you can you this interface when you use a JDialog to specify parameters. 32 * You can easily create simple JDialog without worrying about how the component are displayed. 33 * Here is an example of action using the DialogAction: 34 * <pre> 35 * public class CreateInterfaceTypeAction 36 * implements MenuItem, DialogAction { 37 * 38 * protected BooleanBox booleanBox_; 39 * protected LabelBox nameBox_; 40 * 41 * protected void createBox() { 42 * nameBox_ = new LabelBox("Name"); 43 * dialog_.addBox(nameBox_); 44 * booleanBox_ = new BooleanBox("Value","TRUE","FALSE",true); 45 * dialog_.addBox(booleanBox_); 46 * } 47 * 48 * public void actionPerformed(MenuItemEvent e) throws Exception{ 49 * ... 50 * DialogBox dialog = new DefaultDialogBox("Sample dialog"); 51 * createBox(); 52 * dialog.setValidateAction(this); 53 * dialog.show(); 54 * } 55 * 56 * public int getStatus(TreeView treeView) { 57 * return MenuItem.DISABLED_STATUS; 58 * } 59 * 60 * public void executeAction() throws Exception { 61 * String name = nameBox_.getLabel(); 62 * boolean isClient = isClientBox_.getValue(); 63 * ... 64 * } 65 * 66 * } 67 * </pre> 68 * 69 * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jerome Moroy</a> 70 * 71 * @version 0.1 72 */ 73 public interface DialogAction { 74 75 /** 76 * Executes an action 77 * @throws Exception Any exception may be thrown 78 */ 79 public void executeAction() throws Exception; 80 81 }