1 package jp.ac.aiit.xdf.component.swing.attribute;
3 import javax.swing.JComboBox;
4 import javax.swing.JList;
7 * comboboxやlistのselected属性の為のAttributeProcessor。
10 public class SelectedIndexProcessor extends SetterAttributeProcessor{
15 public SelectedIndexProcessor(){
16 super("setSelectedIndex", true);
20 public void invokeSet(Object target, final String name, final Object value) {
21 final int index = Integer.parseInt(value.toString());
22 if(target instanceof JComboBox){
23 final JComboBox t = (JComboBox)target;
24 if(t.getItemCount() > index){
25 super.invokeSet(t, name, value);
29 while(t.getItemCount() <= index){
32 } catch(InterruptedException e){
36 SelectedIndexProcessor.super.invokeSet(t, name, value);
40 } else if(target instanceof JList){
41 final JList t = (JList)target;
42 if(t.getModel().getSize() > index){
43 super.invokeSet(t, name, value);
47 while(t.getModel().getSize() <= index){
50 } catch(InterruptedException e){
54 SelectedIndexProcessor.super.invokeSet(t, name, value);