/*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed 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.vaadin.ui;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.vaadin.event.MouseEvents.ClickEvent;
import com.vaadin.event.MouseEvents.ClickListener;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.server.Resource;
import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.embedded.EmbeddedConstants;
import com.vaadin.shared.ui.embedded.EmbeddedServerRpc;
/**
* A component for embedding external objects.
*
* The {@code Embedded} component is used to display various types of multimedia
* content using the HTML {@code
*
* @param type
* the type to set.
*/
public void setType(int type) {
if (type != TYPE_OBJECT && type != TYPE_IMAGE && type != TYPE_BROWSER) {
throw new IllegalArgumentException("Unsupported type");
}
if (type != this.type) {
this.type = type;
markAsDirty();
}
}
/**
* This attribute may be used to specify a space-separated list of URIs for
* archives containing resources relevant to the object, which may include
* the resources specified by the classid and data attributes. Preloading
* archives will generally result in reduced load times for objects.
* Archives specified as relative URIs should be interpreted relative to the
* codebase attribute.
*
* @return Space-separated list of URIs with resources relevant to the
* object
*/
public String getArchive() {
return archive;
}
/**
* This attribute may be used to specify a space-separated list of URIs for
* archives containing resources relevant to the object, which may include
* the resources specified by the classid and data attributes. Preloading
* archives will generally result in reduced load times for objects.
* Archives specified as relative URIs should be interpreted relative to the
* codebase attribute.
*
* @param archive
* Space-separated list of URIs with resources relevant to the
* object
*/
public void setArchive(String archive) {
if (archive != this.archive
|| (archive != null && !archive.equals(this.archive))) {
this.archive = archive;
markAsDirty();
}
}
/**
* Add a click listener to the component. The listener is called whenever
* the user clicks inside the component. Depending on the content the event
* may be blocked and in that case no event is fired.
*
* Use {@link #removeListener(ClickListener)} to remove the listener.
*
* @param listener
* The listener to add
*/
public void addClickListener(ClickListener listener) {
addListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class, listener,
ClickListener.clickMethod);
}
/**
* @deprecated As of 7.0, replaced by
* {@link #addClickListener(ClickListener)}
**/
@Deprecated
public void addListener(ClickListener listener) {
addClickListener(listener);
}
/**
* Remove a click listener from the component. The listener should earlier
* have been added using {@link #addListener(ClickListener)}.
*
* @param listener
* The listener to remove
*/
public void removeClickListener(ClickListener listener) {
removeListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class,
listener);
}
/**
* @deprecated As of 7.0, replaced by
* {@link #removeClickListener(ClickListener)}
**/
@Deprecated
public void removeListener(ClickListener listener) {
removeClickListener(listener);
}
@Override
public void changeVariables(Object source, Map variables) {
// TODO Remove once LegacyComponent is no longer implemented
}
}