JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
bug_report_small.png
CLOSED  Bug report JPPF-414  -  Multiple issues in the fractal images sample
Posted Oct 02, 2015 - updated Aug 15, 2018
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Bug report
  • Status
     
    Closed
  • Assigned to
     lolo4j
  • Progress
       
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     lolo4j
  • Owned by
    Not owned by anyone
  • Category
    Samples
  • Resolution
    RESOLVED
  • Priority
    Normal
  • Reproducability
    Always
  • Severity
    Normal
  • Targetted for
    icon_milestones.png JPPF 5.0.x
Issue description
I have noticed a number of issues in the Mandlebrot fractal images sample:

1) the GUI startup size is fixed (always the same) when it should be computed according to the configured image dimensions

2) the progress/wait bar never appears, except for the first image computation when replaying a record set. For individual computations, I ever see it.

3) when trying to save a recordset, the specified file is not created and the log shows the following exception:
2015-10-02 04:38:39,780 [ERROR][org.jppf.ui.options.event.ScriptedValueChangeListener.valueChanged(110)]: Error while executing script for [Option : org.jppf.ui.options.FileChooserOption] name=mandelbrot.save; label=null; path=//JPPFFractals/Tabs/MandelbrotSet/mandelbrot.toolbar/mandelbrot.save
Script = 
import java.lang.*
import java.util.*
import java.util.concurrent.*
import org.jppf.example.fractals.*
import org.jppf.example.fractals.mandelbrot.*
import org.jppf.example.fractals.lyapunov.*
import org.jppf.client.*
import org.jppf.server.protocol.*
import org.jppf.ui.monitoring.data.*
import org.jppf.ui.options.*
import org.jppf.ui.options.factory.*
import org.jppf.ui.options.event.*
import org.jppf.ui.utils.*
import org.jppf.utils.*
import java.awt.*
import java.awt.event.*
import javax.swing.*
 
MandelbrotConfiguration createConfig() {
  def x = option.findFirstWithName("/centerX").getValue();
  def y = option.findFirstWithName("/centerY").getValue();
  def d = option.findFirstWithName("/diameter").getValue();
  def iter = option.findFirstWithName("/iterations").getValue();
  return new MandelbrotConfiguration(x, y, d, iter.intValue());
}
 
void computeMandelbrot(config) {
  def future = RunnerFactory.getRunner("mandelbrot").submitExecution(config)
  def img = future.get().getImage()
  option.findFirstWithName("/mandelbrotImage").getUIComponent().setImage(img)
}
 
void applyConfig(x, y, d, iter) {
  option.findFirstWithName("/centerX").setValue(x);
  option.findFirstWithName("/centerY").setValue(y);
  option.findFirstWithName("/diameter").setValue(d);
  option.findFirstWithName("/iterations").setValue(iter);
}
 
void zoom(isZoomIn) {
  def d = option.findFirstWithName("/diameter").getValue();
  def f = option.findFirstWithName("/mandelbrotZoomFactor").getValue();
  option.findFirstWithName("/diameter").setValue(isZoomIn ? d/f : d*f);
  computeMandelbrot(createConfig());
}
 
void onMouseClicked(event) {
  def button = event.getButton();
  if ((button == MouseEvent.BUTTON1) || (button == MouseEvent.BUTTON3)) {
    def mouseX = event.getX();
    def mouseY = event.getY();
    def centerX = option.findFirstWithName("/centerX").getValue();
    def centerY = option.findFirstWithName("/centerY").getValue();
    def d = option.findFirstWithName("/diameter").getValue();
    def jppfConfig = JPPFConfiguration.getProperties();
    def width = jppfConfig.getInt("image.width", 800);
    def height = jppfConfig.getInt("image.height", 600);
    def minX = centerX - d/2;
    def x = mouseX * d / width + minX;
    def minY = centerY - d/2;
    def y = (height - mouseY - 1) * d / (double) height + minY;
    def f = option.findFirstWithName("/mandelbrotZoomFactor").getValue();
 
    d = (button == MouseEvent.BUTTON1) ? d/f : d * f;
    def iter = option.findFirstWithName("/iterations").getValue();
    applyConfig(x, y, d, iter);
    computeMandelbrot(createConfig());
  }
}
 
RunnerFactory.getRunner("mandelbrot").saveRecords(option.getValue())>
org.jppf.scripting.JPPFScriptingException: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script5.groovy: 71: unexpected token: > @ line 71, column 69.
1 error
 
  at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:145)
  at org.jppf.scripting.ScriptRunnerImpl.evaluate(ScriptRunnerImpl.java:100)
  at org.jppf.ui.options.event.ScriptedValueChangeListener.valueChanged(ScriptedValueChangeListener.java:103)
  at org.jppf.ui.options.AbstractOption.fireValueChanged(AbstractOption.java:111)
  at org.jppf.ui.options.FileChooserOption.doChooseFile(FileChooserOption.java:155)
  at org.jppf.ui.options.FileChooserOption$1.actionPerformed(FileChooserOption.java:108)
  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
  at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
  at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
  at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
  at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
  at java.awt.Component.processMouseEvent(Component.java:6505)
  at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
  at java.awt.Component.processEvent(Component.java:6270)
  at java.awt.Container.processEvent(Container.java:2229)
  at java.awt.Component.dispatchEventImpl(Component.java:4861)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
  at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
  at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
  at java.awt.Container.dispatchEventImpl(Container.java:2273)
  at java.awt.Window.dispatchEventImpl(Window.java:2719)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
  at java.awt.EventQueue.access$200(EventQueue.java:103)
  at java.awt.EventQueue$3.run(EventQueue.java:694)
  at java.awt.EventQueue$3.run(EventQueue.java:692)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
  at java.awt.EventQueue$4.run(EventQueue.java:708)
  at java.awt.EventQueue$4.run(EventQueue.java:706)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Steps to reproduce this issue
See description

#3
Comment posted by
 lolo4j
Oct 03, 10:48
Fixed in: While I was at it, I also implemented an API to create and use custom mouse cursors, so now the cursor changes to a crosshair-like cursor when hovering over the image.