001 /*
002 * This file is part of the Echo Point Project. This project is a
003 * collection of Components that have extended the Echo Web Application
004 * Framework Version 3.
005 *
006 * Version: MPL 1.1
007 *
008 * The contents of this file are subject to the Mozilla Public License Version
009 * 1.1 (the "License"); you may not use this file except in compliance with
010 * the License. You may obtain a copy of the License at
011 * http://www.mozilla.org/MPL/
012 *
013 * Software distributed under the License is distributed on an "AS IS" basis,
014 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015 * for the specific language governing rights and limitations under the
016 * License.
017 */
018 package echopoint;
019
020 import echopoint.internal.AbstractContainer;
021 import nextapp.echo.app.Component;
022
023 /**
024 * A component that uses a <code>iframe</code> to dislay the contents of a
025 * user specified URI. Note that unlike the EPNG
026 * <a href='http://docs.rakeshv.org/java/echopointng/echopointng/HttpPaneEx.html'>HttpPaneEx</a>
027 * component, this component is not a subclass of {@link
028 * nextapp.echo.app.ContentPane} and hence may be embedded anywhere within
029 * your application component hierarchy.
030 *
031 * <p>The following code sample shows usage of this component:</p>
032 * <pre>
033 * import echopoint.HttpPane;
034 * import nextapp.echo.app.Column;
035 *
036 * ...
037 * final Column column = new Column();
038 * final String uri = "https://echopoint.dev.java.net/";
039 * final HttpPane pane = new HttpPane( uri );
040 * column.add( pane );
041 * </pre>
042 *
043 * @author Brad Baker. Modified by Rakesh 2008-07-13
044 * @version $Id: HttpPane.java 86 2008-11-09 14:44:29Z sptrakesh $
045 */
046 public class HttpPane extends AbstractContainer
047 {
048 private static final long serialVersionUID = 1l;
049
050 /** The URI to display in this component. */
051 public static final String PROPERTY_URI = "uri";
052
053 /** Constructs a new instance that loads a blank page. */
054 public HttpPane()
055 {
056 this( "javascript:void" );
057 }
058
059 /**
060 * Constructs a new instance that loads the contents of the specified URI.
061 * Note that the URI needs to specify the protocal (eg. http, https, etc.)
062 * for the iframe to load the contents properly.
063 *
064 * @param uri The URI to load in this component.
065 */
066 public HttpPane( final String uri )
067 {
068 setUri( uri );
069 }
070
071 /**
072 * Return the URI that is currently loaded in this component.
073 *
074 * @return The URI being displayed
075 */
076 public String getUri()
077 {
078 return (String) get( PROPERTY_URI );
079 }
080
081 /**
082 * Sets the URI to display in this component.
083 *
084 * @param uri The URI to load in this component.
085 */
086 public void setUri( final String uri )
087 {
088 set( PROPERTY_URI, uri );
089 }
090
091 /**
092 * Over-ridden to unconditionally return <code>false</code> as no children
093 * are allowed.
094 *
095 * {@inheritDoc}
096 */
097 @Override
098 public boolean isValidChild( final Component child )
099 {
100 return false;
101 }
102 }