Changeset 9395


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

navOutline : gestion du scope

Location:
trunk
Files:
1 added
6 edited

Legend:

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

    r9394 r9395  
    5858import com.scenari.m.co.donnee.IHContextDonnee; 
    5959import com.scenari.m.co.donnee.WDonnee; 
    60 import com.scenari.m.co.donnee.XSaxHandlerDonnees; 
    6160import com.scenari.m.ge.agent.OutlineWalker; 
    6261import com.scenari.s.co.source.IHAliasResolver; 
     
    9594 * <pre> 
    9695 *     [navOutlineDef dialog="/@@/@xx"] 
     96 *       [scope] 
     97 *              Voir ScopeSaxHandler 
     98 *       [/scope] 
     99 *       [steps] 
    97100 *         [ancestor dir='up|down' offset='1|X'] 
    98101 *           [allowCompType code=''/] 
     
    125128 *                      ... 
    126129 *         [/ifNone] 
     130 *       [/steps] 
    127131 *     [/navOutlineDef] 
    128132 * </pre> 
     
    277281        } 
    278282 
    279         public class XSaxHandler extends XSaxHandlerDonnees { 
     283        public class XSaxHandler extends ScopeSaxHandler { 
    280284 
    281285                public static final String TAG_ROOT_DONNEE = "navOutlineDef"; 
     286                 
     287                public static final String TAG_STEPS = "steps"; 
     288                public static final String TAG_SCOPE = "scope"; 
    282289 
    283290                public static final String ATT_DIALOG = "dialog"; 
     
    313320                protected List fCompTypeList = null; 
    314321                protected boolean fCompTypAllowed = true; 
    315  
    316                 public XSaxHandler(IHComposantType pCompType) { 
    317                         super(pCompType); 
     322                 
     323                protected boolean fIsInScope = false; 
     324 
     325                public XSaxHandler(IHComposantType pCompType, OutlineWalker pWalker) { 
     326                        super(pCompType, pWalker); 
    318327                } 
    319328 
     
    334343                        } 
    335344                        // 
     345                        else if (pLocalName == TAG_SCOPE) { 
     346                                fIsInScope = false; 
     347                        } 
     348                        // 
    336349                        else if (pLocalName == TAG_ANCESTOR || pLocalName == TAG_CHILD || pLocalName == TAG_DESCENDANT || pLocalName == TAG_NEXT || pLocalName == TAG_SIBLING ) { 
    337350                                if(fCompTypeList != null && fCompTypeList.size()>0) { 
     
    345358 
    346359                protected boolean xStartElement(String pUri, String pLocalName, String pQName, Attributes pAttributes) throws Exception { 
    347                         if (pLocalName == TAG_ANCESTOR) { 
     360 
     361                        if(fIsInScope) { 
     362                                super.xStartElement(pUri, pLocalName, pQName, pAttributes); 
     363                        } 
     364                        // 
     365                        else if (pLocalName == TAG_SCOPE) { 
     366                                fIsInScope = true; 
     367                        } 
     368                         
     369                        // 
     370                        else if (pLocalName == TAG_ANCESTOR) { 
    348371                                AncestorStep vStep = new AncestorStep(); 
    349372                                initStep(vStep, pAttributes); 
     
    466489        public boolean wSetValueParSaxHandler(IHComposantType pCompType, HExtraitSaxHandler pParentHandler, IHContextDonnee pContextDonnee) throws java.lang.Exception { 
    467490                // Preparation du Handler 
    468                 XSaxHandler vHandler = new XSaxHandler(pCompType); 
     491                XSaxHandler vHandler = new XSaxHandler(pCompType, fWalker); 
    469492                vHandler.hSetTagRoot(XSaxHandler.TAG_ROOT_DONNEE); 
    470493                vHandler.hSetXmlReader(pParentHandler.hGetXMLReader(), false); 
     
    487510 
    488511                        // Preparation du Handler 
    489                         XSaxHandler vHandler = new XSaxHandler(pCompType); 
     512                        XSaxHandler vHandler = new XSaxHandler(pCompType, fWalker); 
    490513                        vHandler.hSetTagRoot(XSaxHandler.TAG_ROOT_DONNEE); 
    491514                        vHandler.hSetXmlReader(vXmlReader); 
  • 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); 
  • trunk/Wsp_Modeling/es/content/uiWidget/navUiWidget/xml.xed.xml

    r9394 r9395  
    9999                        </xul:atts> 
    100100                        <xul:childs> 
     101                                <se:ref  se:refid="sm:scope" se:refurl="chrome://sm_modeling/content/uiWidget/outlineUiWidget/xml.xed.xml"/> 
    101102                                <xul:element se:id="sm:selectPage" se:name="sm:selectPage" se:bind="element"> 
    102103                                        <xul:childs> 
  • trunk/Wsp_Modeling/es/content/uiWidget/outlineUiWidget/xml.xed.xml

    r9332 r9395  
    176176                                        </xul:atts> 
    177177                                        <xul:childs> 
    178                                                 <xul:element se:name="sm:scope" se:bind="element" tooltipTag="Paramétrage de l'envergure de la outline"> 
     178                                                <xul:element se:id="sm:scope" se:name="sm:scope" se:bind="element" tooltipTag="Paramétrage de l'envergure de la outline"> 
    179179                                                        <xul:childs> 
    180180                                                                <xul:alternativeAlone se:bind="choice"> 
     181                                                                        <se:ref se:name="sm:all" se:refid="sm:minimalist" helpSrc="chrome://sm_modeling/content/uiWidget/outlineUiWidget/hlp/hlpScopeAll.xul" tooltipTag="Entire outline"/> 
    181182                                                                        <xul:element se:name="sm:minimalist" se:id="sm:minimalist" se:bind="element" helpSrc="chrome://sm_modeling/content/uiWidget/outlineUiWidget/hlp/hlpScopeMinimalist.xul" tooltipTag="Ancestors, siblings &amp; direct children"> 
    182183                                                                                <xul:atts> 
     
    186187                                                                                </xul:atts> 
    187188                                                                        </xul:element> 
    188                                                                         <se:ref se:name="sm:all" se:refid="sm:minimalist" helpSrc="chrome://sm_modeling/content/uiWidget/outlineUiWidget/hlp/hlpScopeAll.xul" tooltipTag="Entire outline"/> 
    189189                                                                        <xul:element se:name="sm:directChildren" helpSrc="chrome://sm_modeling/content/uiWidget/outlineUiWidget/hlp/hlpScopeDirectChildren.xul" se:bind="element"/> 
    190190                                                                        <xul:element se:name="sm:stack" helpSrc="chrome://sm_modeling/content/uiWidget/outlineUiWidget/hlp/hlpScopeStack.xul" se:bind="element" tooltipTag="Ascendancy only"/> 
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_navUiWidget.xml

    r9394 r9395  
    8080        </affichage> 
    8181        <valeur code="navOutlineDef"> 
    82                 <source type="xsl-statique" href="bs:navOutlineDef.xsl"/> 
     82                <source type="xslOnSrc-dynamique" href="bs:navOutlineDef.xsl"/> 
    8383        </valeur> 
    8484  
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_navUiWidget/navOutlineDef.xsl

    r9394 r9395  
    4646                exclude-result-prefixes="sm sc" 
    4747                version="1.0"> 
     48         
     49        <!-- <xsl:import href="bs:../sm_outlineUiWidget/outlineDef.xsl"/> --> 
     50         
    4851        <xsl:output method="xml" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/> 
    4952         
    50         <xsl:param name="vComp"/> 
     53        <xsl:param name="vDialog"/> 
     54        <xsl:param name="vAgent"/> 
    5155         
    5256        <xsl:template match="sm:navUiWidget"> 
    5357                <navOutlineDef> 
    54                         <xsl:apply-templates select="sm:selectPage/*"/> 
     58                        <scope> 
     59                                <xsl:apply-templates select="sm:scope/*"/> 
     60                        </scope> 
     61                        <steps> 
     62                                <xsl:apply-templates select="sm:selectPage/*"/>                  
     63                        </steps> 
    5564                </navOutlineDef> 
    5665        </xsl:template> 
     
    111120                <excludeCompType code="{getIdFromPath(@sc:refUri)}{getAxisSuffix(@axis)}"/> 
    112121        </xsl:template> 
     122         
     123        <!-- ########## SCOPE ###########"" --> 
     124                <xsl:template match="sm:all"> 
     125                <startingPoint dir="down" offset="{si(not(@startAtLevel), '0', @startAtLevel)}" include="{si(not(@startAtLevel) or @startAtLevel='0', 'y', 'n')}"/> 
     126                <uncleFrom dir="down" offset="0"/> 
     127                <uncleTo dir="up" offset="0"/> 
     128                <uncleDesc depth="noLimit"/> 
     129                <currentDesc depth="noLimit"/> 
     130        </xsl:template> 
     131         
     132        <xsl:template match="sm:directChildren"> 
     133                <startingPoint dir="up" offset="0" include="n"/> 
     134                <currentDesc depth="1" depthFrom="current"/> 
     135        </xsl:template> 
     136         
     137        <xsl:template match="sm:minimalist"> 
     138                <startingPoint dir="down" offset="{si(not(@startAtLevel), '0', @startAtLevel)}" include="{si(not(@startAtLevel) or @startAtLevel='0', 'y', 'n')}"/> 
     139                <uncleFrom dir="down" offset="0"/> 
     140                <uncleTo dir="up" offset="0"/> 
     141                <currentDesc depth="1" depthFrom="current"/> 
     142        </xsl:template> 
     143         
     144        <xsl:template match="sm:stack"> 
     145                <startingPoint dir="down" offset="0"/> 
     146        </xsl:template>  
     147 
     148        <xsl:template match="sm:onlyOneLevel"> 
     149                <startingPoint dir="down" offset="{si(not(@level), '0', @level)}" include="n"/> 
     150                <endingPoint depth="1" depthFrom="startingPoint"/> 
     151                <uncleFrom dir="down" offset="0"/> 
     152                <uncleTo dir="down" offset="1"/> 
     153                <currentDesc depth="1" depthFrom="startingPoint"/> 
     154        </xsl:template>  
     155 
     156        <!-- customized scope --> 
     157        <xsl:template match="sm:customized"> 
     158                <xsl:apply-templates/> 
     159        </xsl:template> 
     160        <xsl:template match="sm:scopeStartingPoint"> 
     161                <xsl:apply-templates/> 
     162        </xsl:template> 
     163        <xsl:template match="sm:fromAbsoluteTop"> 
     164                <startingPoint dir="down" offset="{si(not(@descendantOffset), 'max', @descendantOffset)}" include="{si(@includeInScope='no', 'n', 'y')}"> 
     165                        <xsl:apply-templates/> 
     166                </startingPoint> 
     167        </xsl:template> 
     168        <xsl:template match="sm:fromCurrent"> 
     169                <startingPoint dir="up" offset="{si(not(@ancestorOffset), 'max', @ancestorOffset)}" include="{si(@includeInScope='no', 'n', 'y')}"> 
     170                        <xsl:apply-templates/> 
     171                </startingPoint> 
     172        </xsl:template> 
     173         
     174        <xsl:template match="sm:stopAtModel"> 
     175                <stopCompType code="{resultatAgent(concat('@', getIdFromPath(@sc:refUri), '/codeModel'))}{getAxisSuffix(@axis)}" include="{si(@includeInScope='no', 'n', 'y')}"/> 
     176        </xsl:template> 
     177         
     178         
     179        <xsl:template match="sm:ancestorEndingPoint"> 
     180                <endingPoint depth="{si(sm:depthLimit/@depth, sm:depthLimit/@depth, 'noLimit')}" depthFrom="{si(sm:depthLimit/@from='current', 'current', 'startingPoint')}"> 
     181                        <xsl:apply-templates/> 
     182                </endingPoint> 
     183        </xsl:template> 
     184         
     185        <xsl:template match="sm:currentAndAncestorSiblings"> 
     186                <xsl:apply-templates/> 
     187        </xsl:template> 
     188        <xsl:template match="sm:siblingsStartingPoint"> 
     189                <uncleFrom dir="{si(@direction='currentToScopeStartingPoint', 'up', 'down')}" offset="{si(not(@offset), 'max', @offset)}"> 
     190                        <xsl:apply-templates/> 
     191                </uncleFrom> 
     192        </xsl:template> 
     193        <xsl:template match="sm:siblingsEndingPoint"> 
     194                <uncleTo dir="{si(@direction='currentToScopeStartingPoint', 'up', 'down')}" offset="{si(not(@offset), 'max', @offset)}"> 
     195                        <xsl:apply-templates/> 
     196                </uncleTo> 
     197        </xsl:template> 
     198        <xsl:template match="sm:siblingDescendants"> 
     199                <uncleDesc depth="{si(sm:depthLimit/@depth, sm:depthLimit/@depth, 'noLimit')}" depthFrom="{si(sm:depthLimit/@from='current', 'current', 'startingPoint')}"> 
     200                        <xsl:apply-templates/> 
     201                </uncleDesc> 
     202        </xsl:template> 
     203        <xsl:template match="sm:currentDescendants"> 
     204                <currentDesc depth="{si(sm:depthLimit/@depth, sm:depthLimit/@depth, 'noLimit')}" depthFrom="{si(sm:depthLimit/@from='current', 'current', 'startingPoint')}"> 
     205                        <xsl:apply-templates/> 
     206                </currentDesc> 
     207        </xsl:template> 
     208        <xsl:template match="sm:depthLimit"/> 
     209         
     210         
    113211        <xsl:template match="*|text()|@*"/> 
    114212</xsl:stylesheet> 
Note: See TracChangeset for help on using the changeset viewer.