Java Code Examples for com.google.gwt.core.client.Scheduler.ScheduledCommand

The following are top voted examples for showing how to use com.google.gwt.core.client.Scheduler.ScheduledCommand. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitime   File: TimeSelector.java   Source Code and License 8 votes vote down vote up
private TimeMenuItem(final int slot) {
	super(slot2time(slot, iStart == null || iStart.getValue() == null ? 0 : slot - iStart.getValue()),
		true,
		new ScheduledCommand() {
			@Override
			public void execute() {
				hideSuggestions();
				setValue(slot, true);
				iLastSelected = iText.getText();
				fireSuggestionEvent(slot);
			}
		}
	);
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSlot = slot;
}
 
Example 2
Project: empiria.player   File: EntriesController.java   Source Code and License 6 votes vote down vote up
public void loadEntry(String password, final int index, final boolean playSound) {
    final String path = dictionaryFilenameProvider.getFilePathForIndex(index);

    scheduler.scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            try {
                FileRequestCallback fileRequestCallback = dictionaryModuleFactory.createFileRequestCallback(index, playSound);

                FileRequest fileRequest = fileRequestProvider.get();
                fileRequest.setUrl(path);
                fileRequest.send(null, fileRequestCallback);
            } catch (FileRequestException exception) {
                logger.error(exception);
            }
        }
    });
}
 
Example 3
Project: OSWf-OSWorkflow-fork   File: ActorView.java   Source Code and License 6 votes vote down vote up
void focusInputField(final FormItem focusItem) {

        Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() {

            @Override
            public void execute() {
                // Reset the search field for next time
                focusItem.focusInItem();
            }

        });
        
        // DeferredCommand.addCommand(new Command() {
        //     public void execute() {
        //         // Reset the search field for next time
        //         focusItem.focusInItem();
        //     }
        // });
        
    }
 
Example 4
Project: OSWf-OSWorkflow-fork   File: InputsView.java   Source Code and License 6 votes vote down vote up
void focusInputField(final FormItem focusItem) {
    Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() {

        @Override
        public void execute() {
            // Reset the search field for next time
            focusItem.focusInItem();
        }

    });
    
    // DeferredCommand.addCommand(new Command() {
    //     public void execute() {
    //         // Reset the search field for next time
    //         focusItem.focusInItem();
    //     }
    // });
    
}
 
Example 5
Project: unitimes   File: CurriculaCourses.java   Source Code and License 6 votes vote down vote up
public void openNew() {
	setText(MESSAGES.dialogNewGroup());
	iGrOldName = null;
	iGrName.setText(String.valueOf((char)('A' + getGroups().size())));
	iGrType.setSelectedIndex(0);
	iGrAssign.setVisible(true);
	iGrDelete.setVisible(false);
	iGrUpdate.setVisible(false);
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iGrName.setFocus(true);
			iGrName.selectAll();
		}
	});
	center();
}
 
Example 6
Project: unitimes   File: TimeSelector.java   Source Code and License 6 votes vote down vote up
private TimeMenuItem(final int slot) {
	super(slot2time(slot, iStart == null || iStart.getValue() == null ? 0 : slot - iStart.getValue()),
		true,
		new ScheduledCommand() {
			@Override
			public void execute() {
				hideSuggestions();
				setValue(slot, true);
				iLastSelected = iText.getText();
				fireSuggestionEvent(slot);
			}
		}
	);
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSlot = slot;
}
 
Example 7
Project: unitimes   File: SessionDatesSelector.java   Source Code and License 6 votes vote down vote up
public SessionDatesSelector(AcademicSessionProvider session) {
	iAcademicSession = session;
	
	iPanel = new UniTimeWidget<DatesPanel>(new DatesPanel());
	
	initWidget(iPanel);
	
	iAcademicSession.addAcademicSessionChangeHandler(new AcademicSessionChangeHandler() {
		@Override
		public void onAcademicSessionChange(AcademicSessionChangeEvent event) {
			if (event.isChanged()) init(event.getNewAcademicSessionId());
		}
	});
	
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			init(iAcademicSession.getAcademicSessionId());
		}
	});
}
 
Example 8
Project: unitimes   File: UserAuthentication.java   Source Code and License 6 votes vote down vote up
public void authenticate() {
	if (!CONSTANTS.allowUserLogin()) {
		if (isAllowLookup())
			doLookup();
		else
			ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
		return;
	}
	AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
	iError.setVisible(false);
	iDialog.center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iUserName.selectAll();
			iUserName.setFocus(true);
		}
	});
}
 
Example 9
Project: WebConsole   File: WebConsole.java   Source Code and License 6 votes vote down vote up
public void onModuleLoad() {

        // Create Exception alert
		GWT.setUncaughtExceptionHandler(new
	      GWT.UncaughtExceptionHandler() {
	      public void onUncaughtException(Throwable e) {
	      	Throwable unwrapped = unwrap(e);
	      	LOG.log(Level.SEVERE, "Ex caught!", e);
	    }
		});
		
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {  
      public void execute() {  
        onModuleLoad2();  
      }  
    });
		
	}
 
Example 10
Project: gwt-oauth2   File: Auth.java   Source Code and License 6 votes vote down vote up
/**
 * Request an access token from an OAuth 2.0 provider.
 *
 * <p>
 * If it can be determined that the user has already granted access, and the
 * token has not yet expired, and that the token will not expire soon, the
 * existing token will be passed to the callback.
 * </p>
 *
 * <p>
 * Otherwise, a popup window will be displayed which may prompt the user to
 * grant access. If the user has already granted access the popup will
 * immediately close and the token will be passed to the callback. If access
 * hasn't been granted, the user will be prompted, and when they grant, the
 * token will be passed to the callback.
 * </p>
 *
 * @param req Request for authentication.
 * @param callback Callback to pass the token to when access has been granted.
 */
public void login(AuthRequest req, final Callback<String, Throwable> callback) {
  lastRequest = req;
  lastCallback = callback;

  String authUrl = req.toUrl(urlCodex) + "&redirect_uri=" + urlCodex.encode(oauthWindowUrl);

  // Try to look up the token we have stored.
  final TokenInfo info = getToken(req);
  if (info == null || info.expires == null || expiringSoon(info)) {
    // Token wasn't found, or doesn't have an expiration, or is expired or
    // expiring soon. Requesting access will refresh the token.
    doLogin(authUrl, callback);
  } else {
    // Token was found and is good, immediately execute the callback with the
    // access token.

    scheduler.scheduleDeferred(new ScheduledCommand() {
      @Override
      public void execute() {
        callback.onSuccess(info.accessToken);
      }
    });
  }
}
 
Example 11
Project: gwt-oauth2   File: AuthTest.java   Source Code and License 6 votes vote down vote up
/**
 * When the token is found in cookies and will not expire soon, neither popup
 * nor iframe is used, and the token is immediately passed to the callback.
 */
public void testLogin_notExpiringSoon() {
  AuthRequest req = new AuthRequest("url", "clientId").withScopes("scope");

  // Storing a token that does not expire soon (in exactly 10 minutes)
  TokenInfo info = new TokenInfo();
  info.accessToken = "notExpiringSoon";
  info.expires = String.valueOf(MockClock.now + 10 * 60 * 1000);
  auth.setToken(req, info);

  MockCallback callback = new MockCallback();
  auth.login(req, callback);

  // A deferred command will have been scheduled. Execute it.
  List<ScheduledCommand> deferred = ((StubScheduler) auth.scheduler).getScheduledCommands();
  assertEquals(1, deferred.size());
  deferred.get(0).execute();

  // The iframe was used and the popup wasn't.
  assertFalse(auth.loggedInViaPopup);

  // onSuccess() was called and onFailure() wasn't.
  assertEquals("notExpiringSoon", callback.token);
  assertNull(callback.failure);
}
 
Example 12
Project: x-cure-chat   File: MessagesStackNavigator.java   Source Code and License 6 votes vote down vote up
/**
 * Shows the last stack element in the scroll panel
 */
private void scrollToLastStackElement() {
	//Make it into the deferred command because the element might be shown later,
	//such as if this method is called before the forum section is selected
	if( messageStack.size() > 0 ) {
		final MessageStackElement element = messageStack.get( messageStack.size() - 1 );
		Scheduler.get().scheduleDeferred( new ScheduledCommand(){
			@Override
			public void execute() {
				//Ensure that the top stack element is visible in the stack
				if( element.isAttached() ) {
					scrollPanel.ensureVisible( element );
				}
			}
		});
	}
}
 
Example 13
Project: x-cure-chat   File: ForumBodyWidget.java   Source Code and License 6 votes vote down vote up
@Override
public void onAfterComponentIsAdded() {
	//Re-add the panel size, here we have to account for the
	//browsers because they do not render the first view correctly
	//if the person comes directly to the forum page
	BrowserDetect detect = BrowserDetect.getBrowserDetect();
	if( isFirstTime && ( detect.isChrome() || detect.isSafari() || detect.isFirefox() ) ) {
		//We do the update in the deferred command because only this way 
		//the browser does it after the rendering of the view is complete
		Scheduler.get().scheduleDeferred( new ScheduledCommand(){
			@Override
			public void execute() {
				updateUIElements();
			}
		});
		isFirstTime = false;
	}
}
 
Example 14
Project: x-cure-chat   File: RoomUserAccessDialogUI.java   Source Code and License 6 votes vote down vote up
/**
 * Enable/Disable dialog buttons and other elements
 */
private void setEnabledElements(final boolean enableLeft, final boolean enableRight, final boolean other ){
	Scheduler.get().scheduleDeferred( new ScheduledCommand(){
		public void execute(){
			setLeftEnabled( enableLeft );
			setRightEnabled( enableRight );
			
			//The other room access dialog elements
			isReadCheckBox.setEnabled( other );
			isWriteCheckBox.setEnabled( other && ( ! isSystemCheckBox.getValue() ) );
			isSystemCheckBox.setEnabled( other && ( ! isWriteCheckBox.getValue() ) );					
			//Enable the read all check box only if it is a system property
			isReadAllCheckBox.setEnabled( other && isSystemCheckBox.getValue() );
			//Enable the selection list only if the read all is checked  
			readAllDurationListBox.setEnabled( other && isReadAllCheckBox.getValue() );
		}
	});
}
 
Example 15
Project: x-cure-chat   File: CopyUrlInfoPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Allows to open a new popup with the url link
 * @param opener the widget from which we open this pop-up
 * @param url the url to be displayed
 */
public static void showPopup( final Widget opener, final String url ) {
	//Create the popup panel object
	final CopyUrlInfoPanel panel = new CopyUrlInfoPanel( true, true, url );
	//Do not do animation because otherwise Firefox will remove url text selection
	panel.setAnimationEnabled(false);
	//Show the pop-up panel at some proper position, in such a way that
	//it does not go outside the window area, also make the popup modal
	panel.setPopupPositionAndShow( panel.new InfoPopUpPositionCallback( opener ) );
	//Set the text in the text field to be selected, also add focus
	//Do it deferred in order to  make sure that the selectAll is
	//called after the pop-up is shown and visible
	Scheduler.get().scheduleDeferred( new ScheduledCommand(){
		@Override
		public void execute() {
			panel.urlTextBox.setFocus(true);
			panel.urlTextBox.selectAll();
		}
	});
}
 
Example 16
Project: x-cure-chat   File: SendChatMessagePanelUI.java   Source Code and License 6 votes vote down vote up
@Override
public void updateUIElements() {
	Scheduler.get().scheduleDeferred( new ScheduledCommand(){
		@Override
		public void execute() {
			//Adjust the width of the recipients panel, do it in a deferred
			//command just in case the element is not visible yet
			commonWidgets.addjustRecipientsScrollPanel();
		}
	});
	
	//Opera can not set the proper width for the message body wrapper. Therefore,
	//we first try to put the focus to the button and then to the text box
	if( BrowserDetect.getBrowserDetect().isOpera() ) {
		sendButton.setFocus(true);
	}
	//Propagate the call
	commonWidgets.updateUIElements();
}
 
Example 17
Project: teiid-webui   File: ExtendedTextBox.java   Source Code and License 6 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
	super.onBrowserEvent(event);

	switch (event.getTypeInt()) {
	case Event.ONKEYUP:
	case Event.ONPASTE:
	{
		// Scheduler needed so pasted data shows up in TextBox before we fire event
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
			@Override
			public void execute() {
				fireEvent(new TextChangeEvent());
			}
		});
		break;
	}
	default:
		// Do nothing
	}
}
 
Example 18
Project: teiid-webui   File: ExtendedTextArea.java   Source Code and License 6 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
	super.onBrowserEvent(event);

	switch (event.getTypeInt()) {
	case Event.ONKEYUP:
	case Event.ONPASTE:
	{
		// Scheduler needed so pasted data shows up in TextBox before we fire event
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
			@Override
			public void execute() {
				fireEvent(new TextChangeEvent());
			}
		});
		break;
	}
	default:
		// Do nothing
	}
}
 
Example 19
Project: gwt-oauth   File: Auth.java   Source Code and License 6 votes vote down vote up
/**
 * Request an access token from an OAuth 2.0 provider.
 *
 * <p>
 * If it can be determined that the user has already granted access, and the
 * token has not yet expired, and that the token will not expire soon, the
 * existing token will be passed to the callback.
 * </p>
 *
 * <p>
 * Otherwise, a popup window will be displayed which may prompt the user to
 * grant access. If the user has already granted access the popup will
 * immediately close and the token will be passed to the callback. If access
 * hasn't been granted, the user will be prompted, and when they grant, the
 * token will be passed to the callback.
 * </p>
 *
 * @param req Request for authentication.
 * @param callback Callback to pass the token to when access has been granted.
 */
public void login(AuthRequest req, final Callback<String, Throwable> callback) {
  lastRequest = req;
  lastCallback = callback;

  String authUrl = req.toUrl(urlCodex) + "&redirect_uri=" + urlCodex.encode(oauthWindowUrl);

  // Try to look up the token we have stored.
  final TokenInfo info = getToken(req);
  if (info == null || info.expires == null || expiringSoon(info)) {
    // Token wasn't found, or doesn't have an expiration, or is expired or
    // expiring soon. Requesting access will refresh the token.
    doLogin(authUrl, callback);
  } else {
    // Token was found and is good, immediately execute the callback with the
    // access token.

    scheduler.scheduleDeferred(new ScheduledCommand() {
      @Override
      public void execute() {
        callback.onSuccess(info.accessToken);
      }
    });
  }
}
 
Example 20
Project: forplay   File: HtmlGame.java   Source Code and License 6 votes vote down vote up
@Override
public final void onModuleLoad() {
  GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
    @Override
    public void onUncaughtException(Throwable e) {
      ForPlay.log().error("Uncaught Exception: ", e);
    }
  });

  // Need to do everything else in a deferred command, so that
  // the uncaught exception handler has taken effect
  Scheduler.get().scheduleDeferred(new ScheduledCommand() {

    @Override
    public void execute() {
      start();
    }

  });
}
 
Example 21
Project: che   File: AnimationUtils.java   Source Code and License 6 votes vote down vote up
/** Flashes an element to highlight that it has recently changed. */
public static void flash(final Element elem) {
  /*
   * If we interrupt a flash with another flash, we need to disable animations
   * so the initial background color takes effect immediately. Animations are
   * reenabled in animatePropertySet.
   */
  removeTransitions(elem.getStyle());

  elem.getStyle().setBackgroundColor("#f9edbe");

  // Give the start color a chance to take effect.
  Scheduler.get()
      .scheduleDeferred(
          new ScheduledCommand() {
            @Override
            public void execute() {
              animatePropertySet(elem, "background-color", "", ALERT_TRANSITION_DURATION);
            }
          });
}
 
Example 22
Project: proarc   File: DigitalObjectChildrenEditor.java   Source Code and License 6 votes vote down vote up
private void initOnEdit() {
//        LOG.info("initOnEdit");
        originChildren = null;
        lastClicked = null;
        updateReorderUi(false);
        attachListResultSet();
        // select first
        if (!childrenListGrid.getOriginalResultSet().isEmpty()) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    // defer the select as it is ignored after refresh in onDataArrived
                    selectChildFromHistory();
                }
            });
        }
    }
 
Example 23
Project: proarc   File: ImportBatchItemEditor.java   Source Code and License 6 votes vote down vote up
private void selectNextChildAndFocus(Record record) {
    int nextSelection = getNextSelection(record);
    if (nextSelection < 0) {
        return ;
    }
    final HandlerRegistration[] editorLoadHandler = new HandlerRegistration[1];
    editorLoadHandler[0] = childEditor.addEditorLoadHandler(new EditorLoadHandler() {

        @Override
        public void onEditorLoad(EditorLoadEvent evt) {
            editorLoadHandler[0].removeHandler();
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    childEditor.focus();
                }
            });
        }
    });
    batchItemGrid.selectSingleRecord(nextSelection);
    batchItemGrid.scrollToRow(nextSelection);
}
 
Example 24
Project: OpenTripPlanner-client-gwt   File: OpenLayersPlannerMapWidget.java   Source Code and License 6 votes vote down vote up
@Override
public void setBounds(Wgs84BoundsBean aBounds) {
	bounds = aBounds;
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			map.updateSize();
			Bounds extent = convertBounds(bounds);
			map.setMaxExtent(extent);
			map.setRestrictedExtent(extent);
			map.zoomToExtent(extent);
			// Zoom a bit inside as fitting bounds will be too large
			map.setCenter(map.getCenter(), map.getZoom() + 1);
		}
	});
}
 
Example 25
Project: vaadin-scrollable-panel   File: ScrollablePanelWidget.java   Source Code and License 6 votes vote down vote up
private void startTrigger() {
	if (this.executor == null) {
		this.executor = new VLazyExecutor(this.scrollEventDelayMillis, new ScheduledCommand() {
			@Override
			public void execute() {
				if (ScrollablePanelWidget.this.timedHandler != null
				        && ScrollablePanelWidget.this.currentScrollingPos != null
				        && (ScrollablePanelWidget.this.lastSentScrollPos == null || !ScrollablePanelWidget.this.currentScrollingPos
				                .equals(ScrollablePanelWidget.this.lastSentScrollPos))) {
					ScrollablePanelWidget.this.timedHandler.onScroll(ScrollablePanelWidget.this.currentScrollingPos);
					ScrollablePanelWidget.this.lastSentScrollPos = ScrollablePanelWidget.this.currentScrollingPos;
				}
			}
		});
	}
	this.executor.trigger();
}
 
Example 26
Project: gerrit   File: DiffScreen.java   Source Code and License 6 votes vote down vote up
private GutterClickHandler onGutterClick(CodeMirror cm) {
  return new GutterClickHandler() {
    @Override
    public void handle(
        CodeMirror instance, int line, String gutterClass, NativeEvent clickEvent) {
      if (Element.as(clickEvent.getEventTarget()).hasClassName(getLineNumberClassName())
          && clickEvent.getButton() == NativeEvent.BUTTON_LEFT
          && !clickEvent.getMetaKey()
          && !clickEvent.getAltKey()
          && !clickEvent.getCtrlKey()
          && !clickEvent.getShiftKey()) {
        cm.setCursor(Pos.create(line));
        Scheduler.get()
            .scheduleDeferred(
                new ScheduledCommand() {
                  @Override
                  public void execute() {
                    getCommentManager().newDraftOnGutterClick(cm, gutterClass, line + 1);
                  }
                });
      }
    }
  };
}
 
Example 27
Project: gerrit   File: OnEditEnabler.java   Source Code and License 6 votes vote down vote up
private void onTextBoxBase(TextBoxBase tb) {
  // The text appears to not get updated until the handlers complete.
  Scheduler.get()
      .scheduleDeferred(
          new ScheduledCommand() {
            @Override
            public void execute() {
              String orig = strings.get(tb);
              if (orig == null) {
                orig = "";
              }
              if (!orig.equals(tb.getText().trim())) {
                widget.setEnabled(true);
              }
            }
          });
}
 
Example 28
Project: umlet   File: MenuPopup.java   Source Code and License 6 votes vote down vote up
public MenuPopup(List<MenuPopupItem> items) {
	super(false, Type.MENU);
	MenuBar popupMenuBar = new MenuBar(true);

	for (final MenuPopupItem item : items) {
		popupMenuBar.addItem(new MenuItem(item.getText(), true, new ScheduledCommand() {
			@Override
			public void execute() {
				item.execute();
				hide();
			}
		}));
	}
	popupMenuBar.setVisible(true);
	add(popupMenuBar);
}
 
Example 29
Project: unitime   File: CurriculaCourses.java   Source Code and License 6 votes vote down vote up
public void openNew() {
	setText(MESSAGES.dialogNewGroup());
	iGrOldName = null;
	iGrName.setText(String.valueOf((char)('A' + getGroups().size())));
	iGrType.setSelectedIndex(0);
	iGrAssign.setVisible(true);
	iGrDelete.setVisible(false);
	iGrUpdate.setVisible(false);
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iGrName.setFocus(true);
			iGrName.selectAll();
		}
	});
	center();
}
 
Example 30
Project: unitime   File: UniTimeConfirmationDialog.java   Source Code and License 6 votes vote down vote up
@Override
public void center() {
	super.center();
	if (iMessage != null && !iMessage.isEmpty())
		AriaStatus.getInstance().setText(ARIA.dialogOpened(getText()) + " " + iMessage + (iNo == null ? "" : " " + ARIA.confirmationEnterToAcceptEscapeToReject()));
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			if (iTextBox != null) {
				iTextBox.setFocus(true);
				iTextBox.selectAll();
			} else {
				iYes.setFocus(true);
			}
		}
	});
}
 
Example 31
Project: unitime   File: SessionDatesSelector.java   Source Code and License 6 votes vote down vote up
public SessionDatesSelector(AcademicSessionProvider session) {
	iAcademicSession = session;
	
	iPanel = new UniTimeWidget<DatesPanel>(new DatesPanel());
	
	initWidget(iPanel);
	
	iAcademicSession.addAcademicSessionChangeHandler(new AcademicSessionChangeHandler() {
		@Override
		public void onAcademicSessionChange(AcademicSessionChangeEvent event) {
			if (event.isChanged()) init(event.getNewAcademicSessionId());
		}
	});
	
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			init(iAcademicSession.getAcademicSessionId());
		}
	});
}
 
Example 32
Project: unitime   File: UserAuthentication.java   Source Code and License 6 votes vote down vote up
public void authenticate() {
	if (!CONSTANTS.allowUserLogin()) {
		if (isAllowLookup())
			doLookup();
		else
			ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
		return;
	}
	AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
	iError.setVisible(false);
	iDialog.center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iUserName.selectAll();
			iUserName.setFocus(true);
		}
	});
}
 
Example 33
Project: blogwt   File: GalleryPlugin.java   Source Code and License 6 votes vote down vote up
@Override
public void emit (StringBuilder out, final List<String> lines,
		final Map<String, String> params) {
	final String id = HTMLPanel.createUniqueId();
	out.append("<div id=\"");
	out.append(id);
	out.append("\"> Loading gallery...</div>");

	Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		@Override
		public void execute () {
			if (manager != null) {
				manager.fireEvent(new PluginContentReadyEvent(
						GalleryPlugin.this, lines, params, id, "None"));
			}
		}
	});
}
 
Example 34
Project: blogwt   File: CachedIncludePlugin.java   Source Code and License 6 votes vote down vote up
@Override
protected void getContent (final String src, final String id,
		final List<String> lines, final Map<String, String> params)
		throws IOException {
	if (src != null && src.length() > 0) {
		if (ensureCache().containsKey(src)) {
			Scheduler.get().scheduleDeferred(new ScheduledCommand() {

				@Override
				public void execute () {
					CachedIncludePlugin.super.gotContent(null,
							ensureCache().get(src), src, id, lines, params);
				}
			});
		} else {
			super.getContent(src, id, lines, params);
		}
	}
}
 
Example 35
Project: platypus-js   File: ModelGrid.java   Source Code and License 6 votes vote down vote up
protected void enqueueServiceColumnsRedraw() {
	serviceColumnsRedrawQueued = true;
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		@Override
		public void execute() {
			if (serviceColumnsRedrawQueued) {
				serviceColumnsRedrawQueued = false;
				if (getDataColumnCount() > 0) {
					for (int i = 0; i < getDataColumnCount(); i++) {
						ModelColumn col = (ModelColumn) getDataColumn(i);
						if (col instanceof UsualServiceColumn) {
							if (i < frozenColumns) {
								frozenLeft.redrawAllRowsInColumn(i, dataProvider);
								scrollableLeft.redrawAllRowsInColumn(i, dataProvider);
							} else {
								frozenRight.redrawAllRowsInColumn(i - frozenColumns, dataProvider);
								scrollableRight.redrawAllRowsInColumn(i - frozenColumns, dataProvider);
							}
						}
					}
				}
			}
		}
	});
}
 
Example 36
Project: platypus-js   File: JsTree.java   Source Code and License 6 votes vote down vote up
protected void enqueueChanges() {
	changesQueued = new ScheduledCommand() {

           @Override
           public void execute() {
               if (changesQueued == this) {
                   changesQueued = null;
                   if (data != null) {
                       List<JavaScriptObject> items = new JsArrayList(data);
                       for (int i = 0; i < items.size(); i++) {
                           JavaScriptObject item = items.get(i);
                           changed(item);
                       }
                   }
               }
           }
       };
	Scheduler.get().scheduleDeferred(changesQueued);
}
 
Example 37
Project: platypus-js   File: JsTree.java   Source Code and License 6 votes vote down vote up
private void enqueueReadd() {
	readdQueued = new ScheduledCommand() {

           @Override
           public void execute() {
               if (readdQueued == this) {
                   readdQueued = null;
                   if (boundToDataElements != null) {
                       boundToDataElements.removeHandler();
                       boundToDataElements = null;
                   }
                   if (data != null) {
                       boundToDataElements = Utils.listenElements(data, new Utils.OnChangeHandler() {

                           @Override
                           public void onChange(JavaScriptObject anEvent) {
                               enqueueChanges();
                           }
                       });
                   }
                   everythingChanged();
               }
           }
       };
	Scheduler.get().scheduleDeferred(readdQueued);
}
 
Example 38
Project: platypus-js   File: ModelCombo.java   Source Code and License 6 votes vote down vote up
private void enqueueListReadd() {
    readdQueued = true;
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            if (readdQueued) {
                readdQueued = false;
                if (boundToListElements != null) {
                    boundToListElements.removeHandler();
                    boundToListElements = null;
                }
                if (displayList != null) {
                    boundToListElements = Utils.listenElements(displayList, new Utils.OnChangeHandler() {

                        @Override
                        public void onChange(JavaScriptObject anEvent) {
                            enqueueListChanges();
                        }
                    });
                }
                rebindList();
            }
        }
    });
}
 
Example 39
Project: ahome-touch   File: Component.java   Source Code and License 6 votes vote down vote up
public void hide() {

		hideRendered();
		if (!isRendered()) {
			initHidden = true;
			this.addEventHandler(TouchAttribute.RENDERED_CHANGE.getValue(), new Function() {

				public void execute() {
					Scheduler.get().scheduleDeferred(new ScheduledCommand() {

						public void execute() {
							hideRendered();
						}
					});
				}
			});
		}

	}
 
Example 40
Project: ahome-touch   File: Component.java   Source Code and License 6 votes vote down vote up
/**
 * Sets the value of docked.
 * 
 * @param dock
 */
public void setDocked(Dock dock) {
	setDocked(dock.getValue());
	/**
	 * TODO This is a work around for a Sencha Bug. Documented as issue #1 in github.
	 */
	if (dock == Dock.BOTTOM) {
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

			public void execute() {
				com.google.gwt.dom.client.Element parent = getElement().getParentElement();
				Element child = getElement();
				getElement().removeFromParent();
				parent.appendChild(child);
			}
		});
	}
}
 
Example 41
Project: bitcoin-transaction-explorer   File: ContextFieldSet.java   Source Code and License 6 votes vote down vote up
private void displayContextPopup(final Widget target, final Widget popupContent) {
  if (!popupPanel.isShowing()) {
    popupContent.getElement().getStyle().setVisibility(Visibility.HIDDEN);
  }

  popupPanel.setWidget(popupContent);
  popupPanel.show();
  attachRegistration = target.addAttachHandler(attachHandler);

  // Defer the attach event because we don't have the element's width/height at this point
  Scheduler.get().scheduleDeferred(new ScheduledCommand() {
    @Override
    public void execute() {
      popupPanel.attachToWidget(target);
      popupContent.getElement().getStyle().clearVisibility();
    }
  });
}
 
Example 42
Project: multipool-stats-backend   File: WaffleViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void addAddressStats(final String address, List<AddressStatsDTO> stats) {
	AddressChartPanel chart = new AddressChartPanel(address, false);
	chart.setAddressStats(stats);
	chart.setDisplaySummary(isSummaryDisplayed());
	chart.setDisplayBTCChart(isBTCChartDisplayed());
	chart.setDisplayPowerChart(isPowerChartDisplayed());
	chart.addPaidoutClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			List<String> addresses = new ArrayList<String>();
			addresses.add(address);
			presenter.loadPaidout(addresses);
		}
	});
	getAddressesContainer().add(chart, new VerticalLayoutData(1, -1, new Margins(5)));
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		public void execute() {
			forceResize();
		}
	});
	addressCharts.put(address, chart);
}
 
Example 43
Project: avro-ui   File: NumberBox.java   Source Code and License 6 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);
    switch (DOM.eventGetType(event)) {
        case Event.ONPASTE:
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                @Override
                public void execute() {
                    if (Utils.isNotBlank(promptText) && Utils.isBlank(NumberBox.super.getText())) {
                        setPrompts();
                    } else {
                        setText(renderer.render(getValue()));
                    }                    }
            });
            break;
    }
}
 
Example 44
Project: putnami-web-toolkit   File: AddressBookView.java   Source Code and License 6 votes vote down vote up
@UiHandler("searchBox")
void onSearchBox(KeyPressEvent event) {
	final InputText source = (InputText) event.getSource();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		@Override
		public void execute() {
			String query = source.flush();
			if (query == null || query.length() == 0) {
				displayList(displayedList);
			} else {
				final String queryToCompare = query.toLowerCase().trim();
				Iterable<Contact> filteredIteable = Iterables.filter(displayedList, new Predicate<Contact>() {

					@Override
					public boolean apply(Contact contact) {
						return contact.getName() != null && contact.getName().toLowerCase().contains(queryToCompare);
					}
				});
				displayList(Lists.newArrayList(filteredIteable));
			}
		}
	});
}
 
Example 45
Project: putnami-web-toolkit   File: NavSpy.java   Source Code and License 6 votes vote down vote up
NavWidget(NavWidget parentNav, final Element heading) {
	super(heading.getInnerHTML(), new ScheduledCommand() {
		@Override
		public void execute() {
			int top = NavSpy.this.getElementTop(heading) - NavSpy.this.spyOffset;
			if (NavSpy.this.isBodyScrollWidget()) {
				Window.scrollTo(Document.get().getScrollLeft(), top);
			} else {
				NavSpy.this.scrollWidget.getElement().setScrollTop(top);
			}
		}
	});

	this.parentNav = parentNav;
	this.level = NavSpy.this.getLevel(heading);
}
 
Example 46
Project: putnami-web-toolkit   File: DocumentationDisplay.java   Source Code and License 6 votes vote down vote up
public DocumentationDisplay() {
	this.initWidget(Binder.BINDER.createAndBindUi(this));

	Window.addResizeHandler(new ResizeHandler() {

		@Override
		public void onResize(ResizeEvent event) {
			DocumentationDisplay.this.redraw(false);
		}
	});

	Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		@Override
		public void execute() {
			DocumentationDisplay.this.redraw(true);
		}
	});
}
 
Example 47
Project: putnami-web-toolkit   File: AddressBookPage.java   Source Code and License 6 votes vote down vote up
@UiHandler("searchBox")
void onSearchBox(KeyPressEvent event) {
	final InputText source = (InputText) event.getSource();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		@Override
		public void execute() {
			String query = source.flush();
			if (query == null || query.length() == 0) {
				AddressBookPage.this.displayList(AddressBookPage.this.displayedList);
			} else {
				final String queryToCompare = query.toLowerCase().trim();
				Iterable<Contact> filteredIteable =
					Iterables.filter(AddressBookPage.this.displayedList, new Predicate<Contact>() {

						@Override
						public boolean apply(Contact contact) {
							return contact.getName() != null
								&& contact.getName().toLowerCase().contains(queryToCompare);
						}
					});
				AddressBookPage.this.displayList(Lists.newArrayList(filteredIteable));
			}
		}
	});
}
 
Example 48
Project: MultiPage   File: MultiPage.java   Source Code and License 6 votes vote down vote up
public void setPage(final Page p) {
  if (transition != null) {
    p.setStyleName(transition.initial(), true);
  }
  RootPanel.get().add(p, 0, 0);
  if (currentPage != null) {
    if (transition != null) {
      currentPage.setStyleName(transition.out(), true);
    }
    currentPage.remove(removeDelay);
    currentPage.onHide();
  }
  p.onShow();
  currentPage = p;
  if (transition != null) {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
      @Override
      public void execute() {
        p.setStyleName(transition.in(), true);
      }
    });
  }
}
 
Example 49
Project: activelink   File: ActiveLinkConnector.java   Source Code and License 6 votes vote down vote up
public void onClick(final ClickEvent event) {

		final MouseEventDetails mouseDetails = MouseEventDetailsBuilder
				.buildMouseEventDetails(event.getNativeEvent(), getWidget()
						.getElement());
		rpc.clicked(mouseDetails);

		if (!mouseDetails.isCtrlKey() && !mouseDetails.isAltKey()
				&& !mouseDetails.isShiftKey() && !mouseDetails.isMetaKey()) {
			// RPC gets lost if we don't delay
			event.preventDefault();
			Scheduler.get().scheduleDeferred(new ScheduledCommand() {
				public void execute() {
					getWidget().onClick(mouseDetails);
				}
			});
		}
	}
 
Example 50
Project: requestor   File: Auth.java   Source Code and License 6 votes vote down vote up
/**
 * Request an access token from an OAuth 2.0 provider.
 * <p/>
 * <p> If it can be determined that the user has already granted access, and the token has not yet expired, and that
 * the token will not expire soon, the existing token will be passed to the callback. </p>
 * <p/>
 * <p> Otherwise, a popup window will be displayed which may prompt the user to grant access. If the user has
 * already granted access the popup will immediately close and the token will be passed to the callback. If access
 * hasn't been granted, the user will be prompted, and when they grant, the token will be passed to the callback.
 * </p>
 *
 * @param req      Request for authentication.
 * @param callback Callback to pass the token to when access has been granted.
 */
public void login(AuthRequest req, final Callback<TokenInfo, Throwable> callback) {
    lastRequest = req;
    lastCallback = callback;

    String authUrl = req.toUrl(urlCodex) + "&redirect_uri=" + urlCodex.encode(oauthWindowUrl);

    // Try to look up the token we have stored.
    final TokenInfo info = getToken(req);
    if (info == null || info.getExpires() == null || expiringSoon(info)) {
        // Token wasn't found, or doesn't have an expiration, or is expired or
        // expiring soon. Requesting access will refresh the token.
        doLogin(authUrl, callback);
    } else {
        // Token was found and is good, immediately execute the callback with the
        // access token.

        scheduler.scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
                callback.onSuccess(info);
            }
        });
    }
}
 
Example 51
Project: requestor   File: AuthTest.java   Source Code and License 6 votes vote down vote up
/**
 * When the token is found in cookies and will not expire soon, neither popup
 * nor iframe is used, and the token is immediately passed to the callback.
 */
public void testLogin_notExpiringSoon() {
  AuthRequest req = new AuthRequest("url", "clientId").withScopes("scope");

  // Storing a token that does not expire soon (in exactly 10 minutes)
  TokenInfo info = new TokenInfo();
  info.setTokenType("type");
  info.setAccessToken("notExpiringSoon");
  info.setExpires(String.valueOf(MockClock.now + 10 * 60 * 1000));
  auth.setToken(req, info);

  MockCallback callback = new MockCallback();
  auth.login(req, callback);

  // A deferred command will have been scheduled. Execute it.
  List<ScheduledCommand> deferred = ((StubScheduler) auth.scheduler).getScheduledCommands();
  assertEquals(1, deferred.size());
  deferred.get(0).execute();

  // The iframe was used and the popup wasn't.
  assertFalse(auth.loggedInViaPopup);

  // onSuccess() was called and onFailure() wasn't.
  assertEquals("notExpiringSoon", callback.token.getAccessToken());
  assertNull(callback.failure);
}
 
Example 52
Project: empiria.player   File: PageSwitchAnimation.java   Source Code and License 5 votes vote down vote up
public void animatePageSwitch(
        final MultiPageController multiPageController,
        final float from, final float to,
        final NavigationButtonDirection direction,
        final int duration, final boolean onlyPositionReset) {
    if (Math.abs(from - to) > 1) {
        if (!onlyPositionReset) {
            windowDelegate.scrollTo(0, 0);
        }
        animation.get().removeAnimationEndCallback(animationCallback);
        animationCallback = new AnimationEndCallback() {
            @Override
            public void onComplate(int position) {
                scheduler.scheduleDeferred(new ScheduledCommand() {
                    @Override
                    public void execute() {
                        multiPageController.resetFocusAndStyles();
                        if (direction != null) {
                            multiPageController.invokeNavigationRequest(direction);
                        }
                        if (!onlyPositionReset) {
                            eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.PAGE_VIEW_LOADED));
                        }
                        multiPageController.setCurrentPosition(to);
                    }
                });
            }
        };
        animation.get().addAnimationEndCallback(animationCallback);
        FlowPanel target = multiPageController.getMainPanel();
        int width = multiPageController.getWidth();
        int xPosition = Math.round((to / width)) * width;
        animation.get().goTo(target, xPosition, duration);
    } else if (!onlyPositionReset) {
        eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.PAGE_VIEW_LOADED));
    }
}
 
Example 53
Project: rxgwt-tips   File: Tips.java   Source Code and License 5 votes vote down vote up
private void schedulers() {
    // GWT Schedulers, various callbacks, not easy to combine or specify timing operations like a timeout!
    gwtScheduler().scheduleDeferred((ScheduledCommand) () -> L.log("one time command done!"));
    gwtScheduler().scheduleIncremental((RepeatingCommand) () -> {L.log("repeating command done!"); return false;});
    // to use RX first just wrap the task in a RX type, for example a log call into a Completable
    Completable rxTask = Completable.fromAction(() -> L.log("one time command done!")); // by default synchronous
    // with RX you can specify in which scheduler do you want to execute the task
    rxTask.subscribeOn(GwtSchedulers.deferredScheduler()); // async using a deferred scheduler
    rxTask.subscribeOn(GwtSchedulers.incrementalScheduler()); // async using a incremental scheduler
    rxTask.subscribeOn(Schedulers.io()); // GWT agnostic, but yep, this is mapped to deferred
    rxTask.subscribeOn(Schedulers.computation()); // and this one to is mapped to incremental
    // remember that this is a chained description, so you should save the instance, like this
    rxTask.subscribeOn(Schedulers.io()).subscribe(() -> L.log("task executed async!"));

    // for repeating tasks like a timer
    new Timer() { public void run() { L.log("whOOt? inheritance instead of composition?!");} }.schedule(100);
    // you should generate stream of ticks, called 'interval' (timer exists, but just emmit 1 tick)
    interval(100, MILLISECONDS).flatMapCompletable(n -> rxTask);

    // and a final example, if the web is online (and stop if not) do a task each 5min
    online().switchMap(online -> online ? interval(5, MINUTES) : Observable.never())
            // fetching a big list of data, so big that need to be reduced incrementally to no block the
            // main loop, as our API is RX friendly, just observe each result item in the computation scheduler
            .flatMapSingle(refresh -> requestData().observeOn(computation())
                    // and reduce each item here, until the whole response is processed
                    .<Set<String>>reduceWith(HashSet::new, (acc,n) -> { acc.add(n); return acc; }))
            // at this point the response has been processed incrementally!
            .doOnNext(result -> GWT.log("save the processed result: " + result))
            // if something goes wrong, wait 1 minute and try again, the try will reconnect the whole observable
            // so if the web is offline, it will not try to process again until it get online!
            .retryWhen(at -> at.flatMapSingle(ex -> { GWT.log("updater error", ex); return timer(1, MINUTES); }))
            .subscribe(); // eventually we'll see that subscribe responsibility can be delegated! (safer!)
}
 
Example 54
Project: unitimes   File: AriaSuggestBox.java   Source Code and License 5 votes vote down vote up
private SuggestionMenuItem(final Suggestion suggestion) {
	super(suggestion.getDisplayString(), iOracle.isDisplayStringHTML(), new ScheduledCommand() {
		@Override
		public void execute() {
			iSuggestionCallback.onSuggestionSelected(suggestion);
		}
	});
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSuggestion = suggestion;
}
 
Example 55
Project: unitimes   File: Client.java   Source Code and License 5 votes vote down vote up
public void onModuleLoad() {
	GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
		@Override
		public void onUncaughtException(Throwable e) {
			Throwable u = ToolBox.unwrap(e);
			sLogger.log(Level.WARNING, MESSAGES.failedUncaughtException(u.getMessage()), u);
		}
	});
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			onModuleLoadDeferred();
		}
	});
}
 
Example 56
Project: unitimes   File: Client.java   Source Code and License 5 votes vote down vote up
public void onModuleLoadDeferred() {
	// register triggers
	GWT.runAsync(new RunAsyncCallback() {
		@Override
		public void onSuccess() {
			for (Triggers t: Triggers.values())
				t.register();
			callGwtOnLoadIfExists();
		}
		@Override
		public void onFailure(Throwable reason) {
		}
	});
	
	// load page
	if (RootPanel.get("UniTimeGWT:Body") != null) {
		LoadingWidget.getInstance().show(MESSAGES.waitLoadingPage());
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
			@Override
			public void execute() {
				initPageAsync(Window.Location.getParameter("page"));
			}
		});
	}
	
	// load components
	for (final Components c: Components.values()) {
		final RootPanel p = RootPanel.get(c.id());
		if (p != null) {
			Scheduler.get().scheduleDeferred(new ScheduledCommand() {
				@Override
				public void execute() {
					initComponentAsync(p, c);
				}
			});
		}
		if (p == null && c.isMultiple()) {
			NodeList<Element> x = getElementsByName(c.id());
			if (x != null && x.getLength() > 0)
				for (int i = 0; i < x.getLength(); i++) {
					Element e = x.getItem(i);
					e.setId(DOM.createUniqueId());
					final RootPanel q = RootPanel.get(e.getId());
					Scheduler.get().scheduleDeferred(new ScheduledCommand() {
						@Override
						public void execute() {
							initComponentAsync(q, c);
						}
					});
				}
		}
	}
	
	Window.addWindowClosingHandler(new Window.ClosingHandler() {
		@Override
		public void onWindowClosing(Window.ClosingEvent event) {
			if (isLoadingDisplayed() || LoadingWidget.getInstance().isShowing()) return;
			LoadingWidget.showLoading(MESSAGES.waitPlease());
			iPageLoadingTimer = new Timer() {
				@Override
				public void run() {
					RPC.execute(new IsSessionBusyRpcRequest(), new AsyncCallback<GwtRpcResponseBoolean>() {
						@Override
						public void onFailure(Throwable caught) {
							LoadingWidget.hideLoading();
						}
						@Override
						public void onSuccess(GwtRpcResponseBoolean result) {
							if (result.getValue()) {
								iPageLoadingTimer.schedule(500);
							} else {
								LoadingWidget.hideLoading();
							}
						}
					});
				}
			};
			iPageLoadingTimer.schedule(500);
		}
	});
}
 
Example 57
Project: unitimes   File: UniTimeConfirmationDialog.java   Source Code and License 5 votes vote down vote up
@Override
public void center() {
	super.center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			if (iTextBox != null) {
				iTextBox.setFocus(true);
				iTextBox.selectAll();
			} else {
				iYes.setFocus(true);
			}
		}
	});
}
 
Example 58
Project: unitimes   File: CourseFinderDialog.java   Source Code and License 5 votes vote down vote up
@Override
public void findCourse() {
	iFilter.setAriaLabel(isAllowFreeTime() ? ARIA.courseFinderFilterAllowsFreeTime() : ARIA.courseFinderFilter());
	AriaStatus.getInstance().setText(ARIA.courseFinderDialogOpened());
	if (iTabs != null)
		for (CourseFinderTab tab: iTabs)
			tab.changeTip();
	center();
	RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		public void execute() {
			iFilter.setFocus(true);
		}
	});
}
 
Example 59
Project: unitimes   File: FilterBox.java   Source Code and License 5 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
   	Element target = DOM.eventGetTarget(event);

    switch (DOM.eventGetType(event)) {
    case Event.ONMOUSEDOWN:
    	boolean open = iFilterOpen.getElement().equals(target);
    	boolean close = iFilterClose.getElement().equals(target);
    	boolean clear = iFilterClear.getElement().equals(target);
    	boolean filter = iFilter.getElement().equals(target);
    	if (isFilterPopupShowing() || close) {
    		hideFilterPopup();
    	} else if (open) {
    		hideSuggestions();
    		showFilterPopup();
    	}
    	if (clear) {
			iFilter.setText("");
			removeAllChips();
			setAriaLabel(toAriaString());
			ValueChangeEvent.fire(FilterBox.this, getValue());
    	}
    	if (!filter) {
			event.stopPropagation();
			event.preventDefault();
	    	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
				@Override
				public void execute() {
					iFilter.setFocus(true);
				}
			});
    	}
    	break;
    }
}
 
Example 60
Project: unitimes   File: Lookup.java   Source Code and License 5 votes vote down vote up
public void center() {
	super.center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iLastQuery = null;
			iQuery.setFocus(true);
			iQuery.selectAll();
			update();
		}
	});
}