[piccolo2d-dev] Issue 32 in piccolo2d: PSwing mouse wheel support
Comment #4 on issue 32 by allain.lalonde: PSwing mouse wheel support http://code.google.com/p/piccolo2d/issues/detail?id=32 I've applied the changes manually by analyzing the patch above. It works flawlessly! Good job steve! I've attached the patch. I will commit the changes after I examine the code more closely. Attachments: patch.diff 27.4 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] Issue 121 in piccolo2d: Refactor PNode to break out some responsibilities.
Comment #1 on issue 121 by heuermh: Refactor PNode to break out some responsibilities. http://code.google.com/p/piccolo2d/issues/detail?id=121 I agree, toImage and print functionality seem like good candidates for extracting out into instances of the Strategy pattern. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] [piccolo2d] r655 committed - Resolved Issue 32 using steveonjava's code....
Revision: 655 Author: allain.lalonde Date: Thu Aug 6 09:07:42 2009 Log: Resolved Issue 32 using steveonjava's code. Also, tidied up the PSwingEventHandler code. http://code.google.com/p/piccolo2d/source/detail?r=655 Added: /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEvent.java /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingMouseWheelEvent.java Modified: /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingCanvas.java /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingMouseEvent.java /piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingCanvasTest.java /piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java === --- /dev/null +++ /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEvent.java Thu Aug 6 09:07:42 2009 @@ -0,0 +1,127 @@ +/* + * Copyright 2007 Stephen Chin + * + * All rights reserved. + */ +package edu.umd.cs.piccolox.pswing; + +import java.awt.event.MouseEvent; +import java.awt.geom.Point2D; + +import edu.umd.cs.piccolo.PNode; +import edu.umd.cs.piccolo.util.PPickPath; + +public interface PSwingEvent { +/** + * Returns the x,y position of the event in the local coordinate system of + * the node the event occurred on. + * + * @return a Point2D object containing the x and y coordinates local to the + * node. + */ +Point2D getLocalPoint(); + +/** + * Returns the horizontal x position of the event in the local coordinate + * system of the node the event occurred on. + * + * @return x a double indicating horizontal position local to the node. + */ +double getLocalX(); + +/** + * Returns the vertical y position of the event in the local coordinate + * system of the node the event occurred on. + * + * @return y a double indicating vertical position local to the node. + */ +double getLocalY(); + +/** + * Determine the event type. + * + * @return the id + */ +int getID(); + +/** + * Determine the node the event originated at. If an event percolates up the + * tree and is handled by an event listener higher up in the tree than the + * original node that generated the event, this returns the original node. + * For mouse drag and release events, this is the node that the original + * matching press event went to - in other words, the event is 'grabbed' by + * the originating node. + * + * @return the node + */ +PNode getNode(); + +/** + * Determine the path the event took from the PCanvas down to the visual + * component. + * + * @return the path + */ +PPickPath getPath(); + +/** + * Determine the node the event originated at. If an event percolates up the + * tree and is handled by an event listener higher up in the tree than the + * original node that generated the event, this returns the original node. + * For mouse drag and release events, this is the node that the original + * matching press event went to - in other words, the event is 'grabbed' by + * the originating node. + * + * @return the node + */ +PNode getGrabNode(); + +/** + * Return the path from the PCanvas down to the currently grabbed object. + * + * @return the path + */ +PPickPath getGrabPath(); + +/** + * Get the current node that is under the cursor. This may return a + * different result then getGrabNode() when in a MOUSE_RELEASED or + * MOUSE_DRAGGED event. + * + * @return the current node. + */ +PNode getCurrentNode(); + +/** + * Get the path from the PCanvas down to the visual component currently + * under the mouse.This may give a different result then getGrabPath() + * during a MOUSE_DRAGGED or MOUSE_RELEASED operation. + * + * @return the current path. + */ +PPickPath getCurrentPath(); + +/** + * Calls appropriate method on the listener based on this events ID. + * + * @param listener the MouseListener or MouseMotionListener to dispatch to. + */ +void dispatchTo(Object listener); + +/** + * Set the souce of this event. As the event is fired up the tree the source + * of the event will keep changing to reflect the scenegraph object that is + * firing the event. + * + * @param aSource + */ +void setSource(Object aSource); + +/** + * Returns this event as a mouse event. This reduces the need to cast + * instances of this interface when they are known to all extend MouseEvent. +
[piccolo2d-dev] Issue 120 in piccolo2d: ant all fails to build all of piccolo
Comment #9 on issue 120 by dave.jarvis: ant all fails to build all of piccolo http://code.google.com/p/piccolo2d/issues/detail?id=120 http://maven.apache.org/ant-tasks ;-) The rhetoric isn't anti-IDE. It's anti-specific-IDE. IDEs are a great productivity boon, and have been since the early days of Borland. Part of the documentation I read implied that working on Piccolo2D required Eclipse. I may have misread. I may have been hasty, as it did not compile with ant (unlike so many other libraries I was researching). Good luck with Piccolo2D! -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] Issue 121 in piccolo2d: Refactor PNode to break out some responsibilities.
Comment #2 on issue 121 by mr0...@mro.name: Refactor PNode to break out some responsibilities. http://code.google.com/p/piccolo2d/issues/detail?id=121 Couldn't they even be completely removed from PNode and rather be decorators to PNode leveraging POffscreenCanvas? -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] [piccolo2d] r658 committed - Issue 111 ; API and javadoc improvements to PHtmlView, html -- text, ...
Revision: 658 Author: heuermh Date: Thu Aug 6 10:18:47 2009 Log: Issue 111 ; API and javadoc improvements to PHtmlView, html -- text, htmlColor -- textColor, clickedAddress -- linkAddressAt, etc. http://code.google.com/p/piccolo2d/source/detail?r=658 Modified: /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java /piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/HtmlViewExample.java === --- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java Thu Aug 6 09:14:02 2009 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java Thu Aug 6 10:18:47 2009 @@ -36,7 +36,6 @@ import java.awt.geom.Rectangle2D; import javax.swing.JLabel; -import javax.swing.JTextField; import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.Position; import javax.swing.text.View; @@ -45,8 +44,8 @@ import edu.umd.cs.piccolo.util.PPaintContext; /** - * PHtml is a Piccolo node for rendering HTML text. It uses a JLabel under the - * hood so you have the same restrictions regarding html as you have when using + * PHtmlView is a Piccolo node for rendering HTML text. It uses a JLabel under the + * hood so you have the same restrictions regarding HTML as you have when using * standard Swing components (HTML 3.2 + subset of CSS 1.0). * * @author Chris Malley (cmal...@pixelzoom.com) @@ -55,13 +54,15 @@ */ public class PHtmlView extends PNode { +/** Default serial version UID. */ private static final long serialVersionUID = 1L; -/** Default font to use if not overridden in the HTML markup. */ -private static final Font DEFAULT_FONT = new JTextField().getFont(); - -/** Default font color to use if not overridden in the HTML markup. */ -private static final Color DEFAULT_HTML_COLOR = Color.BLACK; +/** Default font if not otherwise specified in the HTML text, 12 point codeSansSerif/code. */ +// public static final Font DEFAULT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12); jdk 1.6+ +public static final Font DEFAULT_FONT = new Font(SansSerif, Font.PLAIN, 12); + +/** Default text color if not otherwise specified in the HTML text, codeColor.BLACK/code. */ +public static final Color DEFAULT_TEXT_COLOR = Color.BLACK; /** * The property name that identifies a change of this node's font (see @@ -78,35 +79,35 @@ public static final int PROPERTY_CODE_FONT = 1 20; /** - * The property name that identifies a change of this node's HTML (see + * The property name that identifies a change of this node's HTML text (see * {...@link #getHTML getHTML}). Both old and new value will be set in any * property change event. */ -public static final String PROPERTY_HTML = html; +public static final String PROPERTY_TEXT = text; /** - * The property code that identifies a change of this node's HTML (see + * The property code that identifies a change of this node's HTML text (see * {...@link #getHTML getHTML}). Both old and new value will be set in any * property change event. */ -public static final int PROPERTY_CODE_HTML = 1 21; +public static final int PROPERTY_CODE_TEXT = 1 21; /** - * The property name that identifies a change of this node's HTML color (see + * The property name that identifies a change of this node's HTML text color (see * {...@link #getHtml getHTMLColor}). Both old and new value will be set in any * property change event. */ -public static final String PROPERTY_HTML_COLOR = html color; +public static final String PROPERTY_TEXT_COLOR = text color; /** - * The property code that identifies a change of this node's HTML color (see + * The property code that identifies a change of this node's HTML text color (see * {...@link #getHtml getHTMLColor}). Both old and new value will be set in any * property change event. */ -public static final int PROPERTY_CODE_HTML_COLOR = 1 22; +public static final int PROPERTY_CODE_TEXT_COLOR = 1 22; /** Underlying JLabel used to handle the rendering logic. */ -private final JLabel htmlLabel; +private final JLabel label; /** Object that encapsulates the HTML rendering logic. */ private View htmlView; @@ -115,124 +116,114 @@ private final Rectangle htmlBounds; /** - * Creates an empty PHtml node with default font and color. + * Create an empty HTML text node with the default font and text color. */ public PHtmlView() { -this(null, DEFAULT_FONT, DEFAULT_HTML_COLOR); +this(null, DEFAULT_FONT, DEFAULT_TEXT_COLOR); } /** - * Creates a PHtml node that
[piccolo2d-dev] Issue 111 in piccolo2d: Piccolo is missing HTML support
Comment #7 on issue 111 by heuermh: Piccolo is missing HTML support http://code.google.com/p/piccolo2d/issues/detail?id=111 Committed some of the changes I mentioned above for review in r658. $ svn commit -m Issue 111 ; API and javadoc improvements to PHtmlView, html -- text, htmlColor -- textColor, clickedAddress -- linkAddressAt, etc. Sending... Transmitting file data ... Committed revision 658. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] [piccolo2d] r656 committed - Issue 111 ; adding correct license header text
Revision: 656 Author: heuermh Date: Thu Aug 6 09:14:02 2009 Log: Issue 111 ; adding correct license header text http://code.google.com/p/piccolo2d/source/detail?r=656 Modified: /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java /piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/HtmlViewExample.java === --- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java Tue Aug 4 09:04:02 2009 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java Thu Aug 6 09:14:02 2009 @@ -1,4 +1,5 @@ /* + * Copyright (c) 2008-2009, Piccolo2D project, http://piccolo2d.org * Copyright (c) 1998-2008, University of Maryland * All rights reserved. * === --- /piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/HtmlViewExample.java Tue Aug 4 07:32:58 2009 +++ /piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/HtmlViewExample.java Thu Aug 6 09:14:02 2009 @@ -1,3 +1,31 @@ +/* + * Copyright (c) 2008-2009, Piccolo2D project, http://piccolo2d.org + * Copyright (c) 1998-2008, University of Maryland + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + * and the following disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * None of the name of the University of Maryland, the name of the Piccolo2D project, or the names of its + * contributors may be used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ package edu.umd.cs.piccolo.examples; import java.awt.geom.Point2D; --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] Issue 120 in piccolo2d: ant all fails to build all of piccolo
Status: New Owner: New issue 120 by dave.jarvis: ant all fails to build all of piccolo http://code.google.com/p/piccolo2d/issues/detail?id=120 What steps will reproduce the problem? 1. Download Piccolo2D. 2. Unzip archive. 3. ant all What is the expected output? Expected at least one .jar file to be built. What do you see instead? ./piccolo-1.2.1/build/tests/src/NotificationCenterTest.java:33: cannot find symbol [javac] symbol : method postNotification(java.lang.String,NotificationCenterTest) [javac] location: class edu.umd.cs.piccolox.event.PNotificationCenter [javac] center.postNotification(otherPropertyChanged, this); [javac] ^ [javac] 100 errors Plus others. What version of the product are you using? $ wget http://piccolo2d.googlecode.com/files/Piccolo2D.Java-1.2.1.zip On what operating system? $ uname -a Linux jaguar 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12 UTC 2009 x86_64 GNU/Linux Please provide any additional information below. $ ant -version Apache Ant version 1.7.1 compiled on June 27 2008 $ java -version java version 1.6.0_13 Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode) -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] [piccolo2d] r639 committed - Additional Checkstyle fixes. Also, made java doc comments on private m...
Revision: 639 Author: allain.lalonde Date: Mon Aug 3 19:46:04 2009 Log: Additional Checkstyle fixes. Also, made java doc comments on private members/fields optional. http://code.google.com/p/piccolo2d/source/detail?r=639 Modified: /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCamera.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventListener.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransformException.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PObjectOutputStream.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PStack.java /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java === --- /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xmlSun Aug 2 19:48:01 2009 +++ /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xmlMon Aug 3 19:46:04 2009 @@ -45,9 +45,15 @@ !-- Checks for Javadoc comments. -- !-- See http://checkstyle.sf.net/config_javadoc.html -- -module name=JavadocMethod/ -module name=JavadocType/ -module name=JavadocVariable/ +module name=JavadocMethod + property name=scope value=protected/ +/module +module name=JavadocType + property name=scope value=public/ +/module +module name=JavadocVariable +property name=scope value=protected / +/module module name=JavadocStyle/ === --- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCamera.java Sat Aug 1 04:53:29 2009 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCamera.java Mon Aug 3 19:46:04 2009 @@ -443,7 +443,7 @@ public void fullPaint(final PPaintContext paintContext) { paintContext.pushCamera(this); super.fullPaint(paintContext); -paintContext.popCamera(this); +paintContext.popCamera(); } /** === --- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java Sun Aug 2 19:48:01 2009 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java Mon Aug 3 19:46:04 2009 @@ -3642,5 +3642,5 @@ * @param node node needing repaint */ void nodeFullBoundsInvalidated(PNode node); -} -} +} +} === --- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java Sun Aug 2 19:48:01 2009 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java Mon Aug 3 19:46:04 2009 @@ -89,7 +89,7 @@ * Changes the cursor to the one provided and stores it on the cursor stack * for later retrieval. * - * @param cursor + * @param cursor cursor to push on cursor stack */ public void pushCursor(final Cursor cursor) { final PComponent component = getTopCamera().getComponent(); @@ -131,6 +131,8 @@ /** * Return the topmost camera this is painting. This is the camera associated * with the PCanvas that requested the current repaint. + * + * @return topmost camera on the pick path */ public PCamera getTopCamera() { return getPath().getTopCamera(); @@ -139,6 +141,8 @@ /** * Get the canvas associated with the top camera. This is the canvas where * the originating swing event came from. + * + * @return component attached to the top camera of the current pick path */ public PComponent getComponent() { return getTopCamera().getComponent(); @@ -148,6 +152,8 @@ * Return the input manager that dispatched this event. You can use this * input manager to find the current mouse focus, mouse over, and key focus * nodes. You can also set a new key focus node. + * + * @return input manager that dispatched this event */ public PInputManager getInputManager() { return inputManager; @@ -155,11 +161,18 @@ /** * Return the PPickPath associated with this input event. + * + * @return pick path associated with this event (may be null) */ public PPickPath getPath() { return pickPath; } +/** + * Sets the PIckPath
[piccolo2d-dev] [piccolo2d] r657 committed - Issue 111 ; adding correct license header text
Revision: 657 Author: heuermh Date: Thu Aug 6 09:58:59 2009 Log: Issue 111 ; adding correct license header text http://code.google.com/p/piccolo2d/source/detail?r=657 Modified: /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java === --- /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java Tue Aug 4 07:26:15 2009 +++ /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java Thu Aug 6 09:58:59 2009 @@ -1,3 +1,31 @@ +/* + * Copyright (c) 2008-2009, Piccolo2D project, http://piccolo2d.org + * Copyright (c) 1998-2008, University of Maryland + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + * and the following disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * None of the name of the University of Maryland, the name of the Piccolo2D project, or the names of its + * contributors may be used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ package edu.umd.cs.piccolo.nodes; import java.awt.Color; --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] Issue 111 in piccolo2d: Piccolo is missing HTML support
Comment #8 on issue 111 by heuermh: Piccolo is missing HTML support http://code.google.com/p/piccolo2d/issues/detail?id=111 PHtmlView should also provide the paintGreek/greekThreshold mechanism as in PText and PSwing. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] [piccolo2d] r659 committed - Added test for PHtmlViewTest that checks for paint covering the entire...
Revision: 659 Author: allain.lalonde Date: Thu Aug 6 11:20:01 2009 Log: Added test for PHtmlViewTest that checks for paint covering the entire bounds. http://code.google.com/p/piccolo2d/source/detail?r=659 Modified: /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java === --- /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java Thu Aug 6 10:18:47 2009 +++ /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java Thu Aug 6 11:20:01 2009 @@ -30,9 +30,16 @@ import java.awt.Color; import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; import junit.framework.TestCase; import edu.umd.cs.piccolo.MockPropertyChangeListener; +import edu.umd.cs.piccolo.PCanvas; import edu.umd.cs.piccolo.util.PBounds; /** @@ -219,4 +226,28 @@ html.setFont(font); assertSame(font, html.getFont()); } -} + +public void testPaintFillsBounds() throws IOException { +PHtmlView html = new PHtmlView(htmlbody30. Lorem ipsum dolor sit amet, consectetur adipiscing elit posuere./body/html); +html.setBounds(0, 0, 400, 30); +html.setPaint(Color.RED); + +PCanvas canvas = new PCanvas(); +canvas.setBackground(Color.WHITE); +canvas.setBounds(0, 0, 500, 30); +canvas.getLayer().addChild(html); + +BufferedImage image = new BufferedImage(600, 30, BufferedImage.TYPE_INT_RGB); +Graphics2D g2 = image.createGraphics(); +canvas.paint(g2); + +ImageIO.write(image, JPEG, new File(C:\\html.jpg)); +assertEquals(Color.red.getRGB(), image.getRGB(0, 0)); +assertEquals(Color.red.getRGB(), image.getRGB(0, 15)); +assertEquals(Color.red.getRGB(), image.getRGB(0, 29)); +assertEquals(Color.red.getRGB(), image.getRGB(399, 0)); +assertEquals(Color.white.getRGB(), image.getRGB(400, 0)); + + +} +} --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] Issue 117 in piccolo2d: Text rendering in PText and JLabel via PSwing appear not to respect antialiasing rendering hints
Comment #2 on issue 117 by heuermh: Text rendering in PText and JLabel via PSwing appear not to respect antialiasing rendering hints http://code.google.com/p/piccolo2d/issues/detail?id=117 Attaching new version of text-rendering-benchmark.jar with PHtmlView. PHtmlView appears to have the same behaviour as PSwing described above. Attachments: text-rendering-benchmark.jar 357 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~-~--~~~---~--~~ Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en -~--~~~~--~~--~--~---
[piccolo2d-dev] [piccolo2d] r663 committed - Major reworking to PHtmlView so that it calculates its bounds correctl...
Revision: 663 Author: allain.lalonde Date: Thu Aug 6 16:04:58 2009 Log: Major reworking to PHtmlView so that it calculates its bounds correctly based on a fixed width and a variable height. Will make it more generic later. http://code.google.com/p/piccolo2d/source/detail?r=663 Modified: /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/nodes/PHtmlViewTest.java === --- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java Thu Aug 6 11:46:49 2009 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java Thu Aug 6 16:04:58 2009 @@ -29,12 +29,13 @@ package edu.umd.cs.piccolo.nodes; import java.awt.Color; +import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics2D; -import java.awt.Rectangle; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; +import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.Position; @@ -44,9 +45,9 @@ import edu.umd.cs.piccolo.util.PPaintContext; /** - * PHtmlView is a Piccolo node for rendering HTML text. It uses a JLabel under the - * hood so you have the same restrictions regarding HTML as you have when using - * standard Swing components (HTML 3.2 + subset of CSS 1.0). + * PHtmlView is a Piccolo node for rendering HTML text. It uses a JLabel under + * the hood so you have the same restrictions regarding HTML as you have when + * using standard Swing components (HTML 3.2 + subset of CSS 1.0). * * @author Chris Malley (cmal...@pixelzoom.com) * @author Sam Reid @@ -57,11 +58,18 @@ /** Default serial version UID. */ private static final long serialVersionUID = 1L; -/** Default font if not otherwise specified in the HTML text, 12 point codeSansSerif/code. */ -// public static final Font DEFAULT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12); jdk 1.6+ +/** + * Default font if not otherwise specified in the HTML text, 12 point + * codeSansSerif/code. + */ +// public static final Font DEFAULT_FONT = new Font(Font.SANS_SERIF, +// Font.PLAIN, 12); jdk 1.6+ public static final Font DEFAULT_FONT = new Font(SansSerif, Font.PLAIN, 12); -/** Default text color if not otherwise specified in the HTML text, codeColor.BLACK/code. */ +/** + * Default text color if not otherwise specified in the HTML text, + * codeColor.BLACK/code. + */ public static final Color DEFAULT_TEXT_COLOR = Color.BLACK; /** @@ -93,16 +101,16 @@ public static final int PROPERTY_CODE_TEXT = 1 21; /** - * The property name that identifies a change of this node's HTML text color (see - * {...@link #getHtml getHTMLColor}). Both old and new value will be set in any - * property change event. + * The property name that identifies a change of this node's HTML text color + * (see {...@link #getHtml getHTMLColor}). Both old and new value will be set + * in any property change event. */ public static final String PROPERTY_TEXT_COLOR = text color; /** - * The property code that identifies a change of this node's HTML text color (see - * {...@link #getHtml getHTMLColor}). Both old and new value will be set in any - * property change event. + * The property code that identifies a change of this node's HTML text color + * (see {...@link #getHtml getHTMLColor}). Both old and new value will be set + * in any property change event. */ public static final int PROPERTY_CODE_TEXT_COLOR = 1 22; @@ -112,9 +120,6 @@ /** Object that encapsulates the HTML rendering logic. */ private View htmlView; -/** Used to enforce bounds and wrapping on the HTML. */ -private final Rectangle htmlBounds; - /** * Create an empty HTML text node with the default font and text color. */ @@ -123,7 +128,8 @@ } /** - * Create a HTML text node with the specified HTML text and the default font and text color. + * Create a HTML text node with the specified HTML text and the default font + * and text color. * * @param text HTML text for this HTML text node */ @@ -132,8 +138,9 @@ } /** - * Create a HTML text node with the specified HTML text, font, and text color. The font - * and text color are used to render the HTML text if not otherwise specified via CSS. + * Create a HTML text node with the specified HTML text, font, and text + * color. The font and text color are used to render the HTML text if not + * otherwise specified via CSS. * * @param text HTML text for this HTML text node * @param font font for this HTML text node @@ -143,7 +150,6 @@ label = new