Subversion Repository Public Repository

litesoft

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

Diff revisions: vs.
  @@ -1,58 +1,58 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.aokeyhole.swing.namevaluecomponents;
3 -
4 - import org.litesoft.aokeyhole.swing.*;
5 - import org.litesoft.aokeyhole.swing.simplecomponents.*;
6 - import org.litesoft.aokeyhole.toolkit.*;
7 -
8 - import javax.swing.*;
9 -
10 - public class NamedSelectOptionComponent extends SimpleNamedComponent {
11 - private String[] mValidOptions;
12 -
13 - public NamedSelectOptionComponent( NameValueComponentParams pParams, String[] pValidOptions ) {
14 - super( pParams );
15 -
16 - mValidOptions = pValidOptions;
17 - }
18 -
19 - @Override
20 - protected JComponent createCenterContent() {
21 - JComboBox field = createComboBox();
22 - mInputComponent = field;
23 - field.addActionListener( new JComboBoxChangedListener( this ) );
24 - return noGrow( field );
25 - }
26 -
27 - protected JComboBox createComboBox() {
28 - return new FloodingJComboBox( mValidOptions, !isDataRequired() );
29 - }
30 -
31 - protected FloodingJComboBox getComboBox() {
32 - return (FloodingJComboBox) mInputComponent;
33 - }
34 -
35 - @Override
36 - public Object getComponentValue() {
37 - return getComboBox().getSelectedItem();
38 - }
39 -
40 - @Override
41 - public void setComponentValue( Object pValue ) {
42 - FloodingJComboBox comboBox = getComboBox();
43 - comboBox.setSelectedItem( comboBox.ensureAnOption( pValue ) );
44 - }
45 -
46 - @Override
47 - public boolean setOptions( String[] pOptions ) {
48 - mSystemUpdate = true;
49 - try {
50 - getComboBox().setOptions( pOptions, isDataRequired() );
51 - }
52 - finally {
53 - mSystemUpdate = false;
54 - }
55 - mValidOptions = pOptions;
56 - return true;
57 - }
58 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.aokeyhole.swing.namevaluecomponents;
3 +
4 + import org.litesoft.aokeyhole.swing.*;
5 + import org.litesoft.aokeyhole.swing.simplecomponents.*;
6 + import org.litesoft.aokeyhole.toolkit.*;
7 +
8 + import javax.swing.*;
9 +
10 + public class NamedSelectOptionComponent extends SimpleNamedComponent {
11 + private String[] mValidOptions;
12 +
13 + public NamedSelectOptionComponent( NameValueComponentParams pParams, String[] pValidOptions ) {
14 + super( pParams );
15 +
16 + mValidOptions = pValidOptions;
17 + }
18 +
19 + @Override
20 + protected JComponent createCenterContent() {
21 + JComboBox field = createComboBox();
22 + mInputComponent = field;
23 + field.addActionListener( new JComboBoxChangedListener( this ) );
24 + return noGrow( field );
25 + }
26 +
27 + protected JComboBox createComboBox() {
28 + return new FloodingJComboBox( mValidOptions, !isDataRequired() );
29 + }
30 +
31 + protected FloodingJComboBox getComboBox() {
32 + return (FloodingJComboBox) mInputComponent;
33 + }
34 +
35 + @Override
36 + public Object getComponentValue() {
37 + return getComboBox().getSelectedItem();
38 + }
39 +
40 + @Override
41 + public void setComponentValue( Object pValue ) {
42 + FloodingJComboBox comboBox = getComboBox();
43 + comboBox.setSelectedItem( comboBox.ensureAnOption( pValue ) );
44 + }
45 +
46 + @Override
47 + public boolean setOptions( String[] pOptions ) {
48 + mSystemUpdate = true;
49 + try {
50 + getComboBox().setOptions( pOptions, isDataRequired() );
51 + }
52 + finally {
53 + mSystemUpdate = false;
54 + }
55 + mValidOptions = pOptions;
56 + return true;
57 + }
58 + }