gdx-libs / gdx-lml-vis

:no_entry_sign: Moved to gdx-lml.
Apache License 2.0
5 stars 1 forks source link

Add support for other VisUI features #3

Closed kotcrab closed 8 years ago

kotcrab commented 8 years ago

I will list all features unique for VisUI so we can discuss what will be added to lml-vis.

czyzby commented 8 years ago

CollapsibleWidget

If you add support for initial null actor (Table) and add an actor setter in VisUI, we can create a similar tag to container: it basically begins empty and allows to eventually add one actor. Then it could be used like this: <collapsible><table>(...actors...)</table></collapsible>. Or we could extend TableLmlTag, create the table in the tag class and return it as the main widget (allowing children to access table tags), but it would need some extra "hacks" during attaching - we'd need to replace the original actor with our collapsible. I think the first solution would require less work overall.

NumberSelector

Extend VisTableLmlTag, return FloatRangeLmlActorBuilder for initial value, min, max and step size support, cast the builder to create a new instance. Add precision attribute. Pretty straightforward, you can try to do this.

LinkLabel

Extend VisLabelLmlTag, initiate LinkLabel with text from TextLmlActorBuilder and an empty URL. Add an attribute (link, url, uri, ?) that uses setUrl(CharSequence). No need for a new builder. Easy one.

VisValidableTextField

The actor itself is trivial to add (extend VisTextFieldLmlTag, no additional attributes), but I'd need to add validators as tags or macros.

FormValidator

It can be an attachable tag, kind of like tooltips were implemented. I'll need to look into this.

Separator

Simple non-parental actor, extend AbstractNonParentalActorLmlTag. Use AlignedLmlActorBuilder for initial vertical/horizontal status. However, separators do not use the usual style name schema (default-horizontal/default-vertical), so we might need to do some magic before using a custom style (extending AlignedLmlActorBuilder, returning different style names?).

ColumnGroup

Up to you. If you think it adds additional functionalities that are worth the extra effort, we can support these.

GridGroup

Should be based on one of existing group tags (Table, VerticalGroup, Stack, etc.). Appends children to itself. Might need a custom LmlActorBuilder extension to support constructor params.

TabbedPane, PopupMenu and MenuBar

These look complex, I'll need to take a better look at these. I'll probably end up implementing them.

Tooltips

Well, I'm not a huge fan of "native" LibGDX tooltips. I actually implemented my own LML tooltips as well (before they were introduced in LibGDX), but they were removed in LML 0. I think we can support Vis tooltips with visTooltip tag, especially if their behaviour varies from the original ones. But let's leave them for now.

Dialogs

We can add default actions to the parser. Instead of new attributes, you could use old ones to display these - onClick=showFileChooser. Default parser's I18NBundle would be used to support dialog's i18n. This should be pretty trivial, let's focus on other widgets first.

OK, to sum up: I think you can look into NumberSelector, LinkLabel, Separator, ColumnGroup and GridGroup, if you want to. These should be pretty straightforward to implement.

kotcrab commented 8 years ago

ColumnGroup VerticalGroup has more features. To be honest I don't remember why it exists. It's either that I didn't know scene2d has it already implemented and made my own or I had problems with VerticalGroup.

Alright, I'll update CollapsibleWidget and look into the 'easy' ones.

kotcrab commented 8 years ago

CollapsibleWidget now supports creation with null table.

czyzby commented 8 years ago

I don't think we're going to support all FormValidator methods (files management) for now, because of lack of GWT support. Though, if they don't cause any problems (when present and unused), adding them would be pretty straightforward - see current validator tags.

czyzby commented 8 years ago

I think that constructing simple error or input dialogs is easy enough in LML - actually, if you need to display these very often, you can easily create powerful and more flexible macros, invocable with a single tag. DialogUtils might still be useful when managing UI in Java, but there's pretty much no point in adding separate tags/attributes for these.

kotcrab commented 8 years ago

FormValidator class is completely excluded from GWT. Trying to use it anywhere would cause missing class error during gwt compile.

czyzby commented 8 years ago

I see. I guess we can add yet another syntax (extending VisLmlSyntax) with some additional validators for files (that's what it comes down to: SimpleFormValidator should be handle these just fine), but I don't think that's necessary for now. Let's focus on core widgets and their examples.

czyzby commented 8 years ago

Since file chooser is excluded on GWT, we might have to add a separate non-GWT utility that registers extra attributes (file chooser) and tags (file validators). Standard syntax will not support file chooser.

See https://github.com/czyzby/gdx-lml-vis/issues/6

czyzby commented 8 years ago

All relevant GWT-compatible features are supported; example templates are present in the tests project. Closing the issue.