public class ViewportModel extends java.lang.Object implements IPropertyChangeNotifier
ViewportModel
stores viewport width and height, horizontal and
vertical translation, and a general contents transformation.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VIEWPORT_CONTENTS_TRANSFORM_PROPERTY
When the contents transform changes, this is the property name reported
by a corresponding property change event.
|
static java.lang.String |
VIEWPORT_HEIGHT_PROPERTY
When the viewport height changes, this is the property name reported by a
corresponding property change event.
|
static java.lang.String |
VIEWPORT_TRANSLATE_X_PROPERTY
When the viewport x-position changes, this is the property name reported
by a corresponding property change event.
|
static java.lang.String |
VIEWPORT_TRANSLATE_Y_PROPERTY
When the viewport y-position changes, this is the property name reported
by a corresponding property change event.
|
static java.lang.String |
VIEWPORT_WIDTH_PROPERTY
When the viewport width changes, this is the property name reported by a
corresponding property change event.
|
Constructor and Description |
---|
ViewportModel() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
AffineTransform |
getContentsTransform()
Returns the contents transformation.
|
double |
getHeight()
Returns the height of the current viewport, i.e. rectangular area in
which the viewer/editor is rendered.
|
double |
getTranslateX()
Returns the horizontal translation of the contents in this model.
|
double |
getTranslateY()
Returns the vertical translation of the contents in this model.
|
double |
getWidth()
Returns the width of the current viewport, i.e. rectangular area in which
the viewer/editor is rendered.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
setContentsTransform(AffineTransform contentsTransform)
Sets the contents transformation to the given value.
|
void |
setHeight(double height)
Sets the height of the viewport in this model.
|
void |
setTranslateX(double x)
Sets the horizontal translation of the contents in this model.
|
void |
setTranslateY(double y)
Sets the vertical translation of the contents in this model.
|
void |
setWidth(double width)
Sets the width of the viewport in this model.
|
public static final java.lang.String VIEWPORT_TRANSLATE_X_PROPERTY
public static final java.lang.String VIEWPORT_TRANSLATE_Y_PROPERTY
public static final java.lang.String VIEWPORT_WIDTH_PROPERTY
public static final java.lang.String VIEWPORT_HEIGHT_PROPERTY
public static final java.lang.String VIEWPORT_CONTENTS_TRANSFORM_PROPERTY
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface IPropertyChangeNotifier
public AffineTransform getContentsTransform()
public double getHeight()
public double getTranslateX()
public double getTranslateY()
public double getWidth()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface IPropertyChangeNotifier
public void setContentsTransform(AffineTransform contentsTransform)
contentsTransform
- The new contents transformation.public void setHeight(double height)
Sets the height of the viewport in this model. This should be called when the size of the rectangular area in which the viewer/editor is rendered changes.
Fires a property change event for the VIEWPORT_HEIGHT_PROPERTY
.
height
- new viewport heightpublic void setTranslateX(double x)
x
- The new horizontal translation.public void setTranslateY(double y)
y
- The new vertical translation.public void setWidth(double width)
Sets the width of the viewport in this model. This should be called when the size of the rectangular area in which the viewer/editor is rendered changes.
Fires a property change event for the VIEWPORT_WIDTH_PROPERTY
.
width
- new viewport widthCopyright (c) 2014 itemis AG and others. All rights reserved.