Commit e892bfb1 authored by Nico Mack's avatar Nico Mack

Minor API fixes

parent 5c39822a
......@@ -220,6 +220,20 @@ public class ModalWidget extends TetherableWidget {
return stateChanged;
}
// ---------------------------------------------------------------------------
/**
* Allows checking whether the specified bundle is currently active or not.
*
* @param bundle
* name of the bundle to check activation state of.
* @return <code>true</code> if specified bundle is currently active, <code>false</code> otherwise.
*/
// ---------------------------------------------------------------------------
public boolean isBundleActive(String bundle) {
return this.activeBundles.contains(bundle);
}
// ---------------------------------------------------------------------------
/**
* Returns the bundles of coronas matching the specified bundle name.
......@@ -235,6 +249,8 @@ public class ModalWidget extends TetherableWidget {
return coronaBundles.get(bundle);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * End of Class *
......
......@@ -69,14 +69,14 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
*/
protected boolean rotateWithHandle = true;
/**
* Field indicating whether the corona should be activated as soon as the handle is dropped on
* the table Default: <code>true</code>!
* Field indicating whether the corona should be activated as soon as the handle is dropped on the
* table Default: <code>true</code>!
*/
protected boolean activateWithHandle = true;
/**
* Field indicating whether the corona is to initialRotation on its centre. If set to true, a
* rotation of the handle the corona is attached to will result in the corona spinning on its
* centre axis.
* rotation of the handle the corona is attached to will result in the corona spinning on its centre
* axis.
*/
protected boolean spinOnCoronaCentre = false;
/**
......@@ -94,8 +94,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
*/
protected boolean invalidated = false;
/**
* Field indicating the draw priority of the corona. <code>Integer#MAX_VALUE</code> is the
* highest priority, hence, will be drawn last. Default: <code>0</code>.
* Field indicating the draw priority of the corona. <code>Integer#MAX_VALUE</code> is the highest
* priority, hence, will be drawn last. Default: <code>0</code>.
*/
protected int drawPriority = 0;
/** Field holding the shape representing the corona. */
......@@ -191,8 +191,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
protected Corona() {
/**
* This constructor is only to be used when working with the decorator pattern. It shan't be
* use elsewhere.
* This constructor is only to be used when working with the decorator pattern. It shan't be use
* elsewhere.
*/
}
......@@ -202,12 +202,11 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
// ***************************************************************************
// ---------------------------------------------------------------------------
/**
* computes the euclidian distance of the initial translation with respect to the corona's
* centre
* computes the euclidian distance of the initial translation with respect to the corona's centre
*
* @return a point, with x and y values set to the euclidian distance (expressed in
* ScreenCoordinates) from corona centre. The angle property will be set to the offset
* angle resulting from the initial translation.
* ScreenCoordinates) from corona centre. The angle property will be set to the offset angle
* resulting from the initial translation.
*/
// ---------------------------------------------------------------------------
......@@ -227,8 +226,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
* center, its initial translation as well as the optional center of the asset to be drawn.
*
* @param assetCentre
* specifies the optional center of the asset to be drawn. Specify <code>null</code> if
* not required
* specifies the optional center of the asset to be drawn. Specify <code>null</code> if not
* required
* @return a point expressed in absolute screen coordinates
*/
// ---------------------------------------------------------------------------
......@@ -257,8 +256,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
// ---------------------------------------------------------------------------
/**
* Constructs an AffineTransform object taking into account all of the coronas' translation and
* rotation properties. The return transform can directly be used in paint methods for
* transforming shapes or drawing
* rotation properties. The return transform can directly be used in paint methods for transforming
* shapes or drawing
*
* @param assetCentre
* specifies an optional asset center to be integrated into the transform. Specify
......@@ -438,8 +437,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
// ---------------------------------------------------------------------------
/**
* Method raising the invalidated flag, in order to indicate that this corona shall redraw
* itself at the next opportunity. Flag will be reset when paint method will be called.
* Method raising the invalidated flag, in order to indicate that this corona shall redraw itself at
* the next opportunity. Flag will be reset when paint method will be called.
*/
// ---------------------------------------------------------------------------
......@@ -462,8 +461,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
/**
* Getter method for checking the validation state of this corona
*
* @return <code>true</code> if corona is invalidated and needs to be redrawn,
* <code>false</code> otherwise
* @return <code>true</code> if corona is invalidated and needs to be redrawn, <code>false</code>
* otherwise
*/
// ---------------------------------------------------------------------------
......@@ -534,11 +533,24 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
return initialRotation;
}
// ---------------------------------------------------------------------------
/**
* Simple setter method for initialRotation.
*
* @param angle
* The value to set initialRotation to.
*/
// ---------------------------------------------------------------------------
public void setInitialRotation(double angle) {
this.initialRotation = angle;
}
// ---------------------------------------------------------------------------
/**
* Comparison as defined by the {@link Comparable} interface. This comparison is based on the
* integer comparison of the draw priorities, ordering lower priorities first. This will result
* in lower priority {@link Corona} instances being overlapped by prioritised ones.<br>
* integer comparison of the draw priorities, ordering lower priorities first. This will result in
* lower priority {@link Corona} instances being overlapped by prioritised ones.<br>
* <br>
*
* <b>Note</b>: As the {@link Multimap} used to store {@link Corona} instances uses the
......@@ -563,8 +575,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
*
* @param point
* A point to retrieve the relative position for.
* @return A clone of the provided point in {@link ScreenCoordinates} relative to the centre of
* the corona by subtracting the coordinates of the centre.
* @return A clone of the provided point in {@link ScreenCoordinates} relative to the centre of the
* corona by subtracting the coordinates of the centre.
*/
// ---------------------------------------------------------------------------
......@@ -581,12 +593,12 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
// ---------------------------------------------------------------------------
/**
* Method used to get a {@link Shape} with a relative position to this corona's centre. The
* method uses the current centre and adds and initial offset translations and rotations,
* accounting for any settings, before issuing a transformation of the base shape.
* Method used to get a {@link Shape} with a relative position to this corona's centre. The method
* uses the current centre and adds and initial offset translations and rotations, accounting for
* any settings, before issuing a transformation of the base shape.
*
* @return A new shape obtained by performing, potentially, a series of affine transformations
* on a clone of the original shape.
* @return A new shape obtained by performing, potentially, a series of affine transformations on a
* clone of the original shape.
*
* @see AffineTransform#createTransformedShape(Shape)
*/
......@@ -613,8 +625,8 @@ public abstract class Corona implements Comparable<Corona>, Cloneable, Touchable
// ---------------------------------------------------------------------------
/**
* Method used to define behaviour of the corona when it should visualise on the table. By
* default, the call to {@link #onTable()} will result in {@link Corona} activation.
* Method used to define behaviour of the corona when it should visualise on the table. By default,
* the call to {@link #onTable()} will result in {@link Corona} activation.
*/
// ---------------------------------------------------------------------------
......
......@@ -199,8 +199,6 @@ public class HtmlBox extends SelectableCorona implements InformationReceiver<Str
/** {@inheritDoc} */
@Override
public void paint(Graphics2D canvas) {
super.paint(canvas);
if (!active)
return;
......
......@@ -238,6 +238,27 @@ public class TouchManager implements ActionListener {
return ((shape != null) ? shape.contains(touchPosition) : false);
}
// ---------------------------------------------------------------------------
/**
* Checks whether the specified touch event occurred inside the specified shape.
*
* @param corona
* specifies the corona to check intersection with
* @param event
* specifies the touch event to check
* @return <code>true</code> if the specified touch event occurred within the bounds of the
* specified corona, <code>false</code> otherwise.
*/
// ---------------------------------------------------------------------------
public boolean eventInsideCorona(Corona corona, TapEvent event) {
Point touchPosition = corona.getPointRelativeToCentre(event.getPosition());
Shape shape = corona.getShape();
return ((shape != null) ? shape.contains(touchPosition) : false);
}
// ---------------------------------------------------------------------------
/**
* Assuming the specified touch event affected the corona, the touch method will perform a state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment