View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.portal.portlets.admin;
18  
19  //Element Construction Set
20  import org.apache.ecs.html.*;
21  import org.apache.ecs.ElementContainer;
22  
23  //Jetspeed stuff
24  import org.apache.jetspeed.portal.portlets.AbstractPortlet;
25  import org.apache.jetspeed.portal.PortletException;
26  import org.apache.jetspeed.services.resources.JetspeedResources;
27  
28  //turbine
29  import org.apache.turbine.util.RunData;
30  
31  //standard java stuff
32  import java.util.Iterator;
33  
34  /***
35  Handles enumerating Portlets that are also applications
36  
37  @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
38  @version $Id: JetspeedPropertiesPortlet.java,v 1.21 2004/02/23 03:26:19 jford Exp $ 
39  */
40  public class JetspeedPropertiesPortlet extends AbstractPortlet {
41  
42      public static final String INPUT_SIZE = "70";
43          
44      /***
45      */
46      public void init() throws PortletException {
47  
48          this.setTitle("Properties");
49          this.setDescription("Jetspeed Properties");
50  
51  
52          ElementContainer root = new ElementContainer();
53          Table table = new Table().setWidth("100%");
54  
55          Iterator i = JetspeedResources.getKeys();
56  
57          root.addElement( new B( "Jetspeed properties: " ) );
58          
59          while ( i.hasNext() ) {
60              String key = (String)i.next();
61              try {
62                  Object value = JetspeedResources.getString(key);
63                  TR row = new TR();
64                  row.addElement( new TD().addElement( key ) );
65                  
66                  if (value == null) {
67                      value = "";
68                  }
69                  row.addElement( new TD()
70                      .addElement( new Input( "text",
71                                              "nothing",
72                                              value.toString() )
73                          .setSize( INPUT_SIZE ) ) );
74                  
75                  table.addElement( row );
76              } catch (Throwable t) {
77                  
78              }
79            
80          }
81  
82          root.addElement( new Center( table ) );
83          
84          //wrap it in a basic form so Netscape is smart enough to render the 
85          //width.
86          this.setContent( new Form( root ) );
87  
88      }
89  
90      /***
91      */
92      public boolean getAllowEdit( RunData rundata ) {
93          return false;
94      }
95  
96      /***
97      */
98      public boolean getAllowMaximize( RunData rundata ) {
99          return false;
100     }
101     
102     
103 }