1
2
3
4
5
6
7
8
9
10
11
12
13 package com/eviware/soapui/support/components/package-summary.html">> com.eviware.soapui.support.components;
14
15 import javax.swing.Action;
16 import javax.swing.JButton;
17
18 import com.eviware.soapui.support.HelpActionMarker;
19 import com.eviware.soapui.support.action.swing.ActionList;
20 import com.eviware.soapui.support.action.swing.ActionSupport;
21 import com.eviware.soapui.support.swing.JXButtonPanel;
22 import com.jgoodies.forms.builder.ButtonBarBuilder;
23
24 public class JButtonBar extends JXButtonPanel
25 {
26 private ButtonBarBuilder builder;
27 private JButton defaultButton;
28
29 public JButtonBar()
30 {
31 builder = new ButtonBarBuilder( this );
32 }
33
34 public void addActions(ActionList actions)
35 {
36 for( int c = 0; c < actions.getActionCount(); c++ )
37 {
38 Action action = actions.getActionAt( c );
39
40 if( !(action instanceof HelpActionMarker) && c == 0 )
41 builder.addGlue();
42
43 if( action == ActionSupport.SEPARATOR_ACTION )
44 {
45 builder.addUnrelatedGap();
46 }
47 else
48 {
49 if( c > 0 )
50 builder.addRelatedGap();
51
52 JButton button = new JButton( action);
53 if( c == 0 || actions.getDefaultAction() == action)
54 defaultButton = button;
55
56 if( action.getValue( Action.SMALL_ICON ) != null )
57 button.setText( null );
58
59 builder.addFixed( button);
60 }
61
62 if( action instanceof HelpActionMarker && c == 0 )
63 builder.addGlue();
64 }
65 }
66
67 public JButton getDefaultButton()
68 {
69 return defaultButton;
70 }
71 }