Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Declarative UI in E4

Hi,

I have worked on UFace and CSS E4 engine and I would like give a concrete sample which we can manage with UFace but not with SWT.

SWT problem comes from that some property of SWT widgets doesn't fire event and cannot be observable (Control#setVisible, Scale#setSelection...) don't fire events.

Into Uface we have managed CSS Scale feature.

We can write this CSS :

UIScale[value='<10] {
  backround-color:red;
}


UIScale[value='>10'][value='<50'] {
  backround-color:green;
}


UIScale[value='>50'] {
  backround-color:green;
}

So when you move scale, backround-color change swith value of scale.
If you set the value of scale with UIScale#setValue, the backround-color change.

Into SWT, we can manage the same thing with E4 CSS engine (I'm developping that) but only when user move the scale and NOT if we call Scale#setSelection. Why?

Because to manage this case, we must addSelectionListener to the scale and apply styles with CSS engine (it manage the case where user move the scale). But Scale#setSelection doesn't fire SWT.Selection event, so how can I detect selection?

UFace wrap SWT widget and if we call UIScale#setValue, it call SWT scale#setSelection and fire event that we can catch to apply styles.

So with abstraction UI, we can fix this problem. SWT Visible, Enabled SWT widget have the same problems.

Regards Angelo

Back to the top