private WidgetFactory widgetFactory = new DefaultWidgetFactory();
private IContextMenu contextMenu = null;
+
+ private IView view = new IView();
/**
* This is the entry point method.
makeUidlRequest("repaintAll=1");
+ // TODO remove hardcoded id name
+ RootPanel.get("itmtk-ajax-window").add(view);
+
}
private native boolean isDebugMode() /*-{
+ uidl.getId() + ") registered yet.");
if(uidl.getId().equals("PID0")) {
// view
- IView view = new IView();
view.updateFromUIDL(uidl, this);
- // TODO remove hardcoded id name
- RootPanel.get("itmtk-ajax-window").add(view);
} else {
Widget window = widgetFactory.createWidget(uidl);
registerPaintable(uidl.getId(), (Paintable) window);
package com.itmill.toolkit.terminal.gwt.client.ui;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
private Paintable layout;
+ private HashSet subWindows = new HashSet();
+
+
+
public String getTheme() {
return theme;
}
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ clear();
theme = uidl.getStringAttribute("theme");
com.google.gwt.user.client.Window.setTitle(uidl.getStringAttribute("caption"));
UIDL childUidl = uidl.getChildUIDL(0);
setWidget((Widget) lo);
}
lo.updateFromUIDL(childUidl, client);
+
+ int i=1;
+ HashSet removedSubWindows = new HashSet(subWindows);
+ while ((childUidl = uidl.getChildUIDL(i++)) != null) {
+ if ("window".equals(childUidl.getTag())) {
+ Widget w = client.getWidget(childUidl);
+ if (subWindows.contains(w)) {
+ removedSubWindows.remove(w);
+ client.registerPaintable(childUidl.getId(), (Paintable)w);
+ } else {
+ subWindows.add(w);
+ RootPanel.get().add(w);
+ }
+ ((Paintable)w).updateFromUIDL(childUidl, client);
+ }
+ }
+ for (Iterator rem=removedSubWindows.iterator(); rem.hasNext();) {
+ IWindow w = (IWindow) rem.next();
+ client.unregisterPaintable(w);
+ subWindows.remove(w);
+ RootPanel.get().remove(w);
+ }
}
}
package com.itmill.toolkit.terminal.gwt.client.ui;
+import java.util.HashSet;
+
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
private int origW;
private int origH;
-
+
public IWindow() {
super();
setStyleName(CLASSNAME);
setCaption(uidl.getStringAttribute("caption"));
}
lo.updateFromUIDL(childUidl, client);
+
}
public void setCaption(String c) {