1
2
3
4
5
6
7
8
9
10
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 {
31 private final JSplitPane splitPane;
32
33 public ChangeSplitPaneOrientationAction(JSplitPane splitPane)
34 {
35 super();
36 this.splitPane = splitPane;
37
38 putValue(Action.SMALL_ICON, UISupport
39 .createImageIcon("/split_request_pane.gif"));
40 putValue(Action.SHORT_DESCRIPTION,
41 "Changes the orientation of the request pane split");
42 putValue( Action.ACCELERATOR_KEY, UISupport.getKeyStroke( "alt O" ));
43 }
44
45 public void actionPerformed(ActionEvent e)
46 {
47 int orientation = splitPane.getOrientation();
48 splitPane.setOrientation(orientation == JSplitPane.HORIZONTAL_SPLIT ? JSplitPane.VERTICAL_SPLIT
49 : JSplitPane.HORIZONTAL_SPLIT);
50 splitPane.resetToPreferredSizes();
51 }
52 }