peakay / miglayout

Automatically exported from code.google.com/p/miglayout
0 stars 0 forks source link

Miglayout not compatible with iOS/robovm because of Java8 API dependency #22

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am trying to get my application to run on iOS using robovm but ran into a 
show-stopping problem, i.e. that my build failed complaining that my code 
somewhere (indirectly) referenced something from the java.util.function/stream 
packages which are not supported in the robovm runtime (see javafxports). I 
think I have found the problem in Miglayout, i.e. the following line from 
MigPane.java:

return getManagedChildren().stream().map(node -> new 
FX2ComponentWrapper(node)).toArray(FX2ComponentWrapper[]::new);

Could you replace this code by a JDK6-compatible version, so that Miglayout 
becomes an option on iOS?

Thanks,

Robert

Original issue reported on code.google.com by krue...@lesspain.de on 3 Apr 2015 at 2:46

GoogleCodeExporter commented 8 years ago
I'm pretty sure Mikael will pick this up, but I'm not sure if the 5.x release 
will be made backwards compatible. For now you could use the 4.x version, which 
should work fine.

Original comment by tbeer...@gmail.com on 6 Apr 2015 at 8:59

GoogleCodeExporter commented 8 years ago
Thanks for the feedback. While 4.2 fixes my compilation problem, it does screw 
up my layout in one place. 2011 seems quite old. Probably something has changed 
by then. Looks like MIgpane not being informed of it's container's size 
properly. However, I can basically get my iOS workflow working now, which is 
supercool. Either I'll wait for the fix in 5.0 or I'll try to find a workaround 
if I'm too impatient.

Original comment by krue...@lesspain.de on 6 Apr 2015 at 10:56

GoogleCodeExporter commented 8 years ago
Hello guys,

Sorry for the delay. Since we made the decision to make 5.x JavaFX 8 only Java 
8 is implied in that decision. It wouldn't make sense to go back partly on that 
decision for now. I would expect that the iOS port would make streams work 
pretty soon since there is so muck to gain from both them and lambdas, I don't 
know how I could live without it. :)

Cheers,
Mikael

Original comment by mikael.g...@gmail.com on 6 Apr 2015 at 12:22

GoogleCodeExporter commented 8 years ago
OK, so that's bad news for me at the moment, because I have run into more 
problems with 4.2  in my JFX8 app and I am probably not going to debug this any 
further because all worked fine using 5.0 and the behaviour is sort of erratic. 
However, I can understand the decision. No idea when the javafxports guys will 
make streams work but I can of course patch MigLayout locally if all else 
fails, because it seems I am stuck otherwise, if I do not want to live without 
MigLayout, which I certainly don't :-).

Original comment by krue...@lesspain.de on 6 Apr 2015 at 12:54

GoogleCodeExporter commented 8 years ago
FWIW, I have patched it locally and it works fine. In case someone google's tis 
and has the same need, here's the patch:
diff --git a/javafx/src/main/java/org/tbee/javafx/scene/layout/MigPane.java 
b/javafx/src/main/java/org/tbee/javafx/scene/layout/MigPane.java
index 6319b7a..6f77dd8 100755
--- a/javafx/src/main/java/org/tbee/javafx/scene/layout/MigPane.java
+++ b/javafx/src/main/java/org/tbee/javafx/scene/layout/MigPane.java
@@ -660,8 +660,8 @@ public class MigPane extends javafx.scene.layout.Pane
                // as of JDK 1.6: @Override
                public FX2ComponentWrapper[] getComponents() {
                        // for debugging System.out.println("MigPane.FX2ContainerWrapper.getComponents " + MigPane.this.componentWrapperList.s
-//                     return wrapperToCCMap.keySet().toArray(new 
FX2ComponentWrapper[wrapperToCCMap.size()]); // must be in the order of add
-                       return getManagedChildren().stream().map(node -> new 
FX2ComponentWrapper(node)).toArray(FX2ComponentWrapper[]::new);
+                       return wrapperToCCMap.keySet().toArray(new 
FX2ComponentWrapper[wrapperToCCMap.size()]); // must be in the order of add
+                   //return getManagedChildren().stream().map(node -> new 
FX2ComponentWrapper(node)).toArray(FX2ComponentWrapper[]::new);^M
                }

                // as of JDK 1.6: @Override

Original comment by krue...@lesspain.de on 10 Apr 2015 at 6:39