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.createImageIcon( "/split_request_pane.gif" ) );
39 putValue( Action.SHORT_DESCRIPTION, "Changes the orientation of the request pane split" );
40 putValue( Action.ACCELERATOR_KEY, UISupport.getKeyStroke( "alt O" ) );
41 }
42
43 public void actionPerformed( ActionEvent e )
44 {
45 int orientation = splitPane.getOrientation();
46 splitPane.setOrientation( orientation == JSplitPane.HORIZONTAL_SPLIT ? JSplitPane.VERTICAL_SPLIT
47 : JSplitPane.HORIZONTAL_SPLIT );
48 splitPane.resetToPreferredSizes();
49 }
50 }