Hi,

I'm still experiencing strange behaviors with a custom headerCellRenderer I
implemented.

There are some custom widgets added before the label used in the default
headerCellRenderer in order to add some filtering functions.

But I noticed that when the appearance property is set on one of these
widgets, the new appearance is propagated to all the headerCellRenderers
used in the table. So, for instance, a selectBox will take the textfield
appearence (the opposite is also possible) ...

Is it a normal behavior ?

The playground example I submitted yesterday is still valid because the case
is precisly proven.


http://demo.qooxdoo.org/devel/playground/#%7B
%22code%22%3A%20%22qx.Class.define(%2522myHea
derCell%2522%252C%250A%257B%250A%2520%2520ext
end%2520%253A%2520qx.ui.table.headerrenderer.
HeaderCell%252C%250A%250A%2520%2520construct%
2520%253A%2520function()%250A%2520%2520%257B%
250A%2520%2520%2520%2520this.base(arguments)%
253B%250A%250A%2520%2520%2520%2520var%2520lay
out%2520%253D%2520new%2520qx.ui.layout.Grid()
%253B%250A%2520%2520%2520%2520layout.setRowFl
ex(0%252C%25201)%253B%250A%2520%2520%2520%252
0layout.setColumnFlex(0%252C%25201)%253B%250A
%2520%2520%2520%2520layout.setRowFlex(1%252C%
25201)%253B%250A%2520%2520%2520%2520layout.se
tColumnFlex(1%252C%25201)%253B%250A%2520%2520
%2520%2520layout.setColumnFlex(2%252C%25201)%
253B%250A%2520%2520%250A%2520%2520%2520%2520t
his.setLayout(layout)%253B%250A%2520%2520%257
D%252C%250A%250A%2520%2520properties%2520%253
A%250A%2520%2520%257B%250A%2520%2520%2520%252
0%252F**%2520header%2520cell%2520filter%2520w
idget%2520*%252F%250A%2520%2520%2520%2520filt
er%2520%253A%250A%2520%2520%2520%2520%257B%25
0A%2520%2520%2520%2520%2520%2520check%2520%25
3A%2520%2522Object%2522%252C%250A%2520%2520%2
520%2520%2520%2520init%2520%253A%2520null%252
C%250A%2520%2520%2520%2520%2520%2520nullable%
2520%253A%2520true%252C%250A%2520%2520%2520%2
520%2520%2520apply%2520%253A%2520%2522_applyF
ilter%2522%250A%2520%2520%2520%2520%257D%250A
%2520%2520%257D%252C%250A%250A%2520%2520membe
rs%2520%253A%250A%2520%2520%257B%250A%2520%25
20%2520%2520%252F%252F%2520property%2520apply
%250A%2520%2520%2520%2520_applyFilter%2520%25
3A%2520function(value%252C%2520old)%250A%2520
%2520%2520%2520%257B%250A%2520%2520%2520%2520
if%2520(value)%250A%2520%2520%2520%2520%257B%
250A%2520%2520%2520%2520%2520%2520%252F*var%2
520target%2520%253D%2520this.getChildControl(
%2522filter%2522)%250A%2520%2520%2520%2520%25
20%2520this._excludeChildControl(%2522filter%
2522)%253B%250A%2520%2520%2520%2520%2520%2520
%250A%2520%2520%2520%2520%2520%2520target.dis
pose()%253B*%252F%250A%2520%2520%2520%2520%25
20%2520%2520%2520%2520%2520%2520%2520%250A%25
20%2520%2520%2520%2520%2520this.getChildContr
ol(%2522filter%2522)%253B%250A%2520%2520%2520
%2520%257D%250A%2520%2520%2520%2520else%250A%
2520%2520%2520%2520%257B%250A%2520%2520%2520%
2520%2520%2520this._excludeChildControl(%2522
filter%2522)%253B%250A%2520%2520%2520%2520%25
7D%250A%2520%2520%2520%2520%257D%252C%250A%25
20%2520%250A%2520%2520%2520%2520%252F%252F%25
20overridden%250A%2520%2520%2520%2520_createC
hildControlImpl%2520%253A%2520function(id)%25
0A%2520%2520%2520%2520%257B%250A%2520%2520%25
20%2520var%2520control%253B%250A%250A%2520%25
20%2520%2520switch(id)%250A%2520%2520%2520%25
20%257B%250A%2520%2520%2520%2520%2520%2520cas
e%2520%2522filter%2522%253A%250A%2520%2520%25
20%2520%2520%2520%2520%2520control%2520%253D%
2520this.getFilter()%253B%250A%250A%2520%2520
%2520%2520%2520%2520%2520%2520if%2520(control
!%253Dnull)%250A%2520%2520%2520%2520%2520%252
0%2520%2520%257B%250A%2520%2520%2520%2520%252
0%2520%2520%2520%2520%2520control.set(%250A%2
520%2520%2520%2520%2520%2520%2520%2520%2520%2
520%257B%250A%2520%2520%2520%2520%2520%2520%2
520%2520%2520%2520%2520%2520anonymous%253A%25
20true%252C%250A%2520%2520%2520%2520%2520%252
0%2520%2520%2520%2520%2520%2520allowShrinkX%2
53A%2520true%250A%2520%2520%2520%2520%2520%25
20%2520%2520%2520%2520%257D)%253B%250A%2520%2
520%2520%2520%2520%2520%2520%2520%2520%2520%2
50A%2520%2520%2520%2520%2520%2520%2520%2520%2
520%2520this._add(control%252C%2520%257Brow%2
53A%25200%252C%2520column%253A%25200%252C%252
0colSpan%253A2%257D)%253B%250A%2520%2520%2520
%2520%2520%2520%2520%2520%257D%250A%2520%2520
%2520%2520%2520%2520%2520%2520else%2520this._
add(new%2520qx.ui.basic.Label(%27%27)%252C%25
20%257Brow%253A%25200%252C%2520column%253A%25
200%257D)%253B%250A%2520%2520%2520%2520%2520%
2520%2520%2520break%253B%250A%2520%2520%2520%
2520%2520%2520%250A%2520%2520%2520%2520%2520%
2520case%2520%2522label%2522%253A%250A%2520%2
520%2520%2520%2520%2520%2520%2520control%2520
%253D%2520new%2520qx.ui.basic.Label(this.getL
abel()).set(%250A%2520%2520%2520%2520%2520%25
20%2520%2520%257B%250A%2520%2520%2520%2520%25
20%2520%2520%2520%2520%2520anonymous%253A%252
0true%252C%250A%2520%2520%2520%2520%2520%2520
%2520%2520%2520%2520allowShrinkX%253A%2520tru
e%250A%2520%2520%2520%2520%2520%2520%2520%252
0%257D)%253B%250A%250A%2520%2520%2520%2520%25
20%2520%2520%2520this._add(control%252C%2520%
257Brow%253A%25201%252C%2520column%253A%25201
%257D)%253B%250A%2520%2520%2520%2520%2520%252
0%2520%2520break%253B%250A%250A%2520%2520%252
0%2520%2520%2520case%2520%2522sort-icon%2522%
253A%250A%2520%2520%2520%2520%2520%2520%2520%
2520control%2520%253D%2520new%2520qx.ui.basic
.Image(this.getSortIcon())%253B%250A%2520%252
0%2520%2520%2520%2520%2520%2520control.setAno
nymous(true)%253B%250A%2520%2520%2520%2520%25
20%2520%2520%2520this._add(control%252C%2520%
257Brow%253A%25201%252C%2520column%253A%25202
%257D)%253B%250A%2520%2520%2520%2520%2520%252
0%2520%2520break%253B%250A%250A%2520%2520%252
0%2520%2520%2520case%2520%2522icon%2522%253A%
250A%2520%2520%2520%2520%2520%2520%2520%2520c
ontrol%2520%253D%2520new%2520qx.ui.basic.Imag
e(this.getIcon()).set(%250A%2520%2520%2520%25
20%2520%2520%2520%2520%257B%250A%2520%2520%25
20%2520%2520%2520%2520%2520%2520%2520anonymou
s%253A%2520true%252C%250A%2520%2520%2520%2520
%2520%2520%2520%2520%2520%2520allowShrinkX%25
3A%2520true%250A%2520%2520%2520%2520%2520%252
0%2520%2520%257D)%253B%250A%2520%2520%2520%25
20%2520%2520%2520%2520this._add(control%252C%
2520%257Brow%253A%25201%252C%2520column%253A%
25200%257D)%253B%250A%2520%2520%2520%2520%252
0%2520%2520%2520break%253B%250A%2520%2520%252
0%2520%257D%250A%250A%2520%2520%2520%2520retu
rn%2520control%2520%257C%257C%2520this.base(a
rguments%252C%2520id)%253B%250A%2520%2520%252
0%2520%257D%250A%2520%2520%257D%250A%257D)%25
3B%250A%250Aqx.Class.define(%2522myHeaderRend
erer%2522%252C%250A%257B%250A%2520%2520extend
%2520%253A%2520qx.ui.table.headerrenderer.Def
ault%252C%250A%250A%2520%2520construct%2520%2
53A%2520function()%250A%2520%2520%257B%250A%2
520%2520this.base(arguments)%253B%250A%2520%2
520%257D%252C%250A%2520%2520%250A%2520%2520st
atics%2520%253A%250A%2520%2520%257B%250A%2520
%2520%2520%2520STATE_SORTED%2520%2520%2520%25
20%2520%2520%2520%2520%2520%2520%2520%253A%25
20%2522sorted%2522%252C%250A%2520%2520STATE_S
ORTED_ASCENDING%2520%253A%2520%2522sortedAsce
nding%2522%250A%2520%2520%257D%252C%250A%2520
%2520%250A%2520%2520members%2520%253A%250A%25
20%2520%257B%250A%2520%2520%2520%2520%252F%25
2F%2520overridden%250A%2520%2520%2520%2520cre
ateHeaderCell%2520%253A%2520function(cellInfo
)%250A%2520%2520%2520%2520%257B%250A%2520%252
0%2520%2520var%2520widget%2520%253D%2520new%2
520myHeaderCell()%253B%250A%2520%2520%2520%25
20widget.setMinHeight(60)%253B%250A%2520%2520
%2520%2520this.updateHeaderCell(cellInfo%252C
%2520widget)%253B%250A%250A%2520%2520%2520%25
20return%2520widget%253B%250A%2520%2520%2520%
2520%257D%252C%250A%250A%250A%2520%2520%2520%
2520%252F%252F%2520overridden%250A%2520%2520%
2520%2520updateHeaderCell%2520%253A%2520funct
ion(cellInfo%252C%2520cellWidget)%250A%2520%2
520%2520%2520%257B%250A%2520%2520%2520%2520va
r%2520DefaultHeaderCellRenderer%2520%253D%252
0myHeaderCell%253B%250A%250A%2520%2520%2520%2
520%252F%252F%2520check%2520for%2520localizat
ion%2520%255BBUG%2520%25232699%255D%250A%2520
%2520%2520%2520if%2520(cellInfo.name%2520%252
6%2526%2520cellInfo.name.translate)%250A%2520
%2520%2520%2520%257B%250A%2520%2520%2520%2520
%2520%2520cellWidget.setLabel(cellInfo.name.t
ranslate())%253B%250A%2520%2520%2520%2520%257
D%250A%2520%2520%2520%2520else%250A%2520%2520
%2520%2520%257B%250A%2520%2520%2520%2520%2520
%2520cellWidget.setLabel(cellInfo.name)%253B%
250A%2520%2520%2520%2520%257D%250A%250A%2520%
2520%2520%2520%252F%252F%2520Set%2520image%25
20tooltip%2520if%2520given%250A%2520%2520%252
0%2520var%2520widgetToolTip%2520%253D%2520cel
lWidget.getToolTip()%253B%250A%2520%2520%2520
%2520if%2520(this.getToolTip()%2520!%253D%252
0null)%250A%2520%2520%2520%2520%257B%250A%252
0%2520%2520%2520%2520%2520if%2520(widgetToolT
ip%2520%253D%253D%2520null)%250A%2520%2520%25
20%2520%2520%2520%257B%250A%2520%2520%2520%25
20%2520%2520%2520%2520%252F%252F%2520We%2520h
ave%2520no%2520tooltip%2520yet%2520-%253E%252
0Create%2520one%250A%2520%2520%2520%2520%2520
%2520%2520%2520widgetToolTip%2520%253D%2520ne
w%2520qx.ui.tooltip.ToolTip(this.getToolTip()
)%253B%250A%2520%2520%2520%2520%2520%2520%252
0%2520cellWidget.setToolTip(widgetToolTip)%25
3B%250A%2520%2520%2520%2520%2520%2520%2520%25
20%252F%252F%2520Link%2520disposer%2520to%252
0cellwidget%2520to%2520prevent%2520memory%252
0leak%250A%2520%2520%2520%2520%2520%2520%2520
%2520qx.util.DisposeUtil.disposeTriggeredBy(w
idgetToolTip%252C%2520cellWidget)%253B%250A%2
520%2520%2520%2520%2520%2520%257D%250A%2520%2
520%2520%2520%2520%2520else%250A%2520%2520%25
20%2520%2520%2520%257B%250A%2520%2520%2520%25
20%2520%2520%2520%2520%252F%252F%2520Update%2
520tooltip%2520text%250A%2520%2520%2520%2520%
2520%2520%2520%2520widgetToolTip.setLabel(thi
s.getToolTip())%253B%250A%2520%2520%2520%2520
%2520%2520%257D%250A%2520%2520%2520%2520%257D
%250A%250A%2520%2520%2520%2520cellInfo.sorted
%2520%253F%250A%2520%2520%2520%2520cellWidget
.addState(DefaultHeaderCellRenderer.STATE_SOR
TED)%2520%253A%250A%2520%2520%2520%2520cellWi
dget.removeState(DefaultHeaderCellRenderer.ST
ATE_SORTED)%253B%250A%250A%2520%2520%2520%252
0cellInfo.sortedAscending%2520%253F%250A%2520
%2520%2520%2520cellWidget.addState(DefaultHea
derCellRenderer.STATE_SORTED_ASCENDING)%2520%
253A%250A%2520%2520%2520%2520cellWidget.remov
eState(DefaultHeaderCellRenderer.STATE_SORTED
_ASCENDING)%253B%250A%2520%2520%2520%2520%250
A%2520%2520%2520%2520var%2520tcm_columns%2520
%253D%2520cellInfo.table.getTableColumnModel(
).getUserData(%27config%27)%253B%250A%2520%25
20%2520%2520if%2520(typeof(tcm_columns%255Bce
llInfo.col%255D.filter)%253D%253D%27string%27
)%250A%2520%2520%2520%2520%257B%2520%2520%250
A%2520%2520%2520%2520%2520%2520var%2520f%253B
%2520var%2520clazz%253B%250A%2520%2520%2520%2
520%2520%2520clazz%2520%253D%2520qx.Class.get
ByName(tcm_columns%255BcellInfo.col%255D.filt
er)%253B%250A%2520%2520%2520%2520%2520%2520f%
2520%253D%2520new%2520clazz()%253B%250A%2520%
2520%2520%2520%2520%2520cellWidget.setFilter(
f)%253B%250A%2520%2520%2520%2520%257D%250A%25
20%2520%2520%2520else%2520if%2520(typeof(tcm_
columns%255BcellInfo.col%255D.filter)!%253D%2
7undefined%27)%2520cellWidget.setFilter(tcm_c
olumns%255BcellInfo.col%255D.filter)%253B%250
A%2520%2520%257D%250A%2520%2520%257D%250A%257
D)%253B%250A%250Avar%2520model%2520%253D%2520
new%2520qx.ui.table.model.Simple()%253B%250Am
odel.setColumns(%255B%27col%25201%27%252C%252
0%27col%25202%27%255D)%253B%250Amodel.setData
(%255B%255B1%252C2%255D%252C%255B2%252C3%255D
%252C%255B3%252C4%255D%255D)%253B%250A%250Ava
r%2520table%2520%253D%2520new%2520qx.ui.table
.Table(model)%253B%250A%250Avar%2520tcm%2520%
253D%2520table.getTableColumnModel()%253B%250
A%250Avar%2520config%2520%253D%2520%255B%257B
filter%253A%27qx.ui.form.TextField%27%257D%25
2C%257B%257D%255D%250Atcm.setUserData(%27conf
ig%27%252Cconfig)%253B%250A%250Avar%2520hr%25
20%253D%2520new%2520myHeaderRenderer()%253B%2
50Atcm.setHeaderCellRenderer(0%252C%2520hr)%2
53B%250A%250Athis.getRoot().add(table%252C%25
7Bedge%253A40%257D)%253B%250A%250A%250A%250A%
250A%250A%250A%250A%250A%250A%250A%250A%250A%
22%7D 


Best,

BenoƮt.  
-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/problem-with-a-custom-headerCellRenderer-s-appearance-tp5558486p5558486.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to