1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 /*
25  * Created on 31.10.2003
26  *
27  * To change the template for this generated file go to
28  * Window>Preferences>Java>Code Generation>Code and Comments
29  */
30 package com.sun.star.wizards.web.export;
31 
32 import java.util.Iterator;
33 
34 import com.sun.star.wizards.web.data.CGArgument;
35 import com.sun.star.wizards.web.data.CGExporter;
36 
37 /**
38  * @author rpiterman
39  *
40  * To change the template for this generated type comment go to
41  * Window>Preferences>Java>Code Generation>Code and Comments
42  */
43 public class ConfiguredExporter extends FilterExporter
44 {
45 
46     /* (non-Javadoc)
47      * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter)
48      */
init(CGExporter exporter)49     public void init(CGExporter exporter)
50     {
51         super.init(exporter);
52         for (Iterator i = exporter.cp_Arguments.keys().iterator(); i.hasNext();)
53         {
54             Object key = i.next();
55             if (!key.equals("Filter"))
56             {
57                 Object value = exporter.cp_Arguments.getElement(key);
58                 props.put(key, cast(((CGArgument) value).cp_Value));
59             }
60         }
61     }
62 
cast(String s)63     private Object cast(String s)
64     {
65         String s1 = s.substring(1);
66         char c = s.charAt(0);
67         switch (c)
68         {
69             case '$':
70                 return s1;
71             case '%':
72                 return Integer.valueOf(s1);
73             case '#':
74                 return Short.valueOf(s1);
75             case '&':
76                 return Double.valueOf(s1);
77             case 'f':
78                 if (s.equals("false"))
79                 {
80                     return Boolean.FALSE;
81                 }
82                 break;
83             case 't':
84                 if (s.equals("true"))
85                 {
86                     return Boolean.TRUE;
87                 }
88                 break;
89         }
90         return null;
91     }
92 }
93 
94