// close button
if ((style & Style.CLOSE) != 0) {
closeBtn = new IconButton("my-tool-close");
closeBtn.addStyleName("my-tool");
closeBtn.addListener(Events.Click, new Listener() {
public void handleEvent(BaseEvent be) {
close();
}
});
header.addButton(closeBtn);
closeBtn.removeStyleName("my-tool");
}
if ((style & Style.AUTO_HIDE) != 0) {
autoHidePreview = new EventPreview() {
public boolean onEventPreview(Event event) {
Element target = DOM.eventGetTarget(event);
if (DOM.isOrHasChild(getElement(), target)) {
return true;
}
if (DOM.eventGetType(event) == Event.ONCLICK) {
close();
}
return false;
}
};
}
// resizable
if ((style & Style.RESIZE) != 0) {
resizer = new Resizable(this);
resizer.minWidth = 200;
resizer.minHeight = 100;
}
if ((style & Style.MODAL) != 0) {
modal = new ModalPanel();
}
dragListener = new Listener() {
public void handleEvent(BaseEvent be) {
switch (be.type) {
case Events.DragStart:
if (shadow != null) {
shadow.setVisible(false);