Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Re: Trident

Hi Tom

Excellent. Let me defer this for a few days, and once i get back to it, i will let you know if i run into any troubles. It would be great to be able to provide smooth highlight animations on list / table / tree rollovers. If i understand correctly, the code below will not work for selections - would you mind pointing me to a code snippet that allows controlling the BG / FG color of selected cells on the fly?

Thanks
Kirill


From: Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>
Sent: Fri, December 4, 2009 1:03:20 AM
Subject: Re: [e4-dev] Re: Trident

Kirill Grouchnikov schrieb:
> Hi Boris
>
> Thanks for the comments. It looks like we are talking about minor issues
> - how Trident is implemented. That's a lot of valid points that we can
> discuss in this list or in the project mailing lists.
>
> Looking beyond the technical details of singletons, properties files and
> the specifics of constructing timelines, i would like to have some
> people looking at the existing samples shipped with Trident and Granite
> to see how it feels to a person not deeply familiar with the library.
> Trident has a few simple examples - such as animating the FG color of a
> radio button on mouse rollover, as well as more complex application such
> as Granite.
>
> Along the way i have run into a number of limitations in SWT as far as
> the animations go. For example, i wasn't able to animate the FG color of
> a button. Not sure if this is because of SWT or the native APIs. Another
> example is in JFace - wanted to do animations on table rollovers /
> selections, but seems that the color provider infrastructure is not
> dynamic. Once the cell is configured to use the specific BG color, it
> cannot be dynamically changed - or maybe i'm missing something.

Calling TableViewer/TreeViewer#update(Object) would reconsulte the
LabelProvider for the color but I'm not sure that's what you want
because then your animation code would reach out into client code which
is not a good idea.

Beside that the question is whether this would give you the effect you
are looking for because to modify the selection color you need to put
your Table/Tree into owner draw mode.

For mouse rollover effects (without owner draw) you can also directly
modify the color and not going through the LabelProvider infrastructure
with something like this:

-----------8<-----------
ColumnViewer viewer = ....;
Color color = ....;

Listener l = new Listener() {
  public voud handleEvent(Event event) {
    ViewerCell cell = viewer.getCell(new Point(event.x, event.y));
    ViewerRow row = cell.getViewerRow();

    for( int i = 0; i < row.getColumnCount(); i++ ) {
      row.setBackground(i, color);
    }
  }
};

viewer.getControl().addListener(SWT.MouseHover,l);
-----------8<-----------

The nice thing with this code is that this it works for all controls who
provide a JFace-Viewer-Abstraction (TableViewer, TreeViewer, GriViewer,
GridTreeViewer, GalleryViewer, GalleryTreeViewer, ...)

Tom

--
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                                        geschaeftsfuehrer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5/1    A-6020 innsbruck      phone    ++43 512 935834
_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev


Back to the top