
org.jitsi.impl.neomedia.control.ReadOnlyFormatControlDelegate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libjitsi Show documentation
Show all versions of libjitsi Show documentation
libjitsi is an advanced Java media library for secure real-time audio/video
communication
The newest version!
/*
* Copyright @ 2015 Atlassian Pty 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 org.jitsi.impl.neomedia.control;
import java.awt.*;
import javax.media.*;
import javax.media.control.*;
/**
* Represents a wrapper of a specific FormatControl instance which does
* not allow setting its format using {@link FormatControl#setFormat(Format)}.
*
* @author Lubomir Marinov
*/
public class ReadOnlyFormatControlDelegate
implements FormatControl
{
/**
* The FormatControl wrapped by this instance.
*/
private final FormatControl formatControl;
/**
* Initializes a new ReadOnlyFormatControlDelegate instance which
* is to wrap a specific FormatControl in order to prevent calls to
* its {@link FormatControl#setFormat(Format)}.
*
* @param formatControl the FormatControl which is to have calls to
* its FormatControl#setFormat(Format) prevented
*/
public ReadOnlyFormatControlDelegate(FormatControl formatControl)
{
this.formatControl = formatControl;
}
/**
* Implements {@link Control#getControlComponent()}.
*
* @return a Component which represents UI associated with this
* instance if any; otherwise, null
*/
public Component getControlComponent()
{
return formatControl.getControlComponent();
}
/**
* Gets the Format of the owner of this FormatControl.
* Delegates to the wrapped FormatControl.
*
* @return the Format of the owner of this FormatControl
*/
public Format getFormat()
{
return formatControl.getFormat();
}
/**
* Gets the Formats supported by the owner of this
* FormatControl. Delegates to the wrapped FormatControl.
*
* @return an array of Formats supported by the owner of this
* FormatControl
*/
public Format[] getSupportedFormats()
{
return formatControl.getSupportedFormats();
}
/**
* Implements {@link FormatControl#isEnabled()}.
*
* @return true if this track is enabled; otherwise, false
*/
public boolean isEnabled()
{
return formatControl.isEnabled();
}
/**
* Implements {@link FormatControl#setEnabled(boolean)}.
*
* @param enabled true if this track is to be enabled; otherwise,
* false
*/
public void setEnabled(boolean enabled)
{
// Ignore the request because this instance is read-only.
}
/**
* Implements {@link FormatControl#setFormat(Format)}. Not supported and
* just returns the currently set format if the specified Format is
* supported and null if it is not supported.
*
* @param format the Format to be set on this instance
* @return the currently set Format after the attempt to set it on
* this instance if format is supported by this instance and
* regardless of whether it was actually set; null if
* format is not supported by this instance
*/
public Format setFormat(Format format)
{
return AbstractFormatControl.setFormat(this, format);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy