Thursday, November 20, 2008

Glimmer code officially in Eclipse

Glimmer's code was finally approved and committed to the Eclipse SVN repository:
http://dev.eclipse.org/svnroot/technology/org.eclipse.glimmer.core

I'll be maintaining it at that location from this point on.

Here is the new Eclipse technology project page:
http://www.eclipse.org/glimmer/

And here is the about page:
http://www.eclipse.org/projects/project_summary.php?projectid=technology.glimmer

6 comments:

Unknown said...

fantastic

i have just managed to modify the user profile example to split the widgets across two tabs using TabFolder/TabItem - really starting to get the hang of glimmer :)

gives some nice example code of how to use TabFolder/TabItem:

shell {
    text "User Profile"
    layout GridLayout.new(1, false)
    composite {
            
        tab_folder {
    
            
            @t1 = composite {
                layout GridLayout.new(2, false)
                group {
                    text "Name"
                    layout GridLayout.new(2, false)
                    layout_data GridData.new(fill, fill, true, true)
                    label {text "First"}; text {text "Bullet"}
                    label {text "Last"}; text {text "Tooth"}
                }
                group {
                    layout_data GridData.new(fill, fill, true, true)
                    text "Gender"
                    button(radio) {text "Male"; selection true}
                    button(radio) {text "Female"}
                }
            }
            
            @t2 = composite {
                layout GridLayout.new(2, false)
                group {
                    layout_data GridData.new(fill, fill, true, true)
                    text "Role"
                    button(check) {text "Student"; selection true}
                    button(check) {text "Employee"; selection true}
                }
                group {
                    text "Experience"
                    layout RowLayout.new
                    layout_data GridData.new(fill, fill, true, true)
                    spinner {selection 5}; label {text "years"}
                }
            }
                    
            tab_item {
                text "screen one"
                tool_tip_text "blahblahblahblahblah"
                control @t1.widget
            }
                
            tab_item {
                text "two"
                tool_tip_text "testtesttest"
                control @t2.widget
            }
        }
    }
    
    composite {
        layout GridLayout.new(2, false)
        button {
            text "save"
            layout_data GridData.new(right, center, true, true)
        }
        button {
            text "close"
            layout_data GridData.new(left, center, true, true)
        }
    }

}.open

Andy Maleh said...

Thanks for sharing Tom. We could probably come up with a simpler syntax for authoring tabbed UI with Glimmer. If you have any ideas on how you would like the syntax to be, please let me know. I will probably work on it after I finish data-binding support for List boxes.

Unknown said...

Hi Andy,

I suppose the ideal syntax would be

tab_folder {
    ...
    tab_item {
        ...
        composite or widgets etc

Would certainly be more "glimmerish" than TabItem's setControl syntax anyway!

Another quick thing I was pondering - would it be possible to make glimmer allow "composite {" to be at the top level of a block of glimmer code (at the moment it seems that only "shell {" is allowed?). Then it would be possible to construct large chunks of UI code using glimmer syntax and then include them in the main glimmer block elsewhere in the program. This would be handy because it would stop glimmer code blocks getting too large, allow re-use etc.

I seem to remember in SWT that Shell does not need a parent whereas Composite does, so perhaps some alternative syntax is needed to be able to provide Composite with a parent Shell, if it is being used outside of the main glimmer "shell {" block.

I don't know if this is possible (or perhaps it is already allowed somehow?) or if it goes a little bit against the glimmer philosophy, but I think it could be useful.

Andy Maleh said...

I'll work on implementing the suggested enhanced tab syntax after I finish supporting List box data-binding (unless you'd like to implement it yourself for learning purposes.) It's as easy as implementing a special TabItem CommandHandler class that instantiates a Composite and sets it as the TabItem control automatically.

As for your question about how to have a Composite as the top-level widget, it is currently possible by declaring the composite in a method and calling it during layout of the main user-interface (the one with the shell)

For example, you can do something like this:

def name_and_address_form
  composite { ... }
end

shell {
  name_and_address_form
}

Hope that helps.

Unknown said...

Thanks Andy that's extremely useful. Might have a go at the TabItem code if I get time!

Andy Maleh said...

Just in case you missed this, I implemented easy tab syntax in Glimmer:
http://andymaleh.blogspot.com/2008/12/glimmer-easy-tab-item-syntax.html