* @see com.vaadin.terminal.Terminal.ErrorListener#terminalError(com.vaadin.terminal.Terminal.ErrorEvent)
*/
- @Override
public void terminalError(Terminal.ErrorEvent event) {
final Throwable t = event.getThrowable();
if (t instanceof SocketException) {
this.throwable = throwable;
}
- @Override
public Throwable getThrowable() {
return throwable;
}
*/
public Root getRootForRequest(WrappedRequest request)
throws RootRequiresMoreInformationException {
- System.out.println(" --- GET ROOT");
Root root = Root.getCurrent();
if (root != null) {
- System.out.println(" ----- HAS CURRENT " + root.getRootId());
return root;
}
Integer rootId = getRootId(request);
- System.out.println(" ----- ROOT ID FROM REQUEST " + rootId);
synchronized (this) {
BrowserDetails browserDetails = request.getBrowserDetails();
root = roots.get(rootId);
if (root == null && isRootPreserved()) {
- System.out.println(" ----- ROOT NOT FOUND, CHECK IF PRESERVED");
// Check for a known root
if (!retainOnRefreshRoots.isEmpty()) {
}
if (retainedRootId != null) {
- System.out.println(" ----- RETAINED ROOT ID "
- + retainedRootId);
-
rootId = retainedRootId;
root = roots.get(rootId);
}
}
if (root == null) {
- System.out.println(" ----- ROOT STILL NULL");
-
// Throws exception if root can not yet be created
root = getRoot(request);
- System.out.println(" ----- GET ROOT " + root.getRootId());
-
// Initialize some fields for a newly created root
if (root.getApplication() == null) {
root.setApplication(this);
}
root.setRootId(rootId.intValue());
roots.put(rootId, root);
- System.out.println(" ----- CREATED ROOT " + rootId);
}
}
Root.setCurrent(root);
if (!initedRoots.contains(rootId)) {
- System.out.println(" ----- INIT ROOT " + rootId);
-
boolean initRequiresBrowserDetails = isRootPreserved()
|| !root.getClass()
.isAnnotationPresent(EagerInit.class);
}
} // end synchronized block
- System.out.println(" ----- USING ROOT " + root.getRootId());
return root;
}
public Root getRootById(int rootId) {
return roots.get(rootId);
}
-
- public void removeRoot(int rootId) {
- System.out.println(" --- REMOVE ROOT ID " + rootId);
- System.out.println(" ----- EXISTS? " + roots.containsKey(rootId));
- roots.remove(rootId);
- }
}
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Position;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
private HandlerRegistration childStateChangeHandlerRegistration;
private final StateChangeHandler childStateChangeHandler = new StateChangeHandler() {
- @Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
// TODO Should use a more specific handler that only reacts to
// size changes
protected void init() {
super.init();
registerRpc(PageClientRpc.class, new PageClientRpc() {
- @Override
public void setTitle(String title) {
com.google.gwt.user.client.Window.setTitle(title);
}
});
}
- @Override
public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
ConnectorMap paintableMap = ConnectorMap.get(getConnection());
getWidget().rendering = true;
// to finish rendering this window in case this is a download
// (and window stays open).
Scheduler.get().scheduleDeferred(new Command() {
- @Override
public void execute() {
VRoot.goTo(url);
}
if (uidl.hasAttribute("focused")) {
// set focused component when render phase is finished
Scheduler.get().scheduleDeferred(new Command() {
- @Override
public void execute() {
ComponentConnector paintable = (ComponentConnector) uidl
.getPaintableAttribute("focused", getConnection());
root.add(getWidget());
- Window.addCloseHandler(new CloseHandler<Window>() {
- @Override
- public void onClose(CloseEvent<Window> event) {
- rpc.close();
- }
- });
-
if (applicationConnection.getConfiguration().isStandalone()) {
// set focus to iview element by default to listen possible keyboard
// shortcuts. For embedded applications this is unacceptable as we
};
- @Override
public void updateCaption(ComponentConnector component) {
// NOP The main view never draws caption for its layout
}
}
Scheduler.get().scheduleDeferred(new Command() {
- @Override
public void execute() {
componentConnector.getWidget().getElement().scrollIntoView();
}
public interface RootServerRpc extends ClickRpc, ServerRpc {
- public void close();
}
\ No newline at end of file
private Page page = new Page(this);
private RootServerRpc rpc = new RootServerRpc() {
- @Override
public void click(MouseEventDetails mouseDetails) {
fireEvent(new ClickEvent(Root.this, mouseDetails));
}
-
- @Override
- public void close() {
- System.out.println(" --- ROOT CLOSE RPC " + rootId);
- getApplication().removeRoot(rootId);
- }
};
/**
return this;
}
- @Override
public void replaceComponent(Component oldComponent, Component newComponent) {
throw new UnsupportedOperationException();
}
return application;
}
- @Override
public void paintContent(PaintTarget target) throws PaintException {
page.paintContent(target);
fireEvent(new ClickEvent(this, mouseDetails));
}
- @Override
@SuppressWarnings("unchecked")
public void changeVariables(Object source, Map<String, Object> variables) {
if (variables.containsKey(CLICK_EVENT_ID)) {
*
* @see com.vaadin.ui.ComponentContainer#getComponentIterator()
*/
- @Override
public Iterator<Component> getComponentIterator() {
// TODO could directly create some kind of combined iterator instead of
// creating a new ArrayList
*
* @see com.vaadin.ui.ComponentContainer#getComponentCount()
*/
- @Override
public int getComponentCount() {
return windows.size() + (getContent() == null ? 0 : 1);
}
return actionManager;
}
- @Override
public <T extends Action & com.vaadin.event.Action.Listener> void addAction(
T action) {
getActionManager().addAction(action);
}
- @Override
public <T extends Action & com.vaadin.event.Action.Listener> void removeAction(
T action) {
if (actionManager != null) {
}
}
- @Override
public void addActionHandler(Handler actionHandler) {
getActionManager().addActionHandler(actionHandler);
}
- @Override
public void removeActionHandler(Handler actionHandler) {
if (actionManager != null) {
actionManager.removeActionHandler(actionHandler);