blob: 0eec67384cb393342b8e343bf8fef2a62aaa252b [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.sample.item.dtos;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.validation.Valid;
import org.eclipse.osbp.dsl.common.datatypes.IDto;
import org.eclipse.osbp.runtime.common.annotations.Dispose;
@SuppressWarnings("all")
public class ResolutionDto implements IDto, Serializable,
PropertyChangeListener {
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
this);
@Dispose
private boolean disposed;
private String type;
@Valid
private PixelsDto pixels;
/**
* Returns true, if the object is disposed. Disposed means, that it is
* prepared for garbage collection and may not be used anymore. Accessing
* objects that are already disposed will cause runtime exceptions.
*/
public boolean isDisposed() {
return this.disposed;
}
/**
* @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)
*/
public void addPropertyChangeListener(final PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
}
/**
* @see PropertyChangeSupport#addPropertyChangeListener(String,
* PropertyChangeListener)
*/
public void addPropertyChangeListener(final String propertyName,
final PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
}
/**
* @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener)
*/
public void removePropertyChangeListener(
final PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(listener);
}
/**
* @see PropertyChangeSupport#removePropertyChangeListener(String,
* PropertyChangeListener)
*/
public void removePropertyChangeListener(final String propertyName,
final PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(propertyName,
listener);
}
/**
* @see PropertyChangeSupport#firePropertyChange(String, Object, Object)
*/
public void firePropertyChange(final String propertyName,
final Object oldValue, final Object newValue) {
propertyChangeSupport.firePropertyChange(propertyName, oldValue,
newValue);
}
/**
* Checks whether the object is disposed.
*
* @throws RuntimeException
* if the object is disposed.
*/
private void checkDisposed() {
if (isDisposed()) {
throw new RuntimeException("Object already disposed: " + this);
}
}
/**
* Calling dispose will destroy that instance. The internal state will be
* set to 'disposed' and methods of that object must not be used anymore.
* Each call will result in runtime exceptions.<br/>
* If this object keeps composition containments, these will be disposed
* too. So the whole composition containment tree will be disposed on
* calling this method.
*/
@Dispose
public void dispose() {
if (isDisposed()) {
return;
}
firePropertyChange("disposed", this.disposed, this.disposed = true);
}
/**
* Returns the type property or <code>null</code> if not present.
*/
public String getType() {
return this.type;
}
/**
* Sets the <code>type</code> property to this instance.
*
* @param type
* - the property
* @throws RuntimeException
* if instance is <code>disposed</code>
*
*/
public void setType(final String type) {
firePropertyChange("type", this.type, this.type = type);
}
/**
* Returns the pixels property.
*/
public PixelsDto getPixels() {
if (this.pixels == null) {
this.pixels = new PixelsDto();
}
return this.pixels;
}
/**
* Sets the <code>pixels</code> property to this instance.
*
* @param pixels
* - the property
* @throws RuntimeException
* if instance is <code>disposed</code>
*
*/
public void setPixels(final PixelsDto pixels) {
if (this.pixels != null) {
this.pixels.removePropertyChangeListener(this);
}
firePropertyChange("pixels", this.pixels, this.pixels = pixels);
if (this.pixels != null) {
this.pixels.addPropertyChangeListener(this);
}
}
public ResolutionDto createDto() {
return new ResolutionDto();
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
// TODO Auto-generated method stub
}
}