[piccolo2d-dev] Re: [piccolo2d] r628 commited - FingBugs Hunting.

2009-07-30 Thread Michael Heuer

 snip
 /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwing.java
      /**
       * The cutoff at which the Swing component is rendered greek
       */
 -    private final double renderCutoff = 0.3;
 +    private static final double GREEK_SCALE_CUT_OFF = 0.3d;

Similar values in PText are called greekThreshold and
DEFAULT_GREEK_THRESHOLD.  PText also has get/setGreekThreshold.

      private JComponent component = null;
      private double minFontSize = Double.MAX_VALUE;
 -    private Stroke defaultStroke = new BasicStroke();
 +    private transient Stroke defaultStroke = new BasicStroke();
      private Font defaultFont = new Font(Serif, Font.PLAIN, 12);

Should these defaults be static and final?


Strange that PSwing overrides protected void paint(PPaintContext) with
public void paint(PPaintContext).  I recommend refactoring to

public void paint(PPaintContext) -- protected void paint(PPaintContext)
public void paintAsGreek(Graphics2D) -- protected void
paintGreek(PPaintContext)
public void paint(Graphics2D) -- protected void paintComponent(PPaintContext)

Subclasses might want access to the entire paint context for
paintGreek and paintComponent, not just the graphics.  I wonder how
much work this change would be though. . .

   michael

--~--~-~--~~~---~--~~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~--~~~~--~~--~--~---



[piccolo2d-dev] Re: [piccolo2d] r628 commited - FingBugs Hunting.

2009-07-30 Thread allain

Yes they should be protected, should you do it? No.

Not until 2.0 at least since client code that calls it directly would
break.

If you want to do it anyway, I'm all for it, but since we're not
marking constants as final till 2.0, this one seems like a no go till
then either.

On Jul 30, 4:31 pm, Michael Heuer heue...@gmail.com wrote:
  snip
  /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwin 
  g.java
       /**
        * The cutoff at which the Swing component is rendered greek
        */
  -    private final double renderCutoff = 0.3;
  +    private static final double GREEK_SCALE_CUT_OFF = 0.3d;

 Similar values in PText are called greekThreshold and
 DEFAULT_GREEK_THRESHOLD.  PText also has get/setGreekThreshold.

       private JComponent component = null;
       private double minFontSize = Double.MAX_VALUE;
  -    private Stroke defaultStroke = new BasicStroke();
  +    private transient Stroke defaultStroke = new BasicStroke();
       private Font defaultFont = new Font(Serif, Font.PLAIN, 12);

 Should these defaults be static and final?

 Strange that PSwing overrides protected void paint(PPaintContext) with
 public void paint(PPaintContext).  I recommend refactoring to

 public void paint(PPaintContext) -- protected void paint(PPaintContext)
 public void paintAsGreek(Graphics2D) -- protected void
 paintGreek(PPaintContext)
 public void paint(Graphics2D) -- protected void paintComponent(PPaintContext)

 Subclasses might want access to the entire paint context for
 paintGreek and paintComponent, not just the graphics.  I wonder how
 much work this change would be though. . .

    michael
--~--~-~--~~~---~--~~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~--~~~~--~~--~--~---



[piccolo2d-dev] Re: [piccolo2d] r628 commited - FingBugs Hunting.

2009-07-30 Thread Michael Heuer

Breaking binary compatibility is not really an issue with extras.  I
still wouldn't do it lightly though.  I'm not a user of PSwing, is it
a common to extend it in client code?

I will create an issue and an updated patch with some additional API
cleanup for review.

   michael


allainallain.lalo...@gmail.com wrote:

 Yes they should be protected, should you do it? No.

 Not until 2.0 at least since client code that calls it directly would
 break.

 If you want to do it anyway, I'm all for it, but since we're not
 marking constants as final till 2.0, this one seems like a no go till
 then either.

 On Jul 30, 4:31 pm, Michael Heuer heue...@gmail.com wrote:
  snip
  /piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwin
   g.java
       /**
        * The cutoff at which the Swing component is rendered greek
        */
  -    private final double renderCutoff = 0.3;
  +    private static final double GREEK_SCALE_CUT_OFF = 0.3d;

 Similar values in PText are called greekThreshold and
 DEFAULT_GREEK_THRESHOLD.  PText also has get/setGreekThreshold.

       private JComponent component = null;
       private double minFontSize = Double.MAX_VALUE;
  -    private Stroke defaultStroke = new BasicStroke();
  +    private transient Stroke defaultStroke = new BasicStroke();
       private Font defaultFont = new Font(Serif, Font.PLAIN, 12);

 Should these defaults be static and final?

 Strange that PSwing overrides protected void paint(PPaintContext) with
 public void paint(PPaintContext).  I recommend refactoring to

 public void paint(PPaintContext) -- protected void paint(PPaintContext)
 public void paintAsGreek(Graphics2D) -- protected void
 paintGreek(PPaintContext)
 public void paint(Graphics2D) -- protected void 
 paintComponent(PPaintContext)

 Subclasses might want access to the entire paint context for
 paintGreek and paintComponent, not just the graphics.  I wonder how
 much work this change would be though. . .

    michael
 


--~--~-~--~~~---~--~~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~--~~~~--~~--~--~---