[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: Behavior API proof of concept PR
From:       John Hendrikx <john.hendrikx () gmail ! com>
Date:       2023-11-30 22:28:28
Message-ID: 2c5318b7-178e-b834-aa6a-2d63f56699da () gmail ! com
[Download RAW message or body]

Thanks for having a look!

On 30/11/2023 19:47, Andy Goryachev wrote:
>
> I think BehaviorContext looks suspiciously like a (skin) input map, so 
> I would rather see that.
>
> Invention of State class is a way to work around the stateless 
> behavior which, though it adds (in my opinion) very little, might 
> still be a feature that app developers want to exploit - at least in 
> terms of saving on per-instance key maps.  So any alternative proposal 
> should also support a stateless behavior.
>
I'm unsure what you are trying to say here.

The State class is internal, and can be anything, and take any form.  If 
you only need to add a single EventHandler, you can also make that a 
class instead of a Lambda and have the state there. The State class, 
which can be named anything, is just a convenient way to share state 
amongst multiple handlers without having to construct each of them with 
special parameters, or having to put the state in the main class's 
fields (which would make it not reusable).

I do however see that I did not take reusability of the keymaps into 
account in this version, that will need to be adjusted -- I was more 
focused on keeping Behaviors isolated for now, not needing a Control 
until installed, and having 0 references between Skins and Behaviors.

I was hoping for more comments on how the seperation between Skin and 
Behavior is done in this PR.  I will attempt to adjust TextInputControl 
soon (and I will try a few subclasses of ButtonBehavior, to see how they 
can be built "on top" of another behavior) -- so far I've not found any 
real problems with this approach.

--John

> *From: *openjfx-dev <openjfx-dev-retn@openjdk.org> on behalf of John 
> Hendrikx <john.hendrikx@gmail.com>
> *Date: *Wednesday, November 29, 2023 at 14:54
> *To: *openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
> *Subject: *Behavior API proof of concept PR
>
> For those still interested, I've updated
> https://github.com/openjdk/jfx/pull/1265 with a replaced ButtonBehavior
> and SpinnerBehavior, using concepts laid out in
> https://gist.github.com/hjohn/c7b1bf9d4a4770b1b3ae854b20fbaa94
>
> Any feedback is welcome, I think it's making progress, and the changes
> required seem quite doable.
>
> The ability for Behaviors to intercept any event from its Control or its
> (named) children makes Behaviors a lot more powerful than earlier
> proposals, allowing for completely new interactions without requiring
> Skin changes.
>
> --John
>
[Attachment #3 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thanks for having a look!<br>
    </p>
    <div class="moz-cite-prefix">On 30/11/2023 19:47, Andy Goryachev
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7CED4ED6FD04AE0AA5FE582A@DM5PR1001MB2172.namprd10.prod.outlook.com">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
	{font-family:"Iosevka Fixed SS16";
	panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
	{font-family:"Times New Roman \(Body CS\)";
	panose-1:2 11 6 4 2 2 2 2 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:10.0pt;
	font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}span.EmailStyle19
	{mso-style-type:personal-reply;
	font-family:"Iosevka Fixed SS16";
	color:windowtext;}.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	mso-ligatures:none;}div.WordSection1
	{page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;">I think BehaviorContext looks suspiciously like
            a (skin) input map, so I would rather see that. 
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;">Invention of State class is a way to work around
            the stateless behavior which, though it adds (in my opinion)
            very little, might still be a feature that app developers
            want to exploit - at least in terms of saving on
            per-instance key maps.  So any alternative proposal should
            also support a stateless behavior.</span></p>
      </div>
    </blockquote>
    <p>I'm unsure what you are trying to say here.</p>
    <p>The State class is internal, and can be anything, and take any
      form.  If you only need to add a single EventHandler, you can also
      make that a class instead of a Lambda and have the state there.
      The State class, which can be named anything, is just a convenient
      way to share state amongst multiple handlers without having to
      construct each of them with special parameters, or having to put
      the state in the main class's fields (which would make it not
      reusable).<br>
    </p>
    <p>I do however see that I did not take reusability of the keymaps
      into account in this version, that will need to be adjusted -- I
      was more focused on keeping Behaviors isolated for now, not
      needing a Control until installed, and having 0 references between
      Skins and Behaviors.</p>
    <p>I was hoping for more comments on how the seperation between Skin
      and Behavior is done in this PR.  I will attempt to adjust
      TextInputControl soon (and I will try a few subclasses of
      ButtonBehavior, to see how they can be built "on top" of another
      behavior) -- so far I've not found any real problems with this
      approach.<br>
    </p>
    <p>--John<br>
    </p>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7CED4ED6FD04AE0AA5FE582A@DM5PR1001MB2172.namprd10.prod.outlook.com">
  <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p> </o:p><o:p></o:p></span></p>
      </div>
    </blockquote>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7CED4ED6FD04AE0AA5FE582A@DM5PR1001MB2172.namprd10.prod.outlook.com">
  <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:&quot;Iosevka Fixed
            SS16&quot;"><o:p> </o:p></span></p>
        <div id="mail-editor-reference-message-container">
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
                    style="font-size:12.0pt;color:black">From:
                  </span></b><span style="font-size:12.0pt;color:black">openjfx-dev
                  <a class="moz-txt-link-rfc2396E" \
href="mailto:openjfx-dev-retn@openjdk.org">&lt;openjfx-dev-retn@openjdk.org&gt;</a> \
                on behalf of John
                  Hendrikx <a class="moz-txt-link-rfc2396E" \
href="mailto:john.hendrikx@gmail.com">&lt;john.hendrikx@gmail.com&gt;</a><br>  \
                <b>Date: </b>Wednesday, November 29, 2023 at 14:54<br>
                  <b>To: </b><a class="moz-txt-link-abbreviated" \
                href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a>
                  <a class="moz-txt-link-rfc2396E" \
                href="mailto:openjfx-dev@openjdk.org">&lt;openjfx-dev@openjdk.org&gt;</a><br>
                
                  <b>Subject: </b>Behavior API proof of concept \
PR<o:p></o:p></span></p>  </div>
            <div>
              <p class="MsoNormal" style="margin-bottom:12.0pt"><span
                  style="font-size:11.0pt">For those still interested,
                  I've updated
                  <br>
                  <a href="https://github.com/openjdk/jfx/pull/1265"
                    moz-do-not-send="true" \
class="moz-txt-link-freetext">https://github.com/openjdk/jfx/pull/1265</a>  with a \
replaced ButtonBehavior  <br>
                  and SpinnerBehavior, using concepts laid out in <br>
                  <a
                    href="https://gist.github.com/hjohn/c7b1bf9d4a4770b1b3ae854b20fbaa94"
                
                    moz-do-not-send="true" \
class="moz-txt-link-freetext">https://gist.github.com/hjohn/c7b1bf9d4a4770b1b3ae854b20fbaa94</a><br>
  <br>
                  Any feedback is welcome, I think it's making progress,
                  and the changes <br>
                  required seem quite doable.<br>
                  <br>
                  The ability for Behaviors to intercept any event from
                  its Control or its <br>
                  (named) children makes Behaviors a lot more powerful
                  than earlier <br>
                  proposals, allowing for completely new interactions
                  without requiring <br>
                  Skin changes.<br>
                  <br>
                  --John<o:p></o:p></span></p>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic