private void fillData() {
      //创建一个集合(应该是这样吧?如果不对请具体描述下)
        List<String> items = new ArrayList<String>();
//创建Operator对象key,遍历ConditionUtil中的ipList集合( List<Operator> ipList = new ArrayList<Operator>();)
        for (Operator key : ConditionUtil.ipList) {
//将key.getKey添加进 集合(最好能再具体点,我自己这么理解觉得太简单,希望有具体而容易理解的描述)
            items.add(key.getKey());
        }
//这句我有些疑问,强转成String数组是怎样一个过程呢?
        combo.setItems((String[]) items.toArray(new String[0]));
//这句也很迷惑,作用是什么?下拉列表放4个值这怎么才放一个?
        combo.select(0);
        stacklayout.topControl = singleComp;
// UiCondition uc(怎么描述?UiCondition 类中变量为空?)或this.uc.getCondition()这个指的什么呢?Condition具体类在下面)            if (this.uc == null || this.uc.getCondition() == null)
            return;
        group.setText(this.uc.getUiname());
        if (this.uc.isUsed()) {
            for (Operator key : ConditionUtil.ipList) {
                if (this.uc.getCondition().getOperator().equals(key.getValue())) {
                    combo.select(key.getOrder());
                    if (key.getValue().equals("in")
                            || key.getValue().equals("out")) {
                        stacklayout.topControl = scopComp;
                        stackcomp.layout();
//这行真没明白
                        String str[] = this.uc.getUivalue().split(",");
                        value1.setText(str[0]);
                        value2.setText(str[1]);
                    } else {
                        stacklayout.topControl = singleComp;
                        stackcomp.layout();
                        value.setText(this.uc.getUivalue());
                    }
                    break;
                }
            }
        }    }
public class Condition {
    private String value;    private String name;    private String operator;
}
public class ConditionUtil {    public static List<Operator> charList = new ArrayList<Operator>();    public static List<Operator> ipList = new ArrayList<Operator>();    public static List<Operator> numbList = new ArrayList<Operator>();    public static List<Operator> timeList = new ArrayList<Operator>();
}
ublic class UiCondition {
    private Condition condition;    private String judge;    private boolean used;    private String uiname;    private String uivalue;    public static String CHAR = "char";    public static String NUMB = "numb";    public static String IP = "ip";    public static String TIME = "time";
}
求指点了自己理解的有错误希望各位给指正让我少走些弯路

解决方案 »

  1.   


    private void fillData() {
      //创建一个列表ArrayList,里面保存的是String对象
      List<String> items = new ArrayList<String>();
      //创建Operator对象key,遍历ConditionUtil中的ipList集合( List<Operator> ipList = new ArrayList<Operator>();)
      for (Operator key : ConditionUtil.ipList) {
    //ConditionUtil.ipList中的每一个元素Operator对象key的getKey()值添加到列表items里面
      items.add(key.getKey());
      }
    //items.toArray(new String[0])这样就够了,toArray利用根据参数new String[0],创建String数据,(String[])这个强转是多余的,本来就是String[],不需要转换,也不能用强转转成别的数据
      combo.setItems((String[]) items.toArray(new String[0]));
    //意思是combo选择第一个元素
      combo.select(0);
      stacklayout.topControl = singleComp;
    // 代码不全还是怎么的,没看到getCondition()这方法
      if (this.uc == null || this.uc.getCondition() == null)
      return;
      //group是个JText吧,把Text设置成UIname的值
      group.setText(this.uc.getUiname());
      if (this.uc.isUsed()) {
      for (Operator key : ConditionUtil.ipList) {
      if (this.uc.getCondition().getOperator().equals(key.getValue())) {
      combo.select(key.getOrder());
      if (key.getValue().equals("in")
      || key.getValue().equals("out")) {
      stacklayout.topControl = scopComp;
      stackcomp.layout();
    //就是把this.uc.getUivalue()的值,用","拆分成字符串数组.比如把"1,2,3,4,5" 拆成{"1","2","3","4","5"}
      String str[] = this.uc.getUivalue().split(",");
      value1.setText(str[0]);
      value2.setText(str[1]);
      } else {
      stacklayout.topControl = singleComp;
      stackcomp.layout();
      value.setText(this.uc.getUivalue());
      }
      break;
      }
      }
      }  }
      //下面都是声明,没啥可说的
    public class Condition {
      private String value;  private String name;  private String operator;
    }
    public class ConditionUtil {  public static List<Operator> charList = new ArrayList<Operator>();  public static List<Operator> ipList = new ArrayList<Operator>();  public static List<Operator> numbList = new ArrayList<Operator>();  public static List<Operator> timeList = new ArrayList<Operator>();
    }
    ublic class UiCondition {
      private Condition condition;  private String judge;  private boolean used;  private String uiname;  private String uivalue;  public static String CHAR = "char";  public static String NUMB = "numb";  public static String IP = "ip";  public static String TIME = "time";
    }