Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
54737bd
Collections are now parametric
Nov 20, 2023
8428fee
List<PCamera paramerreization
Nov 20, 2023
f714b6e
Parametrrization
Nov 20, 2023
66a453b
Deprecated Event Constants are updated
Nov 20, 2023
c531372
Parametrization
Nov 20, 2023
36e0580
Parametrization
Nov 20, 2023
eda701d
Eclipse warning message supressed
Nov 20, 2023
b67605d
Eclipse warning message supressed
Nov 20, 2023
c38a5b7
Eclipse warning message supressed
Nov 20, 2023
0e316de
Event handler constant updated
Nov 20, 2023
db0c548
Parametrization
Nov 20, 2023
d2243a1
Parametrization
Nov 20, 2023
0f47384
ZMarkObjectOutputStream was not closed before
Nov 20, 2023
4cbf83b
Parametrization
Nov 20, 2023
bcf48a3
Parametrization
Nov 20, 2023
6ffcc18
Parametrization
Nov 20, 2023
69e785f
Parameterization
Nov 20, 2023
061cd86
Parameterization
Nov 20, 2023
a16bd11
Parameterization
Nov 20, 2023
01db458
Deprecated event Constant updated
Nov 20, 2023
152d3bb
Deprecated event constant updated
Nov 20, 2023
4acfa83
Parameterization
Nov 20, 2023
52f86e7
Parameterization
Nov 20, 2023
ba49887
Parameterization
Nov 20, 2023
65a5790
Parameterzation
Nov 20, 2023
83b3145
Unnecessary Import
Nov 20, 2023
a0d6ddd
Parameterization
Nov 20, 2023
e65d673
Deprecated event constant updated
Nov 20, 2023
6e0920f
Parameterization
Nov 20, 2023
e675df3
Parameterization
Nov 20, 2023
110cf37
Parameterization
Nov 20, 2023
e0e9f8c
Parameterization
Nov 20, 2023
4b461b6
Deprecated event constant updated
Nov 20, 2023
57bb3a4
Parameterization
Nov 20, 2023
3ed6c96
Deprecated event constant updated
Nov 20, 2023
f183d13
Serialization warning fixed
Nov 20, 2023
e546536
Serialization warning fixed
Nov 20, 2023
abece17
Serialization warning fixed
Nov 20, 2023
c751047
Serialization warning fixed
Nov 20, 2023
91d36f4
Unnecessary imports have been removed
Nov 20, 2023
48d55fa
Unnecessary import is removed
Nov 20, 2023
10a9a24
Deprecated method is updated
Nov 20, 2023
35bbf65
Deprecated method is updated
Nov 20, 2023
1af9895
Deprecated method is updated
Nov 20, 2023
b625658
Parameterization
Nov 20, 2023
049eb88
Parameterization
Nov 20, 2023
b008046
Eclipse serialization warning fixed
Nov 20, 2023
5000642
Parameterization
Nov 20, 2023
2908a0a
Unnecessary import removed
Nov 20, 2023
9578a89
Deprecated event constant updated
Nov 20, 2023
4e9b8cf
Parameterization
Nov 20, 2023
000b4d4
serialization warning fixed
Nov 20, 2023
ccd3413
Parameterization
Nov 20, 2023
9da70f4
Parameterization
Nov 20, 2023
7ce25ce
Parameterization
Nov 20, 2023
42e1da1
Reverted to original
Nov 20, 2023
eab5c4d
Nothing
Nov 20, 2023
6906d74
Nothing
Nov 22, 2023
2f3ecaf
Parameterization, Warning messages fixed
Nov 22, 2023
9dc180f
Parameterization, Warning messages fixed
Nov 22, 2023
2981204
Parameterization, Warning messages fixed
Nov 22, 2023
6599899
Parameterization, Warning messages fixed
Nov 22, 2023
74765e3
Parameterization, Warning messages fixed
Nov 22, 2023
99e324f
Parameterization, Warning messages fixed
Nov 22, 2023
bee83d3
Parameterization, Warning messages fixed
Nov 22, 2023
a53258f
Parameterization, Warning messages fixed
Nov 22, 2023
1336377
Parameterization, Warning messages fixed
Nov 22, 2023
5fbbdea
Parameterization, Warning messages fixed
Nov 22, 2023
13650f5
Parameterization, Warning messages fixed
Nov 22, 2023
33fadfd
Parameterization, Warning messages fixed
Nov 22, 2023
81e1ea5
Unnecessary imports removed
Nov 22, 2023
75e81f0
Unnecessary imports removed
Nov 22, 2023
2bfb27f
Unnecessary imports removed
Nov 22, 2023
cadb30a
Removing ser warning messages
Nov 22, 2023
4597a03
Fixing serialization warnings
Nov 22, 2023
6117702
Unnecessary imports
Nov 22, 2023
903d16f
KeyEvent.CHAR_UNDEFINED was added as a parameter to the constructor
Nov 22, 2023
4bdf90d
Unnecessary import
Nov 22, 2023
9248a56
Parameterization
Nov 22, 2023
7058332
Parameterization
Nov 22, 2023
67d06f9
Nothing
Nov 22, 2023
a0883d0
Serialization warning fixed
Nov 22, 2023
8bdf3c4
Unnecessary import
Nov 22, 2023
446448f
Unnecesary import
Nov 22, 2023
d437a11
Unnecessary import
Nov 22, 2023
1d51637
Unnecessary import
Nov 22, 2023
e3cd043
Unnecessary import
Nov 22, 2023
808da6f
Unnecessary import
Nov 22, 2023
ea5cb3e
Unnecessary import
Nov 22, 2023
178ce93
Deprecated event constants are updated
Nov 22, 2023
b2991f2
Unnecessary import
Nov 22, 2023
9a2bc41
Unnecessary import
Nov 22, 2023
7743a1e
InputSrtream was not closed before
Nov 22, 2023
b7d8a9c
Parameterization
Nov 22, 2023
518ab58
Unnecessary import removed
Nov 22, 2023
ecb8e10
Unnecessary import
Nov 22, 2023
bd025d0
Unnecessary import
Nov 22, 2023
b9b06ca
Unnecessary import
Nov 22, 2023
df39584
Unnecessary import
Nov 22, 2023
0fda08e
Unnecessary import
Nov 22, 2023
0deec62
Unnecessary import
Nov 22, 2023
138bcae
Unnecessary import
Nov 22, 2023
5fa4997
Unnecessary import
Nov 22, 2023
98980ea
Unnecessary import
Nov 22, 2023
ffcb27d
Unnecessary import
Nov 22, 2023
7bb313b
Unnecessary import
Nov 22, 2023
310257a
Unnecessary import
Nov 22, 2023
a6141a5
Unnecessary import
Nov 22, 2023
e775489
Unnecessary import
Nov 22, 2023
1de4b77
Unnecessary import
Nov 22, 2023
504c30a
Unnecessary import
Nov 22, 2023
a69e592
waring fixed
Nov 22, 2023
0577f5c
warning fixed
Nov 22, 2023
59f5d19
serilaization warning message fixed
Nov 22, 2023
b02e2b1
Parameterzation
Nov 22, 2023
072f5e3
Parametrization
Nov 22, 2023
d8c2e4a
warning message fixed
Nov 22, 2023
1b691ec
Parameterzation
Nov 22, 2023
29a17a9
warning message fixed
Nov 22, 2023
c6bef04
Event constant updated
Nov 22, 2023
b8fb924
Parameterization
Nov 22, 2023
0e6370c
Warning messages fixed
Nov 22, 2023
7892019
Parametrization
Nov 22, 2023
3d3ce85
Nothing
Nov 22, 2023
4960d2c
Parametrization
Nov 22, 2023
8f654bd
Fix failing unit test
heuermh Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions core/src/main/java/org/piccolo2d/PCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class PCamera extends PNode {
private transient PComponent component;

/** List of layers viewed by this camera. */
private transient List/*<PLayer>*/ layers;
private transient List<PLayer> layers;

/**
* Transform applied to layers before they are rendered. This transform
Expand All @@ -143,7 +143,7 @@ public class PCamera extends PNode {
public PCamera() {
super();
viewTransform = new PAffineTransform();
layers = new ArrayList/*<PLayer>*/();
layers = new ArrayList<PLayer>();
viewConstraint = VIEW_CONSTRAINT_NONE;
}

Expand Down Expand Up @@ -215,7 +215,7 @@ public void repaintFromLayer(final PBounds viewBounds, final PLayer repaintedLay
*
* @return the list of layers viewed by this camera
*/
public List/*<PLayer>*/ getLayersReference() {
public List<PLayer> getLayersReference() {
return layers;
}

Expand Down Expand Up @@ -361,7 +361,7 @@ protected void paint(final PPaintContext paintContext) {
protected void paintCameraView(final PPaintContext paintContext) {
final int size = layers.size();
for (int i = 0; i < size; i++) {
final PLayer each = (PLayer) layers.get(i);
final PLayer each = layers.get(i);
each.fullPaint(paintContext);
}
}
Expand All @@ -377,21 +377,21 @@ protected void paintDebugInfo(final PPaintContext paintContext) {
final Graphics2D g2 = paintContext.getGraphics();
paintContext.setRenderQuality(PPaintContext.LOW_QUALITY_RENDERING);
g2.setStroke(new BasicStroke(0));
final ArrayList nodes = new ArrayList();
final ArrayList<PNode> nodes = new ArrayList<PNode>();
final PBounds nodeBounds = new PBounds();

final Color boundsColor = Color.red;
final Color fullBoundsColor = new Color(1.0f, 0f, 0f, 0.2f);

final int size = layers.size();
for (int i = 0; i < size; i++) {
((PLayer) layers.get(i)).getAllNodes(null, nodes);
layers.get(i).getAllNodes(null, nodes);
}

final Iterator i = getAllNodes(null, nodes).iterator();
final Iterator<PNode> i = getAllNodes(null, nodes).iterator();

while (i.hasNext()) {
final PNode each = (PNode) i.next();
final PNode each = i.next();

if (PDebug.debugBounds) {
g2.setPaint(boundsColor);
Expand Down Expand Up @@ -953,7 +953,7 @@ private void writeObject(final ObjectOutputStream out) throws IOException {
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();

layers = new ArrayList();
layers = new ArrayList<PLayer>();

while (true) {
final Object each = in.readObject();
Expand All @@ -962,7 +962,7 @@ private void readObject(final ObjectInputStream in) throws IOException, ClassNot
break;
}
else {
layers.add(each);
layers.add((PLayer)each);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/org/piccolo2d/PCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -852,29 +852,29 @@ private MouseEvent copyButtonsFromModifiers(final MouseEvent rawEvent, final int

int newButton = 0;

if (hasButtonModifier(rawEvent, InputEvent.BUTTON1_MASK)) {
if (hasButtonModifier(rawEvent, InputEvent.BUTTON1_DOWN_MASK)) {
newButton = MouseEvent.BUTTON1;
}
else if (hasButtonModifier(rawEvent, InputEvent.BUTTON2_MASK)) {
else if (hasButtonModifier(rawEvent, InputEvent.BUTTON2_DOWN_MASK)) {
newButton = MouseEvent.BUTTON2;
}
else if (hasButtonModifier(rawEvent, InputEvent.BUTTON3_MASK)) {
else if (hasButtonModifier(rawEvent, InputEvent.BUTTON3_DOWN_MASK)) {
newButton = MouseEvent.BUTTON3;
}

return buildModifiedMouseEvent(rawEvent, eventType, newButton);
}

private boolean hasButtonModifier(final MouseEvent event, final int buttonMask) {
return (event.getModifiers() & buttonMask) == buttonMask;
return (event.getModifiersEx() & buttonMask) == buttonMask;
}

public MouseEvent buildRetypedMouseEvent(final MouseEvent e, final int newType) {
return buildModifiedMouseEvent(e, newType, e.getButton());
}

public MouseEvent buildModifiedMouseEvent(final MouseEvent e, final int newType, final int newButton) {
return new MouseEvent((Component) e.getSource(), newType, e.getWhen(), e.getModifiers(), e.getX(),
return new MouseEvent((Component) e.getSource(), newType, e.getWhen(), e.getModifiersEx(), e.getX(),
e.getY(), e.getClickCount(), e.isPopupTrigger(), newButton);
}

Expand Down
16 changes: 8 additions & 8 deletions core/src/main/java/org/piccolo2d/PLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public class PLayer extends PNode {
/**
* Cameras which are registered as viewers of this PLayer.
*/
private transient List cameras;
private transient List<PCamera> cameras;

/**
* Creates a PLayer without any cameras attached to it.
*/
public PLayer() {
super();
cameras = new ArrayList();
cameras = new ArrayList<PCamera>();
}

// ****************************************************************
Expand All @@ -102,7 +102,7 @@ public PLayer() {
*
* @return direct reference to registered cameras
*/
public List getCamerasReference() {
public List<PCamera> getCamerasReference() {
return cameras;
}

Expand All @@ -125,7 +125,7 @@ public int getCameraCount() {
* @return camera at the given index
*/
public PCamera getCamera(final int index) {
return (PCamera) cameras.get(index);
return cameras.get(index);
}

/**
Expand Down Expand Up @@ -174,7 +174,7 @@ public PCamera removeCamera(final PCamera camera) {
* @return camera that was removed
*/
public PCamera removeCamera(final int index) {
final PCamera result = (PCamera) cameras.remove(index);
final PCamera result = cameras.remove(index);
invalidatePaint();
firePropertyChange(PROPERTY_CODE_CAMERAS, PROPERTY_CAMERAS, null, cameras);
return result;
Expand Down Expand Up @@ -213,7 +213,7 @@ public void repaintFrom(final PBounds localBounds, final PNode repaintSource) {
protected void notifyCameras(final PBounds parentBounds) {
final int count = getCameraCount();
for (int i = 0; i < count; i++) {
final PCamera each = (PCamera) cameras.get(i);
final PCamera each = cameras.get(i);
each.repaintFromLayer(parentBounds, this);
}
}
Expand Down Expand Up @@ -260,7 +260,7 @@ private void writeObject(final ObjectOutputStream out) throws IOException {
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();

cameras = new ArrayList();
cameras = new ArrayList<PCamera>();

while (true) {
final Object each = in.readObject();
Expand All @@ -269,7 +269,7 @@ private void readObject(final ObjectInputStream in) throws IOException, ClassNot
break;
}
else {
cameras.add(each);
cameras.add((PCamera)each);
}
}
}
Expand Down
35 changes: 18 additions & 17 deletions core/src/main/java/org/piccolo2d/PNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public class PNode implements Cloneable, Serializable, Printable {
private transient PNode parent;

/** Tracks all immediate child nodes. */
private List children;
private List<PNode> children;

/** Bounds of the PNode. */
private final PBounds bounds;
Expand Down Expand Up @@ -749,7 +749,7 @@ public void addAttribute(final Object key, final Object value) {
*
* @return an Enumeration over attribute keys
*/
public Enumeration getClientPropertyKeysEnumeration() {
public Enumeration<?> getClientPropertyKeysEnumeration() {
if (clientProperties == null) {
return PUtil.NULL_ENUMERATION;
}
Expand Down Expand Up @@ -2772,8 +2772,8 @@ public void setTransparency(final float newTransparency) {
final float oldTransparency = transparency;
transparency = newTransparency;
invalidatePaint();
firePropertyChange(PROPERTY_CODE_TRANSPARENCY, PROPERTY_TRANSPARENCY, new Float(oldTransparency),
new Float(newTransparency));
firePropertyChange(PROPERTY_CODE_TRANSPARENCY, PROPERTY_TRANSPARENCY, Float.valueOf(oldTransparency),
Float.valueOf(newTransparency));
}
}

Expand Down Expand Up @@ -3159,7 +3159,7 @@ public boolean fullPick(final PPickPath pickPath) {
* @param fullBounds bounds to compare against
* @param results array into which to add matches
*/
public void findIntersectingNodes(final Rectangle2D fullBounds, final ArrayList results) {
public void findIntersectingNodes(final Rectangle2D fullBounds, final ArrayList<PNode> results) {
if (fullIntersects(fullBounds)) {
final Rectangle2D localBounds = parentToLocal((Rectangle2D) fullBounds.clone());

Expand Down Expand Up @@ -3242,8 +3242,8 @@ public void addChild(final int index, final PNode child) {
*
* @param nodes a collection of nodes to be added to this node
*/
public void addChildren(final Collection nodes) {
final Iterator i = nodes.iterator();
public void addChildren(final Collection<PNode> nodes) {
final Iterator<PNode> i = nodes.iterator();
while (i.hasNext()) {
final PNode each = (PNode) i.next();
addChild(each);
Expand Down Expand Up @@ -3513,8 +3513,8 @@ public PNode removeChild(final int index) {
*
* @param childrenNodes the collection of children to remove
*/
public void removeChildren(final Collection childrenNodes) {
final Iterator i = childrenNodes.iterator();
public void removeChildren(final Collection<PNode> childrenNodes) {
final Iterator<PNode> i = childrenNodes.iterator();
while (i.hasNext()) {
final PNode each = (PNode) i.next();
removeChild(each);
Expand Down Expand Up @@ -3635,9 +3635,9 @@ public PNode getChild(final int index) {
*
* @return reference to the children list
*/
public List getChildrenReference() {
public List<PNode> getChildrenReference() {
if (children == null) {
children = new ArrayList();
children = new ArrayList<PNode>();
}
return children;
}
Expand All @@ -3647,9 +3647,10 @@ public List getChildrenReference() {
*
* @return iterator over this nodes children
*/
public ListIterator getChildrenIterator() {
public ListIterator<PNode> getChildrenIterator() {
if (children == null) {
return Collections.EMPTY_LIST.listIterator();
List<PNode> list = Collections.emptyList();
return list.listIterator();
}
return Collections.unmodifiableList(children).listIterator();
}
Expand All @@ -3673,7 +3674,7 @@ public PRoot getRoot() {
*
* @return a new collection containing this node and all descendants
*/
public Collection getAllNodes() {
public Collection<PNode> getAllNodes() {
return getAllNodes(null, null);
}

Expand All @@ -3688,10 +3689,10 @@ public Collection getAllNodes() {
* @param resultantNodes where matching nodes should be added
* @return a collection containing this node and all descendants
*/
public Collection getAllNodes(final PNodeFilter filter, final Collection resultantNodes) {
Collection results;
public Collection<PNode> getAllNodes(final PNodeFilter filter, final Collection<PNode> resultantNodes) {
Collection<PNode> results;
if (resultantNodes == null) {
results = new ArrayList();
results = new ArrayList<PNode>();
}
else {
results = resultantNodes;
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/org/piccolo2d/PRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class PRoot extends PNode {
private transient PInputManager defaultInputManager;

/** The Input Sources that are registered to this node. */
private final transient List inputSources;
private final transient List<InputSource> inputSources;

/**
* Used to provide a consistent clock time to activities as they are being
Expand All @@ -130,7 +130,7 @@ public class PRoot extends PNode {
*/
public PRoot() {
super();
inputSources = new ArrayList();
inputSources = new ArrayList<InputSource>();
globalTime = System.currentTimeMillis();
activityScheduler = new PActivityScheduler(this);
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public void waitForActivities() {

while (activityScheduler.getActivitiesReference().size() > 0) {
processInputs();
final Iterator i = getAllNodes(cameraWithCanvas, null).iterator();
final Iterator<PNode> i = getAllNodes(cameraWithCanvas, null).iterator();
while (i.hasNext()) {
final PCamera each = (PCamera) i.next();
each.getComponent().paintImmediately();
Expand Down Expand Up @@ -323,9 +323,9 @@ public void processInputs() {

globalTime = System.currentTimeMillis();
if (inputSources.size() > 0) {
final Iterator inputSourceIterator = inputSources.iterator();
final Iterator<InputSource> inputSourceIterator = inputSources.iterator();
while (inputSourceIterator.hasNext()) {
final InputSource each = (InputSource) inputSourceIterator.next();
final InputSource each = inputSourceIterator.next();
each.processInput();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public class PActivityScheduler implements Serializable {
private static final long serialVersionUID = 1L;
private transient Timer activityTimer = null;
private final PRoot root;
private final List activities;
private final List<PActivity> activities;
private boolean activitiesChanged;
private boolean animating;
private final ArrayList processingActivities;
private final ArrayList<PActivity> processingActivities;

/**
* Constructs an instance of PActivityScheduler. All activities it will
Expand All @@ -72,8 +72,8 @@ public class PActivityScheduler implements Serializable {
*/
public PActivityScheduler(final PRoot rootNode) {
root = rootNode;
activities = new ArrayList();
processingActivities = new ArrayList();
activities = new ArrayList<PActivity>();
processingActivities = new ArrayList<PActivity>();
}

/**
Expand Down Expand Up @@ -157,7 +157,7 @@ public void removeAllActivities() {
*
* @return reference to the current activities list.
*/
public List getActivitiesReference() {
public List<PActivity> getActivitiesReference() {
return activities;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public PDragEventHandler() {
draggedNode = null;
raiseToTopOnPress = false;

setEventFilter(new PInputEventFilter(InputEvent.BUTTON1_MASK));
setEventFilter(new PInputEventFilter(InputEvent.BUTTON1_DOWN_MASK));
}

/**
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/org/piccolo2d/event/PInputEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,14 @@ public boolean isActionKey() {
*
* @return modifier flags for the input event
*/
public int getModifiers() {
/*
private int getModifiers() {
if (!isFocusEvent()) {
return inputEvent.getModifiers();
}
throw new IllegalStateException("Can't get modifiers from focus event");
}
*/

/**
* Returns the extended modifiers provided for the input event by swing.
Expand Down
Loading