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.reporters.gui;
20:
21: import java.awt.BorderLayout;
22:
23: import javax.swing.Box;
24:
25: import org.apache.jmeter.reporters.ResultAction;
26: import org.apache.jmeter.gui.OnErrorPanel;
27: import org.apache.jmeter.processor.gui.AbstractPostProcessorGui;
28: import org.apache.jmeter.testelement.OnErrorTestElement;
29: import org.apache.jmeter.testelement.TestElement;
30:
31: /**
32: * Create a Result Action Test Element
33: *
34: */
35: public class ResultActionGui extends AbstractPostProcessorGui {
36:
37: private OnErrorPanel errorPanel;
38:
39: public ResultActionGui() {
40: super ();
41: init();
42: }
43:
44: /**
45: * @see org.apache.jmeter.gui.JMeterGUIComponent#getStaticLabel()
46: */
47: public String getLabelResource() {
48: return "resultaction_title"; //$NON-NLS-1$
49: }
50:
51: /**
52: * @see org.apache.jmeter.gui.JMeterGUIComponent#configure(TestElement)
53: */
54: public void configure(TestElement el) {
55: super .configure(el);
56: errorPanel
57: .configure(((OnErrorTestElement) el).getErrorAction());
58: }
59:
60: /**
61: * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
62: */
63: public TestElement createTestElement() {
64: ResultAction resultAction = new ResultAction();
65: modifyTestElement(resultAction);
66: return resultAction;
67: }
68:
69: /**
70: * Modifies a given TestElement to mirror the data in the gui components.
71: *
72: * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
73: */
74: public void modifyTestElement(TestElement te) {
75: super .configureTestElement(te);
76: ((OnErrorTestElement) te).setErrorAction(errorPanel
77: .getOnErrorSetting());
78: }
79:
80: /**
81: * Implements JMeterGUIComponent.clearGui
82: */
83: public void clearGui() {
84: super .clearGui();
85:
86: errorPanel.configure(OnErrorTestElement.ON_ERROR_CONTINUE);
87: }
88:
89: private void init() {
90: setLayout(new BorderLayout());
91: setBorder(makeBorder());
92: Box box = Box.createVerticalBox();
93: box.add(makeTitlePanel());
94: errorPanel = new OnErrorPanel();
95: box.add(errorPanel);
96: add(box, BorderLayout.NORTH);
97: }
98: }
|