View Javadoc
1   /*
2    * Copyright (c) 2002-2023, 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.plugins.document.business.attributes;
35  
36  import fr.paris.lutece.util.ReferenceItem;
37  
38  /**
39   *
40   * MapProvider
41   *
42   */
43  public class MapProvider implements IMapProvider
44  {
45      private String _strKey;
46      private String _strDisplayedName;
47      private String _strHtmlCode;
48      private String _strFrontHtmlCode;
49      private String _strFrontListHtmlCode;
50      private String _strBackListHtmlCode;
51      private boolean _bMapListSupported;
52  
53      /**
54       * {@inheritDoc}
55       */
56      @Override
57      public String getKey( )
58      {
59          return _strKey;
60      }
61  
62      /**
63       * Sets the key
64       * 
65       * @param key
66       *            the key
67       */
68      public void setKey( String key )
69      {
70          this._strKey = key;
71      }
72  
73      /**
74       * {@inheritDoc}
75       */
76      @Override
77      public String getDisplayedName( )
78      {
79          return _strDisplayedName;
80      }
81  
82      /**
83       * Set the displayed name
84       * 
85       * @param displayedName
86       *            the displayed name
87       */
88      public void setDisplayedName( String displayedName )
89      {
90          this._strDisplayedName = displayedName;
91      }
92  
93      /**
94       * {@inheritDoc}
95       */
96      @Override
97      public String getHtmlCode( )
98      {
99          return _strHtmlCode;
100     }
101 
102     /**
103      * Sets the html code
104      * 
105      * @param htmlCode
106      *            the html code
107      */
108     public void setHtmlCode( String htmlCode )
109     {
110         this._strHtmlCode = htmlCode;
111     }
112 
113     /**
114      * {@inheritDoc}
115      */
116     @Override
117     public ReferenceItem toRefItem( )
118     {
119         ReferenceItem refItem = new ReferenceItem( );
120 
121         refItem.setCode( getKey( ) );
122         refItem.setName( getDisplayedName( ) );
123 
124         return refItem;
125     }
126 
127     /**
128      * {@inheritDoc}
129      */
130     @Override
131     public String getFrontHtmlCode( )
132     {
133         return _strFrontHtmlCode;
134     }
135 
136     /**
137      * {@inheritDoc}
138      */
139     @Override
140     public String getFrontListHtmlCode( )
141     {
142         return _strFrontListHtmlCode;
143     }
144 
145     /**
146      * Sets the front list html code
147      * 
148      * @param strFrontListHtmlCode
149      *            the front list template
150      */
151     public void setFrontListHtmlCode( String strFrontListHtmlCode )
152     {
153         _strFrontListHtmlCode = strFrontListHtmlCode;
154     }
155 
156     /**
157      * Sets the front html
158      * 
159      * @param strFrontHtmlCode
160      *            the front template
161      */
162     public void setFrontHtmlCode( String strFrontHtmlCode )
163     {
164         _strFrontHtmlCode = strFrontHtmlCode;
165     }
166 
167     /**
168      * Set back list html code
169      * 
170      * @param strBackListHtmlCode
171      *            the back list template
172      */
173     public void setBackListHtmlCode( String strBackListHtmlCode )
174     {
175         _strBackListHtmlCode = strBackListHtmlCode;
176     }
177 
178     /**
179      * {@inheritDoc}
180      */
181     @Override
182     public String getBackListHtmlCode( )
183     {
184         return _strBackListHtmlCode;
185     }
186 
187     /**
188      * {@inheritDoc}
189      */
190     @Override
191     public boolean isMapListSupported( )
192     {
193         return _bMapListSupported;
194     }
195 
196     /**
197      * Set to <code>true</code> if map list is supported, <code>false</code> otherwise
198      * 
199      * @param bMapListSupported
200      *            the new value
201      */
202     public void setMapListSupported( boolean bMapListSupported )
203     {
204         _bMapListSupported = bMapListSupported;
205     }
206 
207     @Override
208     public Object getParameter( int nKey )
209     {
210         // TODO Auto-generated method stub
211         return null;
212     }
213 }