Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/KeyHole/src/org/litesoft/aokeyhole/swing/namevaluecomponents/NamedSelectOptionComponent.java

Diff revisions: vs.
  @@ -7,59 +7,49 @@
7 7
8 8 import javax.swing.*;
9 9
10 - public class NamedSelectOptionComponent extends SimpleNamedComponent
11 - {
10 + public class NamedSelectOptionComponent extends SimpleNamedComponent {
12 11 private String[] mValidOptions;
13 12
14 - public NamedSelectOptionComponent( NameValueComponentParams pParams, String[] pValidOptions )
15 - {
13 + public NamedSelectOptionComponent( NameValueComponentParams pParams, String[] pValidOptions ) {
16 14 super( pParams );
17 15
18 16 mValidOptions = pValidOptions;
19 17 }
20 18
21 19 @Override
22 - protected JComponent createCenterContent()
23 - {
20 + protected JComponent createCenterContent() {
24 21 JComboBox field = createComboBox();
25 22 mInputComponent = field;
26 23 field.addActionListener( new JComboBoxChangedListener( this ) );
27 24 return noGrow( field );
28 25 }
29 26
30 - protected JComboBox createComboBox()
31 - {
27 + protected JComboBox createComboBox() {
32 28 return new FloodingJComboBox( mValidOptions, !isDataRequired() );
33 29 }
34 30
35 - protected FloodingJComboBox getComboBox()
36 - {
31 + protected FloodingJComboBox getComboBox() {
37 32 return (FloodingJComboBox) mInputComponent;
38 33 }
39 34
40 35 @Override
41 - public Object getComponentValue()
42 - {
36 + public Object getComponentValue() {
43 37 return getComboBox().getSelectedItem();
44 38 }
45 39
46 40 @Override
47 - public void setComponentValue( Object pValue )
48 - {
41 + public void setComponentValue( Object pValue ) {
49 42 FloodingJComboBox comboBox = getComboBox();
50 43 comboBox.setSelectedItem( comboBox.ensureAnOption( pValue ) );
51 44 }
52 45
53 46 @Override
54 - public boolean setOptions( String[] pOptions )
55 - {
47 + public boolean setOptions( String[] pOptions ) {
56 48 mSystemUpdate = true;
57 - try
58 - {
49 + try {
59 50 getComboBox().setOptions( pOptions, isDataRequired() );
60 51 }
61 - finally
62 - {
52 + finally {
63 53 mSystemUpdate = false;
64 54 }
65 55 mValidOptions = pOptions;