Ignore:
Timestamp:
07/25/07 11:08:55 (5 years ago)
Author:
sys
Message:

navOutline : gestion du scope

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jav_GE/com/scenari/m/ge/donnee/WDonneeOutline.java

    r8356 r9395  
    5656import com.scenari.m.co.donnee.IAgentData; 
    5757import com.scenari.m.co.donnee.WDonnee; 
    58 import com.scenari.m.co.donnee.XSaxHandlerDonnees; 
    5958import com.scenari.m.ge.agent.OutlineWalker; 
    6059import com.scenari.s.co.source.IHAliasResolver; 
     
    7473 *     [outlineDef] 
    7574 *       [scope] 
    76  *         [startingPoint dir='up|down' offset='0|X|max' include='y|n'] 
    77  *           [stopCompType code='' include='y|n'/] 
    78  *           ... 
    79  *         [/startingPoint] 
    80  *         [endingPoint depth='0|X|noLimit' depthFrom='startingPoint|current'] 
    81  *           [stopCompType code='' include='y|n'/] 
    82  *           ... 
    83  *         [/endingPoint] 
    84  *         [uncleFrom dir='up|down|none' offset='0|X|max'] 
    85  *           [stopCompType code='' include='y/n'/] 
    86  *           ... 
    87  *         [/uncleFrom] 
    88  *         [uncleTo dir='up|down|none' offset='0|X|max'] 
    89  *           [stopCompType code='' include='y/n'/] 
    90  *           ... 
    91  *         [/uncleTo] 
    92  *         [uncleDesc depth='0|X|noLimit' depthFrom='startingPoint|current'] 
    93  *           [stopCompType code='' include='y/n'/] 
    94  *           ... 
    95  *         [/uncleDesc] 
    96  *         [currentDesc depth='0|X|noLimit' depthFrom='startingPoint|current'] 
    97  *           [stopCompType code='' include='y/n'/] 
    98  *           ... 
    99  *         [/currentDesc] 
     75 *         Voir ScopeSaxHandler 
    10076 *       [/scope] 
    10177 *       [result] 
     
    11692 
    11793        protected String fResult = RESULT_TREECONTENT; 
    118  
    119         public class XSaxHandler extends XSaxHandlerDonnees { 
     94         
     95         
     96        public class XSaxHandler extends ScopeSaxHandler { 
    12097 
    12198                public static final String TAG_ROOT_DONNEE = "outlineDef"; 
    12299 
    123                 public static final String TAG_STARTINGPOINT = "startingPoint"; 
    124  
    125                 public static final String TAG_ENDINGPOINT = "endingPoint"; 
    126  
    127                 public static final String TAG_UNCLEFROM = "uncleFrom"; 
    128  
    129                 public static final String TAG_UNCLETO = "uncleTo"; 
    130  
    131                 public static final String TAG_UNCLEDESC = "uncleDesc"; 
    132  
    133                 public static final String TAG_CURRENTDESC = "currentDesc"; 
    134  
    135                 public static final String TAG_STOPCOMPTYPE = "stopCompType"; 
    136  
    137                 String fCurrentBlock = null; 
    138  
    139                 public XSaxHandler(IHComposantType pCompType) { 
    140                         super(pCompType); 
     100                public XSaxHandler(IHComposantType pCompType, OutlineWalker pWalker) { 
     101                        super(pCompType, pWalker); 
    141102                } 
    142103 
     
    146107 
    147108                protected boolean xStartElement(String pUri, String pLocalName, String pQName, Attributes pAttributes) throws Exception { 
    148                         if (pLocalName == TAG_STARTINGPOINT) { 
    149                                 fCurrentBlock = pLocalName; 
    150                                 fWalker.setStartingPoint(getDir(pAttributes, OutlineWalker.DIR_UP_DOWN), getOffset(pAttributes, 0), getInclude(pAttributes, true)); 
    151                         } 
    152109                         
    153                         else if (pLocalName == TAG_ENDINGPOINT) { 
    154                                 fCurrentBlock = pLocalName; 
    155                                 fWalker.setEndingPoint(getDepth(pAttributes, OutlineWalker.NO_LIMIT), getDepthFrom(pAttributes, OutlineWalker.FROM_STARTINGPOINT)); 
    156                         } 
    157  
    158                         else if (pLocalName == TAG_UNCLEFROM) { 
    159                                 fCurrentBlock = pLocalName; 
    160                                 fWalker.setUncleFrom(getDir(pAttributes, OutlineWalker.DIR_NONE), getOffset(pAttributes, 0)); 
    161                         } 
    162  
    163                         else if (pLocalName == TAG_UNCLETO) { 
    164                                 fCurrentBlock = pLocalName; 
    165                                 fWalker.setUncleTo(getDir(pAttributes, OutlineWalker.DIR_NONE), getOffset(pAttributes, 0)); 
    166                         } 
    167  
    168                         else if (pLocalName == TAG_UNCLEDESC) { 
    169                                 fCurrentBlock = pLocalName; 
    170                                 fWalker.setUncleDesc(getDepth(pAttributes, OutlineWalker.NO_LIMIT), getDepthFrom(pAttributes, OutlineWalker.FROM_STARTINGPOINT)); 
    171                         } 
    172  
    173                         else if (pLocalName == TAG_CURRENTDESC) { 
    174                                 fCurrentBlock = pLocalName; 
    175                                 fWalker.setCurrDesc(getDepth(pAttributes, OutlineWalker.NO_LIMIT), getDepthFrom(pAttributes, OutlineWalker.FROM_CURRENT)); 
    176                         } 
    177  
    178                         else if (pLocalName == TAG_STOPCOMPTYPE) { 
    179                                 if (fCurrentBlock == TAG_STARTINGPOINT) { 
    180                                         fWalker.addStartingPointStopOnCompType(pAttributes.getValue("code"), getInclude(pAttributes, true)); 
    181                                 } else if (fCurrentBlock == TAG_ENDINGPOINT) { 
    182                                         fWalker.addEndingPointStopOnCompType(pAttributes.getValue("code"), getInclude(pAttributes, true)); 
    183                                 }else if (fCurrentBlock == TAG_UNCLEFROM) { 
    184                                         fWalker.addUncleFromStopOnCompType(pAttributes.getValue("code"), getInclude(pAttributes, true)); 
    185                                 } else if (fCurrentBlock == TAG_UNCLETO) { 
    186                                         fWalker.addUncleToStopOnCompType(pAttributes.getValue("code"), getInclude(pAttributes, true)); 
    187                                 } else if (fCurrentBlock == TAG_UNCLEDESC) { 
    188                                         fWalker.addUncleDescStopOnCompType(pAttributes.getValue("code"), getInclude(pAttributes, true)); 
    189                                 } else if (fCurrentBlock == TAG_CURRENTDESC) { 
    190                                         fWalker.addCurrDescStopOnCompType(pAttributes.getValue("code"), getInclude(pAttributes, true)); 
    191                                 } 
    192                         } 
    193  
    194                         else if (pLocalName == RESULT_TREECONTENT) { 
    195                                 fResult = RESULT_TREECONTENT; 
    196                         } 
    197  
    198                         else if (pLocalName == RESULT_PROGRESSSTATUS) { 
    199                                 fResult = RESULT_PROGRESSSTATUS; 
     110                        if( ! super.xStartElement(pUri, pLocalName, pQName, pAttributes)) { 
     111                                if (pLocalName == RESULT_TREECONTENT) { 
     112                                        fResult = RESULT_TREECONTENT; 
     113                                } 
     114         
     115                                else if (pLocalName == RESULT_PROGRESSSTATUS) { 
     116                                        fResult = RESULT_PROGRESSSTATUS; 
     117                                } 
    200118                        } 
    201119 
     
    203121                } 
    204122 
    205                 protected short getDir(Attributes pAttributes, short pDefault) { 
    206                         String vDir = pAttributes.getValue("dir"); 
    207                         if (vDir == null) return pDefault; 
    208                         if (vDir.equals("none")) return OutlineWalker.DIR_NONE; 
    209                         return vDir.equals("up") ? OutlineWalker.DIR_DOWN_UP : OutlineWalker.DIR_UP_DOWN; 
    210                 } 
    211  
    212                 protected int getOffset(Attributes pAttributes, int pDefault) { 
    213                         String vOffset = pAttributes.getValue("offset"); 
    214                         if (vOffset == null) return pDefault; 
    215                         if (vOffset.equals("max")) return OutlineWalker.NO_LIMIT; 
    216                         return Integer.parseInt(vOffset); 
    217                 } 
    218  
    219                 protected int getDepth(Attributes pAttributes, int pDefault) { 
    220                         String vOffset = pAttributes.getValue("depth"); 
    221                         if (vOffset == null) return pDefault; 
    222                         if (vOffset.equals("noLimit")) return OutlineWalker.NO_LIMIT; 
    223                         return Integer.parseInt(vOffset); 
    224                 } 
    225  
    226                 protected boolean getInclude(Attributes pAttributes, boolean pDefault) { 
    227                         String vInclude = pAttributes.getValue("include"); 
    228                         if (vInclude == null) return pDefault; 
    229                         return vInclude.equals("y"); 
    230                 } 
    231  
    232                 protected short getDepthFrom(Attributes pAttributes, short pDefault) { 
    233                         String vDir = pAttributes.getValue("depthFrom"); 
    234                         if (vDir == null) return pDefault; 
    235                         return vDir.equals("current") ? OutlineWalker.FROM_CURRENT : OutlineWalker.FROM_STARTINGPOINT; 
    236                 } 
    237123        } 
    238124 
     
    297183        public boolean wSetValueParSaxHandler(IHComposantType pCompType, HExtraitSaxHandler pParentHandler, IHContextDonnee pContextDonnee) throws java.lang.Exception { 
    298184                // Preparation du Handler 
    299                 XSaxHandler vHandler = new XSaxHandler(pCompType); 
     185                XSaxHandler vHandler = new XSaxHandler(pCompType, fWalker); 
    300186                vHandler.hSetTagRoot(XSaxHandler.TAG_ROOT_DONNEE); 
    301187                vHandler.hSetXmlReader(pParentHandler.hGetXMLReader(), false); 
     
    318204 
    319205                        // Preparation du Handler 
    320                         XSaxHandler vHandler = new XSaxHandler(pCompType); 
     206                        XSaxHandler vHandler = new XSaxHandler(pCompType, fWalker); 
    321207                        vHandler.hSetTagRoot(XSaxHandler.TAG_ROOT_DONNEE); 
    322208                        vHandler.hSetXmlReader(vXmlReader); 
Note: See TracChangeset for help on using the changeset viewer.