01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.jmeter.report.gui.action;
20:
21: import java.awt.event.ActionEvent;
22: import java.util.HashSet;
23: import java.util.Set;
24:
25: import org.apache.jmeter.gui.action.Command;
26: import org.apache.jmeter.gui.ReportGuiPackage;
27: import org.apache.jmeter.gui.NamePanel;
28:
29: /**
30: * @author Michael Stover
31: * @version $Revision: 493793 $
32: */
33: public class ReportEditCommand implements Command {
34: private static Set commands = new HashSet();
35: static {
36: commands.add("edit");
37: }
38:
39: public ReportEditCommand() {
40: }
41:
42: public void doAction(ActionEvent e) {
43: ReportGuiPackage guiPackage = ReportGuiPackage.getInstance();
44: guiPackage.getMainFrame().setMainPanel(
45: (javax.swing.JComponent) guiPackage.getCurrentGui());
46: guiPackage.getMainFrame().setEditMenu(
47: guiPackage.getTreeListener().getCurrentNode()
48: .createPopupMenu());
49: // TODO: I believe the following code (to the end of the method) is
50: // obsolete,
51: // since NamePanel no longer seems to be the GUI for any component:
52: if (!(guiPackage.getCurrentGui() instanceof NamePanel)) {
53: guiPackage.getMainFrame().setFileLoadEnabled(true);
54: guiPackage.getMainFrame().setFileSaveEnabled(true);
55: } else {
56: guiPackage.getMainFrame().setFileLoadEnabled(false);
57: guiPackage.getMainFrame().setFileSaveEnabled(false);
58: }
59: }
60:
61: public Set getActionNames() {
62: return commands;
63: }
64: }
|