WEB开发网
开发学院软件开发Java ADF(ORACLE JEE 平台)中Table的显示detail功能的使... 阅读

ADF(ORACLE JEE 平台)中Table的显示detail功能的使用

 2009-09-24 00:00:00 来源:WEB开发网   
核心提示: 当用户点击打开小图标时,触发如下事件:publicvoidshowDetails(DisclosureEventdisclosureEvent){if(disclosureEvent.isExpanded()){this.showDetail=true;}}那么,ADF(ORACLE JEE 平

当用户点击打开小图标时,触发如下事件:

    public void showDetails(DisclosureEvent disclosureEvent) {
        if(disclosureEvent.isExpanded()){
          this.showDetail = true;
          }
    }

那么,如何只让它显示一个Detail 信息呢? 也就是打开第二个时,关闭第一个呢? 很简单

修改showDetails方法如下:

    public String oldValue = "";
    public void showDetails(DisclosureEvent disclosureEvent) {
        CoreTable activityTable1 = (CoreTable)disclosureEvent.getComponent();
        if(disclosureEvent.isExpanded()){
          this.showDetail = true;
          }
          
        RowKeySet rowKeySet2  = activityTable1.getDisclosureState();
          Set set =rowKeySet2.getKeySet();
          Iterator iterator = set.iterator();
          if(set.size()==2){
             while(iterator.hasNext()){
              String temp = (String)iterator.next();
                 System.out.println("Old Value:"+oldValue);
              System.out.println("Two value:"+temp);
              if(!temp.equals(oldValue)){
                  oldValue = temp;
                  System.out.println("Set Older Value ="+temp);
                  break;
              }
             }
             set.clear();
             set.add(new String(oldValue));
             System.out.println("Display:"+oldValue);
          }else if(set.size()==1){
              while(iterator.hasNext()){
               String temp = (String)iterator.next();
                   oldValue = temp;
              }
              set.add(new String(oldValue));
              System.out.println("only One Display:"+oldValue);
          }
          
         activityTable1.setDisclosureState(rowKeySet2);
    }

上一页  1 2 3 

Tags:ADF ORACLE JEE

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接