01: /*
02: * DeleteColumnCommand.java
03: *
04: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or any later version.
10: *
11: * This program 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 this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: */
21:
22: package org.executequery.actions.othercommands;
23:
24: import java.awt.event.ActionEvent;
25: import javax.swing.JPanel;
26: import org.executequery.GUIUtilities;
27: import org.executequery.gui.browser.BrowserViewPanel;
28: import org.executequery.gui.table.TableFunction;
29:
30: /* ----------------------------------------------------------
31: * CVS NOTE: Changes to the CVS repository prior to the
32: * release of version 3.0.0beta1 has meant a
33: * resetting of CVS revision numbers.
34: * ----------------------------------------------------------
35: */
36:
37: /** <p>
38: * A Class class.
39: * <P>
40: * @author Takis Diakoumis
41: * @version $Revision: 1.3 $
42: * @date $Date: 2006/05/14 06:56:52 $
43: */
44: public class DeleteColumnCommand extends BaseOtherActionCommand {
45:
46: public void execute(ActionEvent e) {
47: JPanel panel = GUIUtilities.getSelectedCentralPane();
48: if (panel != null) {
49: TableFunction tableFunction = null;
50:
51: // check if the current panel is a TableFunction
52: if (panel instanceof TableFunction) {
53: tableFunction = (TableFunction) panel;
54: }
55:
56: // otherwise, check if we are on the browser
57: // then check if the current browser view is a
58: // TableFunction implementation
59: else if (panel instanceof BrowserViewPanel) {
60: BrowserViewPanel viewPanel = (BrowserViewPanel) panel;
61: if (viewPanel.getCurrentView() instanceof TableFunction) {
62: tableFunction = (TableFunction) viewPanel
63: .getCurrentView();
64: }
65: }
66: // do the action
67: if (tableFunction != null) {
68: tableFunction.deleteRow();
69: }
70: }
71:
72: }
73:
74: /*
75: private CreateTablePanel panel;
76:
77: public DeleteColumnCommand(CreateTablePanel panel) {
78: super(IconUtilities.loadIcon("ColumnDelete24.gif"));
79: this.panel = panel;
80: }
81:
82: public void execute(ActionEvent e) {
83: panel.deleteRow();
84: }
85: */
86: }
|