You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by "Roger L. Whitcomb" <Ro...@actian.com> on 2013/04/26 17:42:24 UTC

RE: I just wanted to ask

Hi Cynthia,

                I think what you are saying is "the accepted way".
There is a "component", which is the "Model" part of an MVC
(Model-View-Controller) paradigm, then the "skin" which actually
combines the "View" and "Controller" parts of MVC.  The viewing would be
in the layout and painting part and the controlling would be in the
keyboard and mouse interactions.  So, it seems like you're pretty safe
the way you have things organized.  The interactions between the
component and skin go something like this:

1.       When the component is instantiated, it also instantiates the
skin along with it.

2.       The skin then registers itself as a listener on its associated
component so that changes that occur in the component can be reflected
in the painting done by the skin.

3.       In response to keyboard / mouse interactions the skin makes
changes to the underlying component as necessary.

4.       As the component makes these changes it notifies all registered
listeners (including the skin) of these changes and the skin then
resizes / repaints as necessary.

 

So, you see the listeners are critical parts of the whole scheme.  If
you get these interactions right, then things should work as expected.

 

                In the case of some of the more complicated components
(such as TextArea and TextPane), there are multiple pieces of the skin
(and the component) in order to modularize some of the activities, but
this is more of a pragmatic choice than an architectural requirement.

 

                And, definitely, the painting should be done efficiently
by limiting the invalidated areas to just what needs to be painted.

 

                I'm going to post this to the Users list so others can
also benefit.  

 

HTH,

~Roger Whitcomb

 

From: Schwartz, Cynthia L [mailto:cynthia.l.schwartz@intel.com] 
Sent: Friday, April 26, 2013 8:30 AM
To: Roger L. Whitcomb
Subject: I just wanted to ask

 

Roger,

 

IF you remember, my custom component needs to be (mouse, keyboard)
interactive with editing.  I followed TextArea where I have a skin and
then the interactive nature is in another skin (in this case
ParagraphSkin).  Is this the accepted way in Pivot?  My interactive
dataset is large so I wish to repaint the whole thing as little as
possible.  I have another component that takes a number of my first
level components and also interacts with them depending in a different
way.  I wrote my first custom component this way and before I started
the second, I just wanted to make sure.

 

I noticed TextArea paints the sections of the text and makes that
decision on criteria. I think that is very efficient so it should be
great. 

 

Thanks,

 

Cynthia