01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.support.actions;
14:
15: import java.awt.event.ActionEvent;
16:
17: import javax.swing.AbstractAction;
18: import javax.swing.Action;
19: import javax.swing.JSplitPane;
20:
21: import com.eviware.soapui.support.UISupport;
22:
23: /**
24: * Changes the orientation of a JSplitPane
25: *
26: * @author Ole.Matzura
27: */
28:
29: public class ChangeSplitPaneOrientationAction extends AbstractAction {
30: private final JSplitPane splitPane;
31:
32: public ChangeSplitPaneOrientationAction(JSplitPane splitPane) {
33: super ();
34: this .splitPane = splitPane;
35:
36: putValue(Action.SMALL_ICON, UISupport
37: .createImageIcon("/split_request_pane.gif"));
38: putValue(Action.SHORT_DESCRIPTION,
39: "Changes the orientation of the request pane split");
40: putValue(Action.ACCELERATOR_KEY, UISupport
41: .getKeyStroke("alt O"));
42: }
43:
44: public void actionPerformed(ActionEvent e) {
45: int orientation = splitPane.getOrientation();
46: splitPane
47: .setOrientation(orientation == JSplitPane.HORIZONTAL_SPLIT ? JSplitPane.VERTICAL_SPLIT
48: : JSplitPane.HORIZONTAL_SPLIT);
49: splitPane.resetToPreferredSizes();
50: }
51: }
|