PDA

View Full Version : Window - disable autorender



omeck
20 Jan 2009, 11:48 AM
Hi,
I'd like to know whether it's possible to disable Window component autorender when it's dragging? I want to embed last.fm radio plugin. It looks fine, but when I move window it's reloaded and player too :/

sven
20 Jan 2009, 12:03 PM
override startDrag and endDrag of Window to not create a dragging ghost.

omeck
20 Jan 2009, 1:04 PM
Thanks for reply! I'm GXT newbie and I have no idea how override startDrag and endDrag events - which object's methods should I use? I cannot also find solution at forum :/ Below is my code:


package net.omeck.homepage.client;

import com.extjs.gxt.ui.client.widget.ContentPanel;

public class LastFmWindow extends HomepageWindow {

private String playerCode = "too long to paste ;-)";

public LastFmWindow() {
setSize(194, 211);
setHeading(constants.projects());
setIconStyle("lastfm-icon");
setHeading("Last.fm radio");

ContentPanel p = new ContentPanel();
p.setStyleName("lastfm-player");
p.setHeaderVisible(false);
p.addText(playerCode);

// how to override above events?

add(p);
}
}

omeck
21 Jan 2009, 11:01 AM
I try to get access startDrag and endDrag methods, but no results :/ Following code I placed in my app entry point, and lastfmWindow is an instance of Window class.


Draggable d = new Draggable(lastfmWindow);
d.addDragListener(new DragListener() {
@Override
public void dragStart(DragEvent de) {
// TODO Auto-generated method stub
Info.display("Info", "start");
super.dragStart(de);
}

@Override
public void dragEnd(DragEvent de) {
// TODO Auto-generated method stub
Info.display("Info", "end");
super.dragEnd(de);
}
});

EagleEye666666
21 Jan 2009, 11:47 AM
I try to get access startDrag and endDrag methods, but no results :/ Following code I placed in my app entry point, and lastfmWindow is an instance of Window class.

because this is adds the window to a listener and not overwrites the methods of the window...


public class LastFmWindow extends HomepageWindow {

private String playerCode = "too long to paste ;-)";

public LastFmWindow() {
setSize(194, 211);
setHeading(constants.projects());
setIconStyle("lastfm-icon");
setHeading("Last.fm radio");

ContentPanel p = new ContentPanel();
p.setStyleName("lastfm-player");
p.setHeaderVisible(false);
p.addText(playerCode);

// how to override above events?

add(p);
}
@Override
public void dragStart(DragEvent de) {
// TODO Auto-generated method stub
Info.display("Info", "start");
//super.dragStart(de); this u should not invoke cuz it will invoke the rerender what u want to avoid.....
}

@Override
public void dragEnd(DragEvent de) {
// TODO Auto-generated method stub
Info.display("Info", "end");
// super.dragEnd(de); the same like above
}

}

btw. this is basic java understanding this has nothing to do with GXT neither GWT.
I really recommend you to learn java basics.

and than check the source code there u can find everything. Implementation of these Methods of Window (i dont know, but i have doubts that overwriting them is a good idea... neither i have a clue what the impl is doing :D):


protected void endDrag(DragEvent de) {
unghost(de);
restorePos = getPosition(true);
positioned = true;
if (layer != null) {
layer.enableShadow(getShadow());
}
focus();
}

protected void startDrag(DragEvent de) {
WindowManager.get().bringToFront(this);
if (layer != null) {
layer.hideShadow();
}
ghost = ghost();
ghost.setVisible(true);
showWindow(false);
Draggable d = de.draggable;
d.setProxy(ghost.dom);
}

regards

omeck
21 Jan 2009, 12:17 PM
Thank You for a reply that solved my problem =]


btw. this is basic java understanding this has nothing to do with GXT neither GWT.
I really recommend you to learn java basics.

I'm new in GXT and I thought that I need to configure Draggable listener for a Window instance :"> And I realy know what polymorphism is ;) Thanks again!

EagleEye666666
22 Jan 2009, 1:58 AM
I'm new in GXT and I thought that I need to configure Draggable listener for a Window instance :"> And I realy know what polymorphism is ;) Thanks again!
hehe ok. like this you can create your own widgets (with ur functionalities) based on the GXT ones, but i guess it is clear :) have fun!