View Javadoc
1   /*
2    * Copyright (c) 2002-2025, City of Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.portal.web.includes;
35  
36  import java.util.Collections;
37  import java.util.HashMap;
38  import java.util.List;
39  import java.util.Map;
40  
41  import fr.paris.lutece.portal.service.plugin.PluginDefaultImplementation;
42  
43  public final class LinksIncludeTestPlugin extends PluginDefaultImplementation
44  {
45  
46      private Map<Integer, List<String>> _listCssStyleSheets = new HashMap<>( );
47      private Map<Integer, List<String>> _listJavascriptFiles = new HashMap<>( );
48      private boolean _cssStyleSheetsScopePortal;
49      private boolean _cssStylesheetsScopeXPage;
50      private boolean _javascriptFilesScopePortal;
51      private boolean _javascriptFilesScopeXPage;
52  
53      @Override
54      public List<String> getCssStyleSheets( )
55      {
56          List<String> res = _listCssStyleSheets.get( null );
57  
58          if ( res == null )
59          {
60              return Collections.emptyList( );
61          }
62  
63          return res;
64      }
65  
66      @Override
67      public List<String> getCssStyleSheets( int mode )
68      {
69          List<String> res = _listCssStyleSheets.get( mode );
70  
71          if ( res == null )
72          {
73              return Collections.emptyList( );
74          }
75  
76          return res;
77      }
78  
79      @Override
80      public List<String> getJavascriptFiles( )
81      {
82          List<String> res = _listJavascriptFiles.get( null );
83  
84          if ( res == null )
85          {
86              return Collections.emptyList( );
87          }
88  
89          return res;
90      }
91  
92      @Override
93      public List<String> getJavascriptFiles( int mode )
94      {
95          List<String> res = _listJavascriptFiles.get( mode );
96  
97          if ( res == null )
98          {
99              return Collections.emptyList( );
100         }
101 
102         return res;
103     }
104 
105     public void setCssStyleSheetsScopePortal( boolean bScope )
106     {
107         _cssStyleSheetsScopePortal = bScope;
108     }
109 
110     @Override
111     public boolean isCssStylesheetsScopePortal( )
112     {
113         return _cssStyleSheetsScopePortal;
114     }
115 
116     public void setCssStylesheetsScopeXPage( boolean bScope )
117     {
118         _cssStylesheetsScopeXPage = bScope;
119     }
120 
121     @Override
122     public boolean isCssStylesheetsScopeXPage( )
123     {
124         return _cssStylesheetsScopeXPage;
125     }
126 
127     public void setJavascriptFilesScopePortal( boolean bScope )
128     {
129         _javascriptFilesScopePortal = bScope;
130     }
131 
132     @Override
133     public boolean isJavascriptFilesScopePortal( )
134     {
135         return _javascriptFilesScopePortal;
136     }
137 
138     public void setJavascriptFilesScopeXPage( boolean bScope )
139     {
140         _javascriptFilesScopeXPage = bScope;
141     }
142 
143     @Override
144     public boolean isJavascriptFilesScopeXPage( )
145     {
146         return _javascriptFilesScopeXPage;
147     }
148 
149     public void setCssStyleSheets( int mode, List<String> styleSheets )
150     {
151         _listCssStyleSheets.put( mode, styleSheets );
152     }
153 
154     public void setCssStyleSheets( List<String> styleSheets )
155     {
156         _listCssStyleSheets.put( null, styleSheets );
157     }
158 
159     public void setJavascriptFiles( int mode, List<String> javascriptFiles )
160     {
161         _listJavascriptFiles.put( mode, javascriptFiles );
162     }
163 
164     public void setJavascriptFiles( List<String> javascriptFiles )
165     {
166         _listJavascriptFiles.put( null, javascriptFiles );
167     }
168 
169 }