Package yearreview.app.grid.widgets
Class Widget
java.lang.Object
yearreview.app.grid.widgets.Widget
- Direct Known Subclasses:
TestWidget
,TestWidgetAnimation
Abstract class that defines Methods that need to be implemented in every Widget.
- Author:
- ColdStone37
-
Field Summary
Modifier and TypeFieldDescriptionprivate final RoundRectangle2D.Float
Shape that is used to clip the graphic so only the local space can be rendered to.protected final float
Height of the widget.protected final float
Width of the widget.private float
x-position of the widget.private float
y-position of the widget. -
Constructor Summary
ConstructorDescriptionWidget
(float x, float y, float w, float h) Constructor for a GridSegment that initializes the position of the segment and the Shape for theGraphics2D.clip(java.awt.Shape)
-function. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
renderGlobalSpace
(Graphics2D graphic, Instant time) Converts the global space to the local space of the widget and sets the clip.protected abstract void
renderLocalSpace
(Graphics2D graphic, Instant time) Renders the widget in its local space (meaning that the coordinate system goes from (0, 0) to (w, h)).final void
setPosition
(float x, float y) Changes the position of the widget.
-
Field Details
-
x
private float xx-position of the widget. -
y
private float yy-position of the widget. -
w
protected final float wWidth of the widget. -
h
protected final float hHeight of the widget. -
clipShape
Shape that is used to clip the graphic so only the local space can be rendered to.
-
-
Constructor Details
-
Widget
public Widget(float x, float y, float w, float h) Constructor for a GridSegment that initializes the position of the segment and the Shape for theGraphics2D.clip(java.awt.Shape)
-function.- Parameters:
x
- x-position of the widgety
- y-position of the widgetw
- width of the widgeth
- height of the widget
-
-
Method Details
-
setPosition
public final void setPosition(float x, float y) Changes the position of the widget.- Parameters:
x
- new x-positiony
- new y-position
-
renderGlobalSpace
Converts the global space to the local space of the widget and sets the clip.- Parameters:
graphic
- graphic to render totime
- time at which to render the widget
-
renderLocalSpace
Renders the widget in its local space (meaning that the coordinate system goes from (0, 0) to (w, h)).- Parameters:
graphic
- graphic to render totime
- time to render the widget at
-