#961 Anyone interested in porting MiGLayout to Fantom?

mikaelgrev Fri 5 Feb 2010

I have been communicating with Andy and it seems that MigLayout would be a good fit for FWT as a layout manager with a little more power to it. It would also fit nicely in the mission to provide platform independence as MigLayout was made for this from the start. Andy thought a MigPane would be good if he added an optional meta arg to Widget.add().

There's already a Swing and SWT version, made by me, and a JavaFX version made by Dean Iversson. A Delphi version should be in the works as well but there's no official code there yet. I have heard of others and there's a lot of higher level toolkits leveraging MigLayout (search on Google). A C# would be easy to do using Microsoft auto translate tool (if you can get a hold of that).

It should be noted that 90% of MigLayout is without any GUI toolkit references at all, it is completely pure Java. All the toolkit references are wrapped in three simple thin wrapper classes.

I don't have the Fantom knowledge to do the port in a good way.

So, anyone up for the task? I would of course help out with the MigLayout specific stuff. As a note Dean Iversson did the port to JavaFX quite quickly and without virtually no help. The code should be well documented and the non/GUI specific 90% should be a very straight conversion. If you really want to understand the algorithms you can do that as well but it would be harder of course.

If you want to get to know MigLayout and what it can do please visit miglayout.com. For comments about it check this Java RFE (note that it is 3:rd most wanted RFE for Java): http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6530906

Cheers, Mikael Grev

andy Fri 5 Feb 2010

Andy thought a MigPane would be good if he added an optional meta arg to Widget.add()

Thats really what you want I think - but that doesn't really work out well in practice, since you can't use the serialization style syntax to construct your Widget tree. And I think anything that is a candidate to be included in FWT, needs to have that requirement. So need to brainstorm a bit here.

mikaelgrev Fri 5 Feb 2010

SWT has Widget.setLayoutData(migconstraints);

Maybe that would work better in Fantom, possibly with a more Fantom name?

andy Fri 5 Feb 2010

So something like this?

MigPane
{
  Widget { },
  Widget { constraint="wrap" },
  Widget { constraint="span, grow" },
}

Something like that seems generally useful.

brian Fri 5 Feb 2010

I was planning to call that field "layout":

Obj? layout := null

mikaelgrev Fri 5 Feb 2010

Yeah, that seems more Fantom-ish afaiu.

Btw, is there any way to get forum reply notifications in the email (updates to ones own posts or replies to forum threads one have participated)?

andy Fri 5 Feb 2010

Btw, is there any way to get forum reply notifications in the email (updates to ones own posts or replies to forum threads one have participated

No, its all or nothing (or digest). You can manage your email settings by clicking your username at the top of the page.

DanielFath Thu 23 Sep 2010

Sorry to bump this but I must ask is layout planned to be added to Fantom?

andy Fri 24 Sep 2010

I actually did run across a use case where Widget.layout would have been nice to have. Thats a prerequisite for MigLayout anyways, so maybe we should go ahead and add that?

tcolar Fri 24 Sep 2010

I considered doing it at some point but haven't had the time.

Mikael made a nice little "porting" doc at the time:

http://miglayout.com/Porting.pdf

SlimerDude Sat 4 May 2013

Looks like Daniel Fath beat everyone to it...

https://bitbucket.org/DanielFath/migpane/overview

DanielFath Thu 16 May 2013

Sorry about lack of response. I did made it but it was long time ago and there were some issues with it. Its length was getting weird for some reason and it lacked the debug/timing components to be a fully rounded thing. Otherwise I would have post it already.

Jens Thu 16 May 2013

In a language that, unlike Java, has concise syntax for list and object literals, isn't it better to use list of objects instead of strings? In that way you get the benefits of typechecking and IDE support. The literal syntax in Fantom is one of my favorite features, it opens up great possibilities for declarative API:s.

So instead of this:

MigPane
{
  Widget { },
  Widget { constraint = "wrap" },
  Widget { constraint = "span, grow" },
}

You would write something like this:

MigPane
{
  Widget { },
  Widget { constraint = [Wrap()] },
  Widget { constraint = [Span(), Grow{dir = Dir.up })] },
}

Or maybe like this:

MigPane
{
  Widget { },
  Widget { constraint = Constr{ wrap = true }},
  Widget { constraint = Constr{ span = true, grow = Dir.up }},
}

A while ago I made a presentation focused on declarative design in Fantom. It can be found from here: http://fantom.org/sidewalk/topic/1673

DanielFath Fri 17 May 2013

I went down the easier and agreed route; that concise strings were better.

Login or Signup to reply.