All pastes #2131961 Raw Edit

ExternalPageInlineFrame

public java v1 · immutable
#2131961 ·published 2012-03-25 07:16 UTC
rendered paste body
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.mycompany.mavenproject;import java.net.URL;import org.apache.wicket.markup.ComponentTag;import org.apache.wicket.markup.html.WebMarkupContainer;/** * Implementation of an <a href="http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5">inline * frame</a> component. Must be used with an iframe (&lt;iframe src...) element. The src attribute * will be generated. Its is suitable for displaying <em>external html content</em> *  * @author Walter Rugora based on Ernesto Reinaldo Barreiro's DocumentInlineFrame component * (https://cwiki.apache.org/WICKET/displaying-content-eg-pdf-excel-word-in-an-iframe.html) *  */public class ExternalPageInlineFrame extends WebMarkupContainer{	private static final long serialVersionUID = 1L;			private URL url;	/**	 * Constructor receiving an IResourceListener..	 * 	 * @param id	 * @param resourceListener	 */	public ExternalPageInlineFrame(final String id, URL url)	{		super(id);		this.url = url;	}	/**	 * Handles this frame's tag.	 * 	 * @param tag the component tag	 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)	 */	@Override	protected final void onComponentTag(final ComponentTag tag)	{		checkComponentTag(tag, "iframe");                tag.put("src", url.toString());		super.onComponentTag(tag);	}}