Closed GoogleCodeExporter closed 8 years ago
Added a new Interface that implementors should implement the onClick event.
This
event does pass the necessary information to the Tool.
The new interface is ToolHandler and the signature of the onclick event is:
public void onClick(EventObject e, ExtElement toolEl, Panel panel);
With this, now the you can change the icon and toggle it as it is the case of
pin/unpin.
Here is an example of how to change the pin/unpin icon when using ToolHandler:
public class myToolHandler implements ToolHandler{
boolean pin = false;
ExtElement ele = null;
public void setElement(){
EventManager.addListener(ele.getDOM(), "mouseover", new EventCallback(){
public void execute(EventObject e) {
if(pin){
ele.removeClass("x-tool-unpin-over");
ele.addClassOnOver("x-tool-pin-over");
}else{
ele.removeClass("x-tool-pin-over");
ele.addClassOnOver("x-tool-unpin-over");
}
}
}, new ListenerConfig(){
{
setStopEvent(true);
}
});
}
public void onClick(EventObject e, ExtElement toolEl, Panel panel) {
if(pin){
Ext.fly(toolEl.getDOM()).replaceClass("x-tool x-tool-pin", "x-tool x-tool-
unpin");
}else{
Ext.fly(toolEl.getDOM()).replaceClass("x-tool x-tool-unpin", "x-tool x-tool-
pin");
}
pin = !pin;
if(ele == null){
ele = toolEl;
setElement();
}
}
}
The above works well... Except in IE when the icon is PIN and you hover on it,
it
shows as UNPIN. Could not figure out why!
Original comment by mlim1...@gmail.com
on 8 Sep 2008 at 7:44
"The above works well... Except in IE when the icon is PIN and you hover on it,
it
shows as UNPIN. Could not figure out why!"
Anyone know the fix for this? I get the same result in Chrome.
Original comment by menschfe...@gmail.com
on 2 Feb 2009 at 4:15
FYI - I was able to fix the hover issue by changing:
EventManager.addListener(ele.getDOM(), "mouseover", new EventCallback()
to:
EventManager.addListener(ele.getDOM(), "mouseenter", new EventCallback()
Original comment by stylina...@gmail.com
on 29 Jun 2010 at 6:38
Original issue reported on code.google.com by
mlim1...@gmail.com
on 8 Sep 2008 at 7:38