Re: Tchat with you about DLTK Freemarker plugin ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Monday, June 14, 2010, 10:02:28 AM, Angelo zerr wrote:

> Hi Daniel,
>
> I don't know if you have testes DLTK Freemarker plugin,

Yes, I tried it. (But I would not call it testing.) Unfortunately, it
was quite unstable on my config (20100218-1602, EE, was updated for
several times), but I don't know what is behind that. Maybe on a fresh
Eclipse it will be all right, maybe some of the plugins I have
interferes... who knows. As soon I open an FTL it slows down and then
soon crashes with "java.lang.OutOfMemoryError: PermGen space".

> but today I can debug Freemarker template but without model. I have
> a lot idea about that but I would like know your opinion. I'm
> developping IHM

Um... what's "IHM"?

> to manage that and I will send you (to Freemarker forum) a
> screenshot.
>
> Is it possible to chat with you to discuss about that?

I would prefer if the discussion goes on the developer list, where I
CC-ed this answer too (I hope it's OK). I'm no more "entitled" to
discuss these matters than Attila or Jonathan. Also I'm certainly not
the most competent among the readers (I'm quite much fell out of the
Java world in the recent years... not to mention I never hacked
Eclipse). Also then the discussion will have a record (the mailing
list archive), which can be useful.

> My idea is to have an Overview tab page which is composed with several section like :
>
> * Configuration to configure FM syntax (square bracket....)
> * Macro section to see wich maco is used into your templae
> * Include section, Import section to add <#import directive.
> * Model section to define your Model with Java class (Java class
> will return a Map with the model). This Model could be used with
> Preview, Run As, Debug as and autocompletion.

As a side note, maybe it would be better to finish the less advanced
features first, stabilize what you have so far. Like, error locations
are not working.

> I have an another idea to provide an Eclipse View "Freemarker
> Preview". This View will works like "Javadoc view" When you will
> type your template, the Freemarker Preview ill be refresh with the
> result of the Template#process and you can see the result of the
> merge when you type your template.

I think the most important thing is to ensure that debugging (which
includes *probing*, and where possible/feasible, even data-model
tree-view) works inside the actual application (I mean the development
installation of course). Then, the plug-in doesn't have to deal with
building a (mock-) data-model. Also it doesn't have to deal with
configuring FreeMarker. And most importantly, the developer doesn't
have to configure all these (mock data-mode, mock FM config).

Running templates individually and outside the application is nice for
learning FreeMarker, but I suspect that in real-world works this
approach often doesn't work well, because templates can't do much
alone. But let's take the cases where we still want this feature.
Certainly there are several templates to work with, and running them
with "Run as..." / "FreeMarker" will create a separate "Run
Configuration"-s for each template, which, I think, is annoying. So
for the previews, your idea of using something like the Javadoc view
makes sense (as far as I can tell... again, I'm not an Eclipse guru at
all). In that case using "Run Configuration"-level setup is out of
question, so the FreeMarker Configuration should be specified on the
project level, under the "Project Properties" (where you have the tree
in the GUI). But then there is the data-model, which is per-template,
like a "Run Configuration" would be. Other than for a Javadoc-like
view we don't have "Run Configuration" associated anyway (right?),
they wouldn't be good because they are easy to lose (they aren't part
of the project for example, if I remember right), and a mock
data-model is not something you want to accidentally lose. It can be
quite work to make one, and it can be a kind of
documentation/specification of what the template should expect. So I
think that at the same place where you specify the FreeMarker
configuration (Project Properties), it also should be possible to
specify a package inside the project where the classes that create
mock-up data-models are stored (just like you suggested, if I
understand it well). Each data-model should have a separate source
file, that is stored in the project directory, outside the
eclipse-specific directories. What should those files be? I think as
far as the source code is concerned, they are whatever that compiles
to classes: .java, .scala, .groovy, etc. So for the eclipse plugin
they are just classes in a package specified on the same place where
the FreeMarker configuration is specified. Like, you could say there
that data-models are in com.example.myapp.mockdatamodels, then the
data-model for foo/bar.ftl is `new
com.example.myapp.mockdatamodels.foo.Bar().calculate()`, or something
like that. calculate() must have Object return value, not Map, since
the data-model root need not be a Map in FreeMarker.

> I will be happy if we can tchat together (IRC? GTalk?).
>
> Thank's for your help.
>
> Regards Angelo

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

revusky
On Tue, Jun 15, 2010 at 12:07 AM, Daniel Dekany <[hidden email]> wrote:

> Monday, June 14, 2010, 10:02:28 AM, Angelo zerr wrote:
>
>> Hi Daniel,
>>
>> I don't know if you have testes DLTK Freemarker plugin,
>
> Yes, I tried it. (But I would not call it testing.) Unfortunately, it
> was quite unstable on my config (20100218-1602, EE, was updated for
> several times), but I don't know what is behind that. Maybe on a fresh
> Eclipse it will be all right, maybe some of the plugins I have
> interferes... who knows. As soon I open an FTL it slows down and then
> soon crashes with "java.lang.OutOfMemoryError: PermGen space".
>
>> but today I can debug Freemarker template but without model. I have
>> a lot idea about that but I would like know your opinion. I'm
>> developping IHM
>
> Um... what's "IHM"?

That's the French acronym for GUI.


>
>> to manage that and I will send you (to Freemarker forum) a
>> screenshot.
>>
>> Is it possible to chat with you to discuss about that?
>
> I would prefer if the discussion goes on the developer list, where I
> CC-ed this answer too (I hope it's OK). I'm no more "entitled" to
> discuss these matters than Attila or Jonathan. Also I'm certainly not
> the most competent among the readers (I'm quite much fell out of the
> Java world in the recent years... not to mention I never hacked
> Eclipse). Also then the discussion will have a record (the mailing
> list archive), which can be useful.
>
>> My idea is to have an Overview tab page which is composed with several section like :
>>
>> * Configuration to configure FM syntax (square bracket....)
>> * Macro section to see wich maco is used into your templae
>> * Include section, Import section to add <#import directive.
>> * Model section to define your Model with Java class (Java class
>> will return a Map with the model). This Model could be used with
>> Preview, Run As, Debug as and autocompletion.
>
> As a side note, maybe it would be better to finish the less advanced
> features first, stabilize what you have so far. Like, error locations
> are not working.
>
>> I have an another idea to provide an Eclipse View "Freemarker
>> Preview". This View will works like "Javadoc view" When you will
>> type your template, the Freemarker Preview ill be refresh with the
>> result of the Template#process and you can see the result of the
>> merge when you type your template.
>
> I think the most important thing is to ensure that debugging (which
> includes *probing*, and where possible/feasible, even data-model
> tree-view) works inside the actual application (I mean the development
> installation of course). Then, the plug-in doesn't have to deal with
> building a (mock-) data-model. Also it doesn't have to deal with
> configuring FreeMarker. And most importantly, the developer doesn't
> have to configure all these (mock data-mode, mock FM config).

Attaching to a running server app would be important, but I think also
just being able to debug a template with a mock data model could be
quite valuable as well. It is likely that in complex uses of
FreeMarker, where you would bring in the power of a debugger is to try
to figure out why some macros in a macro library don't work as you
think they should. So, you might well want to throw together a simple
template with a mock data model that uses some of the macros that you
are debugging.

But you are also right that there could be more initial value in
getting less ambitious features working before the full debugger, like
the error locations and such.

JR

>
> Running templates individually and outside the application is nice for
> learning FreeMarker, but I suspect that in real-world works this
> approach often doesn't work well, because templates can't do much
> alone.
> But let's take the cases where we still want this feature.
> Certainly there are several templates to work with, and running them
> with "Run as..." / "FreeMarker" will create a separate "Run
> Configuration"-s for each template, which, I think, is annoying. So
> for the previews, your idea of using something like the Javadoc view
> makes sense (as far as I can tell... again, I'm not an Eclipse guru at
> all). In that case using "Run Configuration"-level setup is out of
> question, so the FreeMarker Configuration should be specified on the
> project level, under the "Project Properties" (where you have the tree
> in the GUI). But then there is the data-model, which is per-template,
> like a "Run Configuration" would be. Other than for a Javadoc-like
> view we don't have "Run Configuration" associated anyway (right?),
> they wouldn't be good because they are easy to lose (they aren't part
> of the project for example, if I remember right), and a mock
> data-model is not something you want to accidentally lose. It can be
> quite work to make one, and it can be a kind of
> documentation/specification of what the template should expect. So I
> think that at the same place where you specify the FreeMarker
> configuration (Project Properties), it also should be possible to
> specify a package inside the project where the classes that create
> mock-up data-models are stored (just like you suggested, if I
> understand it well). Each data-model should have a separate source
> file, that is stored in the project directory, outside the
> eclipse-specific directories. What should those files be? I think as
> far as the source code is concerned, they are whatever that compiles
> to classes: .java, .scala, .groovy, etc. So for the eclipse plugin
> they are just classes in a package specified on the same place where
> the FreeMarker configuration is specified. Like, you could say there
> that data-models are in com.example.myapp.mockdatamodels, then the
> data-model for foo/bar.ftl is `new
> com.example.myapp.mockdatamodels.foo.Bar().calculate()`, or something
> like that. calculate() must have Object return value, not Map, since
> the data-model root need not be a Map in FreeMarker.
>
>> I will be happy if we can tchat together (IRC? GTalk?).
>>
>> Thank's for your help.
>>
>> Regards Angelo
>
> --
> Best regards,
>  Daniel Dekany
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
In reply to this post by Daniel Dekany
Hi Daniel, Jonathan,

Thank a lot for your answer.
 
> Hi Daniel,
>
> I don't know if you have testes DLTK Freemarker plugin,

Yes, I tried it. (But I would not call it testing.) Unfortunately, it
was quite unstable on my config (20100218-1602, EE, was updated for
several times), but I don't know what is behind that. Maybe on a fresh
Eclipse it will be all right, maybe some of the plugins I have
interferes... who knows. As soon I open an FTL it slows down and then
soon crashes with "java.lang.OutOfMemoryError: PermGen space". (Find a
sample log attached, *if* it's anything worth fighting with.)

I have seen your log. As you said, please try with a clean Eclipse. I have sometimes "java.lang.OutOfMemoryError: PermGen space" error when I debug plugin, even with another plugin (like Java Editor).
 

> but today I can debug Freemarker template but without model. I have
> a lot idea about that but I would like know your opinion. I'm
> developping IHM

Um... what's "IHM"?

Oooops sorry for my mistake. As Jonathan said, "That's the French acronym for GUI. "

> to manage that and I will send you (to Freemarker forum) a
> screenshot.
>
> Is it possible to chat with you to discuss about that?

I would prefer if the discussion goes on the developer list, where I
CC-ed this answer too (I hope it's OK).

No problem with that. I would like just tchat with you because sometimes I have the luck to tchat with jonathan and it help me a lot. I would like tchat with Attila too (for the debugger), but I know he is very busy.
 
I'm no more "entitled" to
discuss these matters than Attila or Jonathan. Also I'm certainly not
the most competent among the readers (I'm quite much fell out of the
Java world in the recent years... not to mention I never hacked
Eclipse). Also then the discussion will have a record (the mailing
list archive), which can be useful.

Ok.

> My idea is to have an Overview tab page which is composed with several section like :
>
> * Configuration to configure FM syntax (square bracket....)
> * Macro section to see wich maco is used into your templae
> * Include section, Import section to add <#import directive.
> * Model section to define your Model with Java class (Java class
> will return a Map with the model). This Model could be used with
> Preview, Run As, Debug as and autocompletion.

As a side note, maybe it would be better to finish the less advanced
features first, stabilize what you have so far. Like, error locations
are not working.

Here my explanation, why I don't develop less advanced
features first, :

1. My idea is to develop new features (like debug, preview..) that it doesn't exists (compare to JBoss plugin) to try to arouse.
I hope that some people will be interest to help me if they are interested with debug, preview features.
2. Error locations belong to Freemarker API and I'm waiting Jonathan help to manage that. If Jonathan  have no time to help me, I will try to fix the problems but I prefer for the moment develop Eclipse code than Freemarker code. I tell me that Freemarker code, you can help me.
3. I want to learn DLTK (sorry it's personnal explanation).


I think the most important thing is to ensure that debugging (which
includes *probing*, and where possible/feasible, even data-model
tree-view) works inside the actual application (I mean the development
installation of course).

You mean Remote Debugging. I have intention to do that, but before developping that I must finsih the debugger lile :
* develop Model populate (to use it into completion, preview, debug, run as...) 
* develop Variable View (to see the variables into Debug Variable View, values used into FTL, change value)

Running templates individually and outside the application is nice for
learning FreeMarker, but I suspect that in real-world works this
approach often doesn't work well, because templates can't do much
alone. But let's take the cases where we still want this feature.

1. I don't know if it's a good thing, but in my case, when I develop Java code, I'm using every time debugger. I code and debug together. For instance when I'm using
String#substring Java methid, I add a breakpoint to the line wich use this method and I try value.substring(0, index), no it's not good,  I retry it with value.substring(0, index + 1), I evaluate this code and if it's OK, I do Ctrl+S and code is re-executed. As I said Jonathan, I think it's a good thing to debug (local) FTL to check problem with macro call (or <#import).

2. Imagine you have a big projects with a lot of FTL and you start this project. I think debugger it's a cool feature to understand the FTL design (macro, import...) of the project.

3. I would like give the hyperlink capability. When you will set your mouse on a variable (ex : ${name}), a popup will appear and  display the value of this variable.


Certainly there are several templates to work with, and running them
with "Run as..." / "FreeMarker" will create a separate "Run
Configuration"-s for each template, which, I think, is annoying. So
for the previews, your idea of using something like the Javadoc view
makes sense (as far as I can tell... again, I'm not an Eclipse guru at
all).

"Freemarker Preview" View is done (you can see it into the ODT docs if you wish). When you typ eyour template, this View is refreshed with the result of Template#process. I think this View can help a lot to create new FTL.
 
In that case using "Run Configuration"-level setup is out of
question, so the FreeMarker Configuration should be specified on the
project level, under the "Project Properties" (where you have the tree
in the GUI).
 
Right! Into the Overview page, I think display this config too.
 
But then there is the data-model, which is per-template,
like a "Run Configuration" would be. Other than for a Javadoc-like
view we don't have "Run Configuration" associated anyway (right?),
they wouldn't be good because they are easy to lose (they aren't part
of the project for example, if I remember right), and a mock
data-model is not something you want to accidentally lose. It can be
quite work to make one, and it can be a kind of
documentation/specification of what the template should expect. So I
think that at the same place where you specify the FreeMarker
configuration (Project Properties), it also should be possible to
specify a package inside the project where the classes that create
mock-up data-models are stored (just like you suggested, if I
understand it well).

My idea is to have Overview Page with Model section. You will enable add a Java class wich returns Model. Please let me develop this feature and show you my idea. We could discuss together if my idea doens'( please you.
 
Each data-model should have a separate source
file, that is stored in the project directory, outside the
eclipse-specific directories. What should those files be? I think as
far as the source code is concerned, they are whatever that compiles
to classes: .java, .scala, .groovy, etc. So for the eclipse plugin
they are just classes in a package specified on the same place where
the FreeMarker configuration is specified. Like, you could say there
that data-models are in com.example.myapp.mockdatamodels, then the
data-model for foo/bar.ftl is `new
com.example.myapp.mockdatamodels.foo.Bar().calculate()`, or something
like that. calculate() must have Object return value, not Map, since
the data-model root need not be a Map in FreeMarker.

As I said you, my idea is to choose your class that you wish use for the template model populate.

> I will be happy if we can tchat together (IRC? GTalk?).
>
> Thank's for your help.
>
> Regards Angelo

--
Best regards,
 Daniel Dekany
Angelo

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Tuesday, June 15, 2010, 9:32:52 AM, Angelo zerr wrote:

[snip]
>> In that case using "Run Configuration"-level setup is out of
>> question, so the FreeMarker Configuration should be specified on the
>> project level, under the "Project Properties" (where you have the tree
>> in the GUI).
>  
> Right! Into the Overview page, I think display this config too.

What's the "Overview page" you are referring to? What I referred to is
what you see in "Project" / "Properties" window. There you could have
a "FreeMarker" node in that tree, in which you can set up the mock
freemarker.template.Configuration object. There could be a simple GUI
where you have fields corresponding to FreeMarker settings (like
"number_format", "locale", etc.), and then you can use the
Configuration.setSetting(String, String) API. However, experience
shows that this is often too limited, and people often need to set up
the Configuration in a real programming language. So maybe there
should be a field where you can specify a user-defined class that is a
Configuration factory, and then apply the said
Configuration.setSetting-s on the Configuration object that comes out
of that factory, where the corresponding field wasn't left empty on
the GUI.

[snip]
> My idea is to have Overview Page with Model section.

You mean there FTL editor will have an overview tab?

> You will enable add a Java class wich returns Model. Please let me
> develop this feature and show you my idea. We could discuss together
> if my idea doens'( please you.

Of course you do it as you wish. My point was that this association
between the template and the mock data-model plus the mock data-model
itself should be accessible even outside Eclipse, and should be stored
inside the project "src" directory. This is already partially
fulfilled since the mock-data model will be just a class. But what
about storing the association itself? Maybe a custom attribute should
be used in the #ftl directive, or maybe a special comment. Or,
maybe we should add a core template-level setting like
<#ftl mock_data_model="com.example.YourMockDataModelFactory">?

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,


What's the "Overview page" you are referring to?

I send you two screen to explain my idea. I have not commited because it's not finished. In the screen model_provider1.png you can see the basic FTL template

----------
Project name : ${project.name}
----------

and the Data Model Class provider :

----------
package com.mycompany.myapp.fm;

import java.util.HashMap;
import java.util.Map;

import com.mycompany.myapp.model.Project;

public class MyModelProvider {

    public static Object getModel() {
        Map<String, Object> models = new HashMap<String, Object>();
        Project project = new Project("My project");
        models.put("project", project);
        return models;
    }
}
----------

The idea is to link the template with the Data Model Provider to use model into autocompletion, run, debug, preview...
To do that you use the Overview Page of the Freemarker editor (see screen model_provider2.png).

 
What I referred to is
what you see in "Project" / "Properties" window. There you could have
a "FreeMarker" node in that tree,

It's already done:)
 
in which you can set up the mock
freemarker.template.Configuration object.

Great idea and we could (as you suggest) define too the MyModelProvider Class.

There could be a simple GUI
where you have fields corresponding to FreeMarker settings (like
"number_format", "locale", etc.), and then you can use the
Configuration.setSetting(String, String) API. However, experience
shows that this is often too limited, and people often need to set up
the Configuration in a real programming language. So maybe there
should be a field where you can specify a user-defined class that is a
Configuration factory, and then apply the said
Configuration.setSetting-s on the Configuration object that comes out
of that factory, where the corresponding field wasn't left empty on
the GUI.

It's the same idea like MyModelProvider Class. Ok I will done that. So the idea is :

* configure Configuration+Model provider into Project/Properties (global of the project)
* the overview page display Configuration+Model provider from Project/Properties and it will pe possible to extend it.

Do you like this idea?
 

[snip]
> My idea is to have Overview Page with Model section.

You mean there FTL editor will have an overview tab?

Yes, see my screen.

> You will enable add a Java class wich returns Model. Please let me
> develop this feature and show you my idea. We could discuss together
> if my idea doens'( please you.

Of course you do it as you wish. My point was that this association
between the template and the mock data-model plus the mock data-model
itself should be accessible even outside Eclipse, and should be stored
inside the project "src" directory. This is already partially
fulfilled since the mock-data model will be just a class. But what
about storing the association itself?

The association will done into a Eclipse file (settings of the project) that you will enable to share with another people of project  team.
 
Maybe a custom attribute should
be used in the #ftl directive, or maybe a special comment. Or,
maybe we should add a core template-level setting like
<#ftl mock_data_model="com.example.YourMockDataModelFactory">?

I have seen your idea (it's with velocity) into Jetbreains plugin. See at http://blogs.jetbrains.com/idea/2009/08/enabling-implicit-context-variables-resolution-in-template-files/
There are interesting comments which give problems with this idea :

* template are polluate.
* if you use existing FTL template (like struts2) it will not works.

So I prefer store this association into a eclipse file settings.

Regards Angelo

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

model_provider1.png (49K) Download Attachment
model_provider2.png (51K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Wednesday, June 16, 2010, 9:46:44 AM, Angelo zerr wrote:

[snip]
> * configure Configuration+Model provider into Project/Properties (global of the project)
> * the overview page display Configuration+Model provider from
> Project/Properties and it will pe possible to extend it.
>
> Do you like this idea?

Partially. There are my concerns:

- Regarding the data-model:

  How do you intend to extend a data-model? Maybe with a custom
  TemplateHashModel implementation that merges the two data-models?
  That might be changes the behavior of the original data-model. Or
  you do it only if the template level data-model has some kind of
  method to add items, so you can add the items of the project-level
  data-model? Anyway, the question boils down to what people do to
  achieve similar effect in the actual applications, because that's
  what we want to mimic in the editor. One popular approach is using
  FreeMarker shared variables, which is a Configuration-level feature
  (kind of a FreeMarker setting), and so it doesn't belong here.
  Another one is just adding the common variables to the root map each
  time a new data-model is built for a template. But for that you
  don't really merge two data-models, it's just that when you create
  the data-model for a template, you call something like
  myFramework.addCommondVars(root), and that is doable without having
  the project-level data-model, in the data-model factory class. Yet
  another one is using a special wrapper that combines two root
  objects. However for that you most certainly do the wrapping
  manually, which again means it should happen in the data-model
  factory class of the template. So, I'm not sure how useful it is to
  push this "common data-model variables" problem to the Eclipse
  plug-in, because this usually should be and can be solved on the
  template-specific data-model factory class. One should use
  sub-classing to add the common variables or do the special wrapping
  outside the source code of the template-specific data-model factory.

- Regarding the Configuration:

  What certainly would be more useful if there can be multiple
  Configurations on the Project level (one of them is the default),
  and you can *chose* among them on template level. After all, you
  seldom want to have a different Configuration for each template,
  it's rather that a group of templates use Configuration A, and
  another group of templates use Configuration B.

[snip]
> I have seen your idea (it's with velocity) into Jetbreains plugin.
> See at
> http://blogs.jetbrains.com/idea/2009/08/enabling-implicit-context-variables-resolution-in-template-files/
> There are interesting comments which give problems with this idea :
>
> * template are polluate.

It depends... If data-model factories are not easy to read and hence
doesn't serve as a documentation for the template, then it's
pollution. But I think sometimes mock data-models could be part of the
documentation, a bit like javadoc in Java (or like doctest in Python).

> * if you use existing FTL template (like struts2) it will not works.

That's true. Not like there can't be multiple mechanisms for
associating mock data-models, but then, at least for now, implement
the one that doesn't touches the template files.

> So I prefer store this association into a eclipse file settings.

OK.

> Regards Angelo
>
> --
>
> Best regards,
>  Daniel Dekany

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Thank a lot for your answer.

2010/6/16 Daniel Dekany <[hidden email]>
Wednesday, June 16, 2010, 9:46:44 AM, Angelo zerr wrote:

[snip]
> * configure Configuration+Model provider into Project/Properties (global of the project)
> * the overview page display Configuration+Model provider from
> Project/Properties and it will pe possible to extend it.
>
> Do you like this idea?

Partially. There are my concerns:

- Regarding the data-model:

 How do you intend to extend a data-model? Maybe with a custom
 TemplateHashModel implementation that merges the two data-models?

Sorry I don't understand what you mean. FTL template wait a model (Template#process(Object rootMap,....)
The example with MyModelProvider Class return this rootMap.

For the global variable you can use Configuration as you have told me. We could too have "Configuration section" into the Overview page (liek Model section) and select a Class wich returns an instance of Configuration.

But I have  perhaps not understand the problems that you told me?
 
 That might be changes the behavior of the original data-model. Or
 you do it only if the template level data-model has some kind of
 method to add items, so you can add the items of the project-level
 data-model? Anyway, the question boils down to what people do to
 achieve similar effect in the actual applications, because that's
 what we want to mimic in the editor. One popular approach is using
 FreeMarker shared variables, which is a Configuration-level feature
 (kind of a FreeMarker setting), and so it doesn't belong here.
 Another one is just adding the common variables to the root map each
 time a new data-model is built for a template. But for that you
 don't really merge two data-models, it's just that when you create
 the data-model for a template, you call something like
 myFramework.addCommondVars(root), and that is doable without having
 the project-level data-model, in the data-model factory class. Yet
 another one is using a special wrapper that combines two root
 objects. However for that you most certainly do the wrapping
 manually, which again means it should happen in the data-model
 factory class of the template. So, I'm not sure how useful it is to
 push this "common data-model variables" problem to the Eclipse
 plug-in, because this usually should be and can be solved on the
 template-specific data-model factory class. One should use
 sub-classing to add the common variables or do the special wrapping
 outside the source code of the template-specific data-model factory.

- Regarding the Configuration:

 What certainly would be more useful if there can be multiple
 Configurations on the Project level (one of them is the default),
 and you can *chose* among them on template level. After all, you
 seldom want to have a different Configuration for each template,
 it's rather that a group of templates use Configuration A, and
 another group of templates use Configuration B.

Ok, I understand your idea. I will try to do something and send you screen to check if we are OK.
 

[snip]
> I have seen your idea (it's with velocity) into Jetbreains plugin.
> See at
> http://blogs.jetbrains.com/idea/2009/08/enabling-implicit-context-variables-resolution-in-template-files/
> There are interesting comments which give problems with this idea :
>
> * template are polluate.

It depends... If data-model factories are not easy to read and hence
doesn't serve as a documentation for the template, then it's
pollution. But I think sometimes mock data-models could be part of the
documentation, a bit like javadoc in Java (or like doctest in Python).

Ok. For the moment I will store the association into eclipse settings. After we could add this new feature (update the FMParser to manage that).

> * if you use existing FTL template (like struts2) it will not works.

That's true. Not like there can't be multiple mechanisms for
associating mock data-models, but then, at least for now, implement
the one that doesn't touches the template files.

> So I prefer store this association into a eclipse file settings.

OK.

> Regards Angelo
>
> --
>
> Best regards,
>  Daniel Dekany

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Wednesday, June 16, 2010, 11:34:45 AM, Angelo zerr wrote:

> Thank a lot for your answer.
>
> 2010/6/16 Daniel Dekany <[hidden email]>
> Wednesday, June 16, 2010, 9:46:44 AM, Angelo zerr wrote:
>
> [snip]
>>> * configure Configuration+Model provider into Project/Properties (global of the project)
>>> * the overview page display Configuration+Model provider from
>>> Project/Properties and it will pe possible to extend it.
[snip]
> Sorry I don't understand what you mean. FTL template wait a model
> (Template#process(Object rootMap,....)
> The example with MyModelProvider Class return this rootMap.
>
> For the global variable you can use Configuration as you have told
> me. We could too have "Configuration section" into the Overview page
> (liek Model section) and select a Class wich returns an instance of
> Configuration.

You said you *extend* the data-model. I assumed that means some kind
of fine-gradient merging of a project-level data-model with a
template-level data-model. But then it was a misunderstanding, so
never mind.

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Sorry for my bad explanation. When I said "extend'" I mean that you can define a model into Project/Properties. When you go to the OverviewPage, the class mode lprovider is filled with the value class of the Project/Properties. But you will can change it if you wish to have specific model for the template.

Ok, let me a litlle tiem and as soon as I will finish my work, I will contact you. We could discuss together if you like it.

Angelo

2010/6/16 Daniel Dekany <[hidden email]>
Wednesday, June 16, 2010, 11:34:45 AM, Angelo zerr wrote:

> Thank a lot for your answer.
>
> 2010/6/16 Daniel Dekany <[hidden email]>
> Wednesday, June 16, 2010, 9:46:44 AM, Angelo zerr wrote:
>
> [snip]
>>> * configure Configuration+Model provider into Project/Properties (global of the project)
>>> * the overview page display Configuration+Model provider from
>>> Project/Properties and it will pe possible to extend it.
[snip]
> Sorry I don't understand what you mean. FTL template wait a model
> (Template#process(Object rootMap,....)
> The example with MyModelProvider Class return this rootMap.
>
> For the global variable you can use Configuration as you have told
> me. We could too have "Configuration section" into the Overview page
> (liek Model section) and select a Class wich returns an instance of
> Configuration.

You said you *extend* the data-model. I assumed that means some kind
of fine-gradient merging of a project-level data-model with a
template-level data-model. But then it was a misunderstanding, so
never mind.

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,

I have commited my work with Data Model that you define into Overview page of the Freemarker editor. Please see the attached screenshot or read "Freemarker & Data Model"  section (page  24) into the https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/docs/DLTK-Freemarker%20-%20Eclipse%20Plugin.odt

So now you can define your model with Java code and you can use it  into Preview mode (with Freemarker Preview View)).

With this 2 features (Data Model + Preview), you can write your FTL template and see the result of model+template merge into the Preview View as soon as user type some content into the template editor (it's done into another Thread like Javadoc View).

I have started to do the same thing to customize Configuration (see Freemarker Configuration section of the Overview page).

I think it should be cool if the Overview page display the Freemarker Confiuration customized with Java code. I think we could do the sam ething for the model. We could see :

* the model defined into Java code
* the model used into template

And we could show delta between "model defined into Java code" and "model used into template" and
* model used into template but not defined into Java code.
* model defined into Java code but not used into template.

Hope it will please you.

Don't hesitate to tell me what you like, what you don't like. Any suggestions are welcome!

Thank a lot.

Regards Angelo

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

DataModel.png (67K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Friday, June 18, 2010, 11:27:52 PM, Angelo zerr wrote:

> Hi Daniel,
>
> I have commited my work with Data Model that you define into
> Overview page of the Freemarker editor. Please see the attached
> screenshot

I suppose later there will be yet another field for choosing a
FreeMarker Configuration that was defined on the project-level
(instead of choosing a Configuration class + method that is specific
to the template).

Some typos (I quote the correct forms here):
In the titles:
"Data-Model" (no spaces around the "-"),
"FreeMarker Configuration"
In the body: "provides", "data-model", "class and method"

> or read "Freemarker & Data Model"  section (page  24)
> into the
> https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/docs/DLTK-Freemarker%20-%20Eclipse%20Plugin.odt
>
> So now you can define your model with Java code and you can use it
> into Preview mode (with Freemarker Preview View)).
>
> With this 2 features (Data Model + Preview), you can write your FTL
> template and see the result of model+template merge into the Preview
>
> View as soon as user type some content into the template editor
> (it's done into another Thread like Javadoc View).
>
> I have started to do the same thing to customize Configuration (see
> Freemarker Configuration section of the Overview page).
>
> I think it should be cool if the Overview page display the
> Freemarker Confiuration customized with Java code.

You mean... what exactly? Showing the resulting setting values?

> I think we could do the sam ething for the model. We could see :
>
> * the model defined into Java code
> * the model used into template
>
> And we could show delta between "model defined into Java code" and "model used into template" and

Sorry, I don't understand what are these two data-models. Maybe you
want to extract the variable names from the template?

> * model used into template but not defined into Java code.
> * model defined into Java code but not used into template.
>
> Hope it will please you.
>
> Don't hesitate to tell me what you like, what you don't like. Any suggestions are welcome!
>
> Thank a lot.
>
> Regards Angelo
--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,niel,
>
> I have commited my work with Data Model that you define into
> Overview page of the Freemarker editor. Please see the attached
> screenshot

I suppose later there will be yet another field for choosing a
FreeMarker Configuration that was defined on the project-level
(instead of choosing a Configuration class + method that is specific
to the template).

Exactly! I have the intention to add checkox named "Set as settings project"   to set the configuration as scope project. We could define too this settings into the (futur) Project Properties.
Is it ok?

Some typos (I quote the correct forms here):
In the titles:
"Data-Model" (no spaces around the "-"),
"FreeMarker Configuration"
In the body: "provides", "data-model", "class and method"

Fixed. Thanks!

> or read "Freemarker & Data Model"  section (page  24)
> into the
> https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/docs/DLTK-Freemarker%20-%20Eclipse%20Plugin.odt
>
> So now you can define your model with Java code and you can use it
> into Preview mode (with Freemarker Preview View)).
>
> With this 2 features (Data Model + Preview), you can write your FTL
> template and see the result of model+template merge into the Preview
>
> View as soon as user type some content into the template editor
> (it's done into another Thread like Javadoc View).
>
> I have started to do the same thing to customize Configuration (see
> Freemarker Configuration section of the Overview page).
>
> I think it should be cool if the Overview page display the
> Freemarker Confiuration customized with Java code.

You mean... what exactly? Showing the resulting setting values?

Yes. What do you think about that? If you are OK how imagine you that?

> I think we could do the sam ething for the model. We could see :
>
> * the model defined into Java code
> * the model used into template
>
> And we could show delta between "model defined into Java code" and "model used into template" and

Sorry, I don't understand what are these two data-models. Maybe you
want to extract the variable names from the template?
 
Yes, it's the idea. Template use model (extract names from the template as you said) and model provides.

> * model used into template but not defined into Java code.
> * model defined into Java code but not used into template.
>
> Hope it will please you.
>
> Don't hesitate to tell me what you like, what you don't like. Any suggestions are welcome!
>
> Thank a lot.
>
> Regards Angelo
--
Best regards,
 Daniel Dekany

Angelo
 


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Monday, June 21, 2010, 6:33:28 PM, Angelo zerr wrote:

[snip]
> Exactly! I have the intention to add checkox named "Set as settings
> project"

It should be a radio button actually:

  ( ) Use a project-level configuration:
      [My config  |V]

  (O) Use template-specific configuration:
      <details come here...>

(The [...|V] thing is a drop-down list.)

> to set the configuration as scope project. We could define too this
> settings into the (futur) Project Properties. Is it ok?

Yes.

[snip]
>>> And we could show delta between "model defined into Java code" and "model used into template" and
>>
>> Sorry, I don't understand what are these two data-models. Maybe you
>> want to extract the variable names from the template?
>  
> Yes, it's the idea. Template use model (extract names from the
> template as you said) and model provides.

That sounds useful, but it will be tricky. Inside macros the parameter
variable names had to be excluded, and inside loops the loop-variable
names have to be. Even if this is solved, it still will not reliably
work in many applications since the template can create variables with
#assign and #global, and those might happen conditionally or even
outside the edited template.

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,

I have commited my work, and now you can manage Configuration with Java code like this :

public class MyFreemarkerSettings {
 
    public static Configuration getConfiguration() {
        Configuration configuration = new Configuration();
        try {
            configuration.setSharedVariable("YES", true);
        } catch (TemplateModelException e) {
    
        }
        configuration.setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX);
        return configuration;
    }
}

In this sample, I have defined "YES" variable that you can use into FTL and "square bracket syntax", and preview use this Configuration (actually run and debug doesn't works).
 I tell me if "Freemarker Configuration" from Overview Page should display the Configuration. In this sample :

* A drop-down list called "Tag Syntaxt" with the 3 values ("Square Bracket", "Angle Bracket" and "Auto Bracket") and "Square Bracket" will be selected.
* display the shared variables into a tree.

What do you think about this idea?
If you like, could you tell me the another config wich should be important to display?
 
> Exactly! I have the intention to add checkox named "Set as settings
> project"

It should be a radio button actually:

 ( ) Use a project-level configuration:
     [My config  |V]

 (O) Use template-specific configuration:
     <details come here...>

(The [...|V] thing is a drop-down list.)

Ok I see the idea. But you mean that into Project Properties you can define several Model/Configuration provider (drop-down list.) ?
 

> to set the configuration as scope project. We could define too this
> settings into the (futur) Project Properties. Is it ok?

Yes.

[snip]
>>> And we could show delta between "model defined into Java code" and "model used into template" and
>>
>> Sorry, I don't understand what are these two data-models. Maybe you
>> want to extract the variable names from the template?
>
> Yes, it's the idea. Template use model (extract names from the
> template as you said) and model provides.

That sounds useful, but it will be tricky. Inside macros the parameter
variable names had to be excluded, and inside loops the loop-variable
names have to be. Even if this is solved, it still will not reliably
work in many applications since the template can create variables with
#assign and #global, and those might happen conditionally or even
outside the edited template.

Ok, I understand the problem. Perhaps we could display only the Data-Model coming from the ModelProvider class?
After we could have an Eclipse View, called "Data-Model" which display the Data-Model  switch the cursor position of the template, macro...This View dosplay only the available Data-Model.
What do you think about that?

Regards Angelo


--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Tuesday, June 22, 2010, 4:42:44 PM, Angelo zerr wrote:

> Hi Daniel,
>
> I have commited my work, and now you can manage Configuration with Java code like this :
>
> public class MyFreemarkerSettings {
>  
>     public static Configuration getConfiguration() {
>         Configuration configuration = new Configuration();
>         try {
>             configuration.setSharedVariable("YES", true);
>         } catch (TemplateModelException e) {
>      
>         }
>        
> configuration.setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX);
>         return configuration;
>     }
> }
>
> In this sample, I have defined "YES" variable that you can use into
> FTL and "square bracket syntax", and preview use this Configuration
> (actually run and debug doesn't works).
>  I tell me if "Freemarker Configuration" from Overview Page should
> display the Configuration. In this sample :
>
> * A drop-down list called "Tag Syntaxt" with the 3 values ("Square
> Bracket", "Angle Bracket" and "Auto Bracket") and "Square Bracket" will be selected.
> * display the shared variables into a tree.
>
> What do you think about this idea?

Sounds fine. (Note that it's not "Auto Bracket" tag syntax, but "Auto
detect" tag syntax.)

> If you like, could you tell me the another config wich should be important to display?

These are used frequently, and can be easily displayed as a field:
  number_format, date_format, date_time_format,
  locale,
  output_encoding, url_escaping_charset,
  auto_imports, auto_includes

These are also often used, however can't be easily presented in
a GUI as an editable field:
  object_wrapper

These are often used, but, I guess, are tricky to use together with
the plugin:
  template_loader
  default_encoding

>> Exactly! I have the intention to add checkox named "Set as settings
>> project"
>
>> It should be a radio button actually:
>>
>>  ( ) Use a project-level configuration:
>>      [My config  |V]
>>
>>  (O) Use template-specific configuration:
>>      <details come here...>
>>
>> (The [...|V] thing is a drop-down list.)
>>
> Ok I see the idea. But you mean that into Project Properties you
> can define several Model/Configuration provider (drop-down list.) ?

Several Configuration providers, yes. As I said earlier, in the same
application templates are possibly used for different purposes (like
some for generating e-mail, and some for generating web pages). So
while specifying a configuration that is specific to a single template
will be seldom useful, being able to choose if which of the
project-level configurations a template belongs to is definitely
useful.

I have no opinion regarding project-level data-models.

[snip]

>> That sounds useful, but it will be tricky. Inside macros the parameter
>> variable names had to be excluded, and inside loops the loop-variable
>> names have to be. Even if this is solved, it still will not reliably
>> work in many applications since the template can create variables with
>> #assign and #global, and those might happen conditionally or even
>> outside the edited template.
>
> Ok, I understand the problem. Perhaps we could display only the
> Data-Model coming from the ModelProvider class?
> After we could have an Eclipse View, called "Data-Model" which
> display the Data-Model  switch the cursor position of the template,
> macro...This View dosplay only the available Data-Model.
> What do you think about that?

People often ask for ways of dumping the data-model. Even though it's
mostly about debugging running applications, not about editing/running
templates, I suppose you could reuse the same code for the debugging
later.

Unfortunately, displaying the data-model is not trivial either,
because FreeMarker data-models are "too flexible". Like for some
hashes the keys can't be reliably listed. But, well, then they will
not be all listed, and that's it. Then, there are multi-type values in
FTL, like string+hash+sequence, which is extra work when you deal with
the visualization. But perhaps the most fundamental issue is that
traversing the data-model might be slow (or even can have some
side-effects) (all depends on the application developers, not on us).
So to be on the safe-side, it's certainly wise to traverse only that
much of the data-model that's indeed required (kind of lazy
evaluation). I guess by default you should only list the *keys* of the
data-model root, and get the values of the variables only when the
user requests that for a variable (for example by clicking on the
variable name in the data-model view GUI, or requesting it implicitly
due to auto-completion in the source editor). There could be a
data-model-level plugin setting that tells how deep to traverse into
the data-model (default could be 1, means root names only), and
another that tells if the values in the last level should be get
(unchecked by default). Or maybe I'm too paranoid with the defaults...

> Regards Angelo
>
>
> --
> Best regards,
>  Daniel Dekany

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,
> * A drop-down list called "Tag Syntaxt" with the 3 values ("Square
> Bracket", "Angle Bracket" and "Auto Bracket") and "Square Bracket" will be selected.
> * display the shared variables into a tree.
>
> What do you think about this idea?

Sounds fine. (Note that it's not "Auto Bracket" tag syntax, but "Auto
detect" tag syntax.)

That's cool:) Ok I will do that.

> If you like, could you tell me the another config wich should be important to display?

These are used frequently, and can be easily displayed as a field:
 number_format, date_format, date_time_format,
 locale,
 output_encoding, url_escaping_charset,
 auto_imports, auto_includes

Thank's I will do add too.

These are also often used, however can't be easily presented in
a GUI as an editable field:
 object_wrapper
Ok.

These are often used, but, I guess, are tricky to use together with
the plugin:
 template_loader
For the template_loader, today I'm forcing to FTL file in order to manage <#include correctly.
 
 default_encoding

Ok.

I'm afraid that GUI will grow with a lot of  parameters of teh configuration. Perhaps it should be better to split Overview page :

* Model page
* Configuration page.

What do you think?


>> Exactly! I have the intention to add checkox named "Set as settings
>> project"
>
>> It should be a radio button actually:
>>
>>  ( ) Use a project-level configuration:
>>      [My config  |V]
>>
>>  (O) Use template-specific configuration:
>>      <details come here...>
>>
>> (The [...|V] thing is a drop-down list.)
>>
> Ok I see the idea. But you mean that into Project Properties you
> can define several Model/Configuration provider (drop-down list.) ?

Several Configuration providers, yes. As I said earlier, in the same
application templates are possibly used for different purposes (like
some for generating e-mail, and some for generating web pages). So
while specifying a configuration that is specific to a single template
will be seldom useful, being able to choose if which of the
project-level configurations a template belongs to is definitely
useful.

Ok I understand your idea. I agree with you. I will try to manage that.

I have no opinion regarding project-level data-models.
I think if we manage that for Configuration, we must manage too for Model. No?

[snip]
>> That sounds useful, but it will be tricky. Inside macros the parameter
>> variable names had to be excluded, and inside loops the loop-variable
>> names have to be. Even if this is solved, it still will not reliably
>> work in many applications since the template can create variables with
>> #assign and #global, and those might happen conditionally or even
>> outside the edited template.
>
> Ok, I understand the problem. Perhaps we could display only the
> Data-Model coming from the ModelProvider class?
> After we could have an Eclipse View, called "Data-Model" which
> display the Data-Model  switch the cursor position of the template,
> macro...This View dosplay only the available Data-Model.
> What do you think about that?

People often ask for ways of dumping the data-model. Even though it's
mostly about debugging running applications, not about editing/running
templates, I suppose you could reuse the same code for the debugging
later.

I have commited my work and now preview, run and debug use the model+configuration provider classes.

Unfortunately, displaying the data-model is not trivial either,
because FreeMarker data-models are "too flexible". Like for some
hashes the keys can't be reliably listed.

Yes I have seen that with freemarker.ext.dom.NodeModel for instance. I think if NodeModel will return the supported keys like

String[] getSupportedKeys() {"@@text", "@@local_name", ....} I could use that to retrieve the keys. No?

But, well, then they will
not be all listed, and that's it. Then, there are multi-type values in
FTL, like string+hash+sequence, which is extra work when you deal with
the visualization. But perhaps the most fundamental issue is that
traversing the data-model might be slow (or even can have some
side-effects) (all depends on the application developers, not on us).
So to be on the safe-side, it's certainly wise to traverse only that
much of the data-model that's indeed required (kind of lazy
evaluation). I guess by default you should only list the *keys* of the
data-model root, and get the values of the variables only when the
user requests that for a variable (for example by clicking on the
variable name in the data-model view GUI, or requesting it implicitly
due to auto-completion in the source editor). There could be a
data-model-level plugin setting that tells how deep to traverse into
the data-model (default could be 1, means root names only), and
another that tells if the values in the last level should be get
(unchecked by default). Or maybe I'm too paranoid with the defaults...

I'm sorry, it's difficult for me to understand the "slowly" problem. My idea is to show after model provider (and configuration provider) class+method selection  that is OK. To do that :

* for the Configuration provider, it display the config used into Java code as you said.
* for the Model provider, my idea was to display the keys/value of the model. You tell me that's complex. So the idea is to display the root keys in the tree and when user expand a node of tree, we can search the value of the model tree node. Is that your suggestion?

Angelo

> Regards Angelo
>
>
> --
> Best regards,
>  Daniel Dekany

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,

I have decided to split overview page to have two pages :

* Configuration Page
* Model Page.

When I will display the Configuration it will be more clean.

I have started to manage Specific Template/Project level configuration
for the both Model/Configuration page.

I have attached a screen to check if you are OK with teh GUI.

Regards Angelo

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

fm_configurationpage.png (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
Thursday, June 24, 2010, 12:11:56 PM, Angelo zerr wrote:

> Hi Daniel,
>
> I have decided to split overview page to have two pages :
>
> * Configuration Page
> * Model Page.
>
> When I will display the Configuration it will be more clean.
>
> I have started to manage Specific Template/Project level configuration
> for the both Model/Configuration page.
>
> I have attached a screen to check if you are OK with teh GUI.

Looks fine. (Except that, I believe, you should always use "-" when
you say something like "template-specific".)

> Regards Angelo

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

Daniel Dekany
In reply to this post by angelozerr
Wednesday, June 23, 2010, 11:04:02 AM, Angelo zerr wrote:

[snip]
>>  default_encoding
>
> Ok.

I said it's certainly problematic because in principle the charset
used by Eclipse in the editor should be this...

[snip]
>> I have no opinion regarding project-level data-models.
> I think if we manage that for Configuration, we must manage too for Model. No?

Perhaps sometimes it's useful to have project-leved mock data-models,
but... why is that a must?

[snip]
>> Unfortunately, displaying the data-model is not trivial either,
>> because FreeMarker data-models are "too flexible". Like for some
>> hashes the keys can't be reliably listed.
>
> Yes I have seen that with freemarker.ext.dom.NodeModel for
> instance. I think if NodeModel will return the supported keys like
>
> String[] getSupportedKeys() {"@@text", "@@local_name", ....} I
> could use that to retrieve the keys. No?

That's a possibility. The point is, if you want to display XML
node-models nicely, then the data-model view have to be
NodeModel-aware... Anyway, I think we could return to wishes and bells
like this at a later stage.

[snip]
> I'm sorry, it's difficult for me to understand the "slowly"
> problem. My idea is to show after model provider (and configuration
> provider) class+method selection  that is OK. To do that :
>
> * for the Configuration provider, it display the config used into Java code as you said.

Yeah, and that's the easier part, as the Configuration implementation
is given. The implementations of TemplateModel interfaces are
however... can do anything.

> * for the Model provider, my idea was to display the keys/value of
> the model. You tell me that's complex. So the idea is to display the
> root keys in the tree and when user expand a node of tree, we can
> search the value of the model tree node. Is that your suggestion?

Basically yes. Only I made this a bit more general, and said that the
data-model view could have a setting that tells how deep it traverses
the data-model automatically and if the value should be retrieved for
the keys on the deepest level, and those should default to 1 and
false. But now that I think about it a bit more, I guess you will show
the data-model unexpanded anyway, and then the question boils down to
whether values should be immediately retrieved (and thus displayed)
for the keys that become visible... So maybe that's the only setting
needed here.

> Angelo
>
>
>> Regards Angelo
>>
>>
>> --
>> Best regards,
>>  Daniel Dekany
>
> --
> Best regards,
>  Daniel Dekany
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tchat with you about DLTK Freemarker plugin ?

angelozerr
Hi Daniel,

Thank a lot for your answer. I will re-read your comments before
starting the display of the model (is it possible?). I have finished
(even if some improvment could be done ) the project level + specific
configuration for Configuration+Model provider (everything is
commited).

I have attached a screen to show you the Model Provider tab.The screen show you

* list of Model Provider configuration created with project level.
* a model provider configuration is selected.  You can edit,
duplicate, remove (doesn't works well) or Add new config. It display a
dialog to manage this configuration.
* if you click on Open Class (or double click on the model provider
sonfiguration), you will go to the Java Class (Java editor is opened).
* the Freemarker Preview display the current selected template editor.
It is refrehed at runtime, it means that if you change the template
content, the view is refrehed, if you change the Java code (and you go
to the Freemarker editor), the view is refreshed.

So imagine you have 2 Model provider configuration. You select the
first. You click on save, view is refrehed. You click on second  Model
provider configuration+save, the View is refrehed. So you can see the
result of the merge template+model quicly with several Model.

I have attached a second screen to show you the overview page. Tell me
if you like this idea. Link of Provider Configuration go to the page
(Model or Configuration page). Text description of each section must
be changed. If you can help me with that, it should be very cool. I
think we could add some other section into the overview page, like
macro used, import FTL used....

Ideas are welcome:)

I will update the documentation and my next works is :

* display the Freemarker Configuration in Configuration  page.
* display the Data-Model (with treeview)  in Model page.

Hope it will please you.

Regards Angelo

2010/6/25 Daniel Dekany <[hidden email]>:

> Wednesday, June 23, 2010, 11:04:02 AM, Angelo zerr wrote:
>
> [snip]
>>>  default_encoding
>>
>> Ok.
>
> I said it's certainly problematic because in principle the charset
> used by Eclipse in the editor should be this...
>
> [snip]
>>> I have no opinion regarding project-level data-models.
>> I think if we manage that for Configuration, we must manage too for Model. No?
>
> Perhaps sometimes it's useful to have project-leved mock data-models,
> but... why is that a must?
>
> [snip]
>>> Unfortunately, displaying the data-model is not trivial either,
>>> because FreeMarker data-models are "too flexible". Like for some
>>> hashes the keys can't be reliably listed.
>>
>> Yes I have seen that with freemarker.ext.dom.NodeModel for
>> instance. I think if NodeModel will return the supported keys like
>>
>> String[] getSupportedKeys() {"@@text", "@@local_name", ....} I
>> could use that to retrieve the keys. No?
>
> That's a possibility. The point is, if you want to display XML
> node-models nicely, then the data-model view have to be
> NodeModel-aware... Anyway, I think we could return to wishes and bells
> like this at a later stage.
>
> [snip]
>> I'm sorry, it's difficult for me to understand the "slowly"
>> problem. My idea is to show after model provider (and configuration
>> provider) class+method selection  that is OK. To do that :
>>
>> * for the Configuration provider, it display the config used into Java code as you said.
>
> Yeah, and that's the easier part, as the Configuration implementation
> is given. The implementations of TemplateModel interfaces are
> however... can do anything.
>
>> * for the Model provider, my idea was to display the keys/value of
>> the model. You tell me that's complex. So the idea is to display the
>> root keys in the tree and when user expand a node of tree, we can
>> search the value of the model tree node. Is that your suggestion?
>
> Basically yes. Only I made this a bit more general, and said that the
> data-model view could have a setting that tells how deep it traverses
> the data-model automatically and if the value should be retrieved for
> the keys on the deepest level, and those should default to 1 and
> false. But now that I think about it a bit more, I guess you will show
> the data-model unexpanded anyway, and then the question boils down to
> whether values should be immediately retrieved (and thus displayed)
> for the keys that become visible... So maybe that's the only setting
> needed here.
>
>> Angelo
>>
>>
>>> Regards Angelo
>>>
>>>
>>> --
>>> Best regards,
>>>  Daniel Dekany
>>
>> --
>> Best regards,
>>  Daniel Dekany
>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit.  See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> _______________________________________________
>> FreeMarker-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>
> --
> Best regards,
>  Daniel Dekany
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

model_provider.png (123K) Download Attachment
overview_page.png (21K) Download Attachment
12