Saturday 17 December 2016

ADF : Treetable - SelectionListner and onLoad execution

ADF : Treetable - SelectionListner and onLoad execution













On Selection Listner – Store data into pageflowscope

    public void fileImpotObjectsTreeSelectionListener(SelectionEvent selectionEvent){
        ADFUtil.invokeEL("#{ApplicationsTreeBean.treeSelectionHandler}",
                         new Class[] { SelectionEvent.class },
                         new Object[] { selectionEvent });  
       
        CollectionModel treeModel =
          (CollectionModel) fileImpotObjectsTreeTable.getValue();
        RowKeySet rs = getFileImpotObjectsTreeTable().getSelectedRowKeys();
        RichTreeTable fileImpotObjectsTreeTable = this.getFileImpotObjectsTreeTable();
        Object oldKey = fileImpotObjectsTreeTable.getRowKey();
        Map attributeMap = new HashMap();
        if(rs != null){
            Iterator it = rs.iterator();
            if (it.hasNext()){
                List rowKey = (List) it.next();
                if (rowKey.size() > 0){
                    //Key k = (Key) rowKey.get(0);
                    //ADFUtil.setEL("#{pageFlowScope.selectedTerrKey}", k);
                    fileImpotObjectsTreeTable.setRowKey(treeModel.getRowKey());
                    JUCtrlHierNodeBinding rowData =
                      (JUCtrlHierNodeBinding) fileImpotObjectsTreeTable.getRowData();
                   
                    if (rowData != null) {
                        Row r = rowData.getRow();
                        ADFUtil.setEL("#{pageFlowScope.selectedObjectDetailId}", r.getAttribute("ObjectDetailId"));
                        attributeMap.put("alternatekey", r.getAttribute("AlternateKeys"));
                        attributeMap.put("mandatoryattr", r.getAttribute("MandatoryAttrs"));
                        attributeMap.put("mandatorygrpattr", r.getAttribute("MandatoryGroupAttrs"));
                        ADFUtil.setEL("#{pageFlowScope.attributeMap}", attributeMap);
                        ADFUtil.invokeEL("#{bindings.filterObjectAttributesByObjectDetail.execute}");
                        AdfFacesContext.getCurrentInstance().addPartialTarget(this.fileImpotObjectsAttributeTable);
                    }
                }
            }
        }
    }

On Page load – Store data into pageflowscope
    public Object getRowKeysOnPageLoad() {
        RichTreeTable fileImpotObjectsTreeTable = this.getFileImpotObjectsTreeTable();
        if (fileImpotObjectsTreeTable != null) {
            Object oldKey = fileImpotObjectsTreeTable.getRowKey();
            Object key = null;
            Map attributeMap = new HashMap();
            CollectionModel treeModel =
              (CollectionModel) fileImpotObjectsTreeTable.getValue();
           
            if (treeModel != null) {
                RowKeySet selectedRowKeySet =
                  fileImpotObjectsTreeTable.getSelectedRowKeys();
               
                if (selectedRowKeySet != null) {
                    Iterator selectedRowKeySetIterator =
                      selectedRowKeySet.iterator();
                   
                    fileImpotObjectsTreeTable.setRowIndex(0);
                    key = fileImpotObjectsTreeTable.getRowKey();
                    fileImpotObjectsTreeTable.setRowKey(treeModel.getRowKey());
                   
                    //Add the first row to the selection list
                    fileImpotObjectsTreeTable.getSelectedRowKeys().add(treeModel.getRowKey());
                   
                    //Add the first row to the disclosed list, so that the tree is expanded on page load
                    fileImpotObjectsTreeTable.getDisclosedRowKeys().add(treeModel.getRowKey());
                   
                    //retrieve the data of the first row
                    JUCtrlHierNodeBinding rowData =
                      (JUCtrlHierNodeBinding) fileImpotObjectsTreeTable.getRowData();
                   
                    if (rowData != null) {
                        Row row = rowData.getRow();
                       
                        DCIteratorBinding parentObjectDetailsIterator =
                          this.findIterator("ParentObjectDetailsIterator");
                        if (parentObjectDetailsIterator != null) {
                            RowSetIterator rsi =
                              parentObjectDetailsIterator.getRowSetIterator();
                            Row[] selectedRow =
                              rsi.getFilteredRows("ObjectDetailId",
                                                  row.getAttribute("ObjectDetailId"));
                            if (selectedRow.length > 0) {
                                rsi.setCurrentRow(selectedRow[0]);
                                ADFUtil.setEL("#{pageFlowScope.selectedObjectDetailId}", row.getAttribute("ObjectDetailId"));
                                attributeMap.put("alternatekey", row.getAttribute("AlternateKeys"));
                                attributeMap.put("mandatoryattr", row.getAttribute("MandatoryAttrs"));
                                attributeMap.put("mandatorygrpattr", row.getAttribute("MandatoryGroupAttrs"));
                                ADFUtil.setEL("#{pageFlowScope.attributeMap}", attributeMap);
                                ADFUtil.invokeEL("#{bindings.filterObjectAttributesByObjectDetail.execute}");
                                AdfFacesContext.getCurrentInstance().addPartialTarget(this.fileImpotObjectsAttributeTable);
                            }
                        }
                    }
                }
            }
            fileImpotObjectsTreeTable.setRowKey(oldKey);
            return key != null? key: fileImpotObjectsTreeTable.getRowKey();
        }
        return null;
    }

Reuse Stored data from pageflowscope

public void loadTableList(ActionEvent actionEvent) {
        List<FileImportValidationMessage> thisValidationMessageList =
            (List<FileImportValidationMessage>)ADFUtil.evaluateEL("#{pageFlowScope.keyTableList}");

        if (thisValidationMessageList != null) {
                    Object alternateKey = resolvElDC("#{row.TaskDetails14}");
                    if(alternateKey != null && !"".equalsIgnoreCase(alternateKey.toString())){
       
                        FileImportValidationMessage fileImportValidationMessage = null;
                        List<FileImportValidationMessage> keyTableList = new ArrayList<FileImportValidationMessage>();
                            String alternamteKeyStr = alternateKey.toString();
                            String keys[] = alternamteKeyStr.split("|");
                            Integer count = 1;
                            for(int i = 0; i < keys.length; i++) {
                               
                                fileImportValidationMessage = new FileImportValidationMessage(count.toString(),keys[i]);
                                keyTableList.add(fileImportValidationMessage);
                               
                            }
                            this.keyTableList = keyTableList;
                            ADFUtil.setEL("#{pageFlowScope.keyTableList}", keyTableList);
                    }
            }
               
    }

JSFF code

<af:treeTable   value="#{bindings.ParentObjectDetails1.treeModel}"
                                            var="node" rowSelection="single"
                                            selectionListener="#{backingBeanScope.FileImportManageImportObjects.fileImpotObjectsTreeSelectionListener}"
                                            id="ATTt1" initiallyExpanded="true" expandAllEnabled="true" autoHeightRows="10"
                                            displayRowKey="#{backingBeanScope.FileImportManageImportObjects.rowKeysOnPageLoad}"
                                            binding="#{backingBeanScope.FileImportManageImportObjects.fileImpotObjectsTreeTable}"
                                            rowBandingInterval="0" columnStretching="last" contentDelivery="immediate"
                                            summary="#{MktCommonMarketingGenBundle['OLabel.TargetObjects']}" >
                                <f:facet name="nodeStamp">
                                    <af:column headerText="#{MktCommonMarketingGenBundle['OLabel.DisplayName6']}"
                                       id="c1" sortable="true" width="200" rowHeader="unstyled">
                                           
                                               
                                               <af:panelGroupLayout id="pgl5"
                                                                     layout="horizontal">
                                                    <af:image source="/images/qual_checkmark_16.png" rendered="#{node.IsCustomObject}"
                                                              shortDesc="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
                                                              id="i1"/>
                                                    <af:spacer width="10" rendered="#{node.IsCustomObject}"
                                                               height="10"
                                                               id="s2"/>
                                                <af:outputText value="#{node.ObjectNamePathDisplayLabel}"
                                                               id="ot1"/>
                                            </af:panelGroupLayout>
                                           
                                        </af:column>
                                </f:facet>
                                <f:facet name="pathStamp">
                                       
                                            <af:group id="g22">
                                                <af:panelGroupLayout id="pgl544"
                                                                         layout="horizontal">
                                                        <af:image source="/images/qual_checkmark_16.png" rendered="#{node.IsCustomObject}"
                                                                  shortDesc="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
                                                                  id="i133"/>
                                                        <af:spacer width="10" rendered="#{node.IsCustomObject}"
                                                                   height="10"
                                                                   id="s233"/>
                                                <af:outputText value="#{node.ObjectNamePathDisplayLabel}"
                                                               id="ot2"/>
                                            </af:panelGroupLayout>
                                            </af:group>           
                                       
                                    </f:facet>
                               
                                <af:column headerText="#{MktCommonMarketingGenBundle['Header.LanguageIndependentCode.LanguageIndependentObjectAttri']}"
                                     id="c2" sortable="true" width="200">
                                        <af:outputText value="#{node.ViewObjectInstanceName}"
                                           id="ot3"/>
                                </af:column>
                                <af:column headerText="Alternatekey"
                                     id="c222" sortable="true" width="100">
                                        <af:commandImageLink
                                                             id="cil1"
                                                             icon="/images/key_dwn.png">
                                               <af:showPopupBehavior popupId=":::p1" triggerType="click"/>             
                                        </af:commandImageLink>
                                    </af:column>
                                <af:column headerText="Required fields"
                                     id="c233" sortable="true" width="100">
                                        <af:commandImageLink
                                                             id="cil2"
                                                             icon="/images/fuse-icon-checkmark.png">
                                                        <af:showPopupBehavior popupId=":::popup1" triggerType="click"/>
                                                        </af:commandImageLink>    
                                                            
                                    </af:column>
                                <!--
                                <af:column headerText="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
                                     id="c3" sortable="true" width="200" align="center">
                                     <af:switcher defaultFacet="false" facetName="#{node.IsCustomObject}"  id="s1">
                                        <f:facet name="true">
                                          <af:image source="/images/qual_checkmark_16.png" shortDesc="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
                                                    id="i1"/>
                                        </f:facet>
                                        <f:facet name="false"/>
                                    </af:switcher>
                                </af:column>
                                -->
                                <af:column  sortable="true"
                                         headerText="#{MktCommonMarketingAttrBundle['ColAttr.Description.ImportMappingDescription.MKTIMPMAP.DESCTEXT']}"
                                         id="c10">
                                <af:outputText value="#{node.Description}" id="ot10"/>
                              </af:column>
                            </af:treeTable>

14 comments:

  1. Login Belkin Router
    Fix your technical Problem Today with FixingBlog. We are providing Free solutions For the problems related to antivirus, Router, Range extender etc

    ReplyDelete
  2. Please remember you can remove Antivirus with manual settings also. you just have followed the link in order to fix Antivirus problems Kindly visit
    Fix Mcafee Antivirus Problems


    ReplyDelete
  3. Thanks for sharing kind of information with us .
    We provide tech support information which helps users to resolve their technical issues. Belkin.Range

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. your article and found it very informative. You have provide a nice information
    Routerlogin.net not working
    routerlogin
    routerlogin net

    ReplyDelete

  6. Routers are the current backbone of the connected home.
    Setting up a Belkin router involves securing your network by configuring the router correctly.
    visit setup belkin

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Thanks for sharing the information.IF SOMEONE NEEDED INFORMATION RELEATED sms service provider
    then visit SMS SQUAD

    ReplyDelete