當前位置: 首頁>>代碼示例>>Java>>正文


Java ScheduledCommand類代碼示例

本文整理匯總了Java中com.google.gwt.core.client.Scheduler.ScheduledCommand的典型用法代碼示例。如果您正苦於以下問題:Java ScheduledCommand類的具體用法?Java ScheduledCommand怎麽用?Java ScheduledCommand使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScheduledCommand類屬於com.google.gwt.core.client.Scheduler包,在下文中一共展示了ScheduledCommand類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TimeMenuItem

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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;
}
 
開發者ID:UniTime,項目名稱:unitime,代碼行數:18,代碼來源:TimeSelector.java

示例2: loadEntry

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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);
            }
        }
    });
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:20,代碼來源:EntriesController.java

示例3: focusInputField

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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();
        //     }
        // });
        
    }
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:21,代碼來源:ActorView.java

示例4: focusInputField

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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();
    //     }
    // });
    
}
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:20,代碼來源:InputsView.java

示例5: openNew

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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();
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:CurriculaCourses.java

示例6: SessionDatesSelector

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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());
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:22,代碼來源:SessionDatesSelector.java

示例7: authenticate

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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);
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:UserAuthentication.java

示例8: onModuleLoad

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
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();  
      }  
    });
		
	}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:19,代碼來源:WebConsole.java

示例9: login

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
/**
 * 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);
      }
    });
  }
}
 
開發者ID:chetsmartboy,項目名稱:gwt-oauth2,代碼行數:45,代碼來源:Auth.java

示例10: testLogin_notExpiringSoon

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:chetsmartboy,項目名稱:gwt-oauth2,代碼行數:29,代碼來源:AuthTest.java

示例11: scrollToLastStackElement

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
/**
 * 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 );
				}
			}
		});
	}
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:20,代碼來源:MessagesStackNavigator.java

示例12: onAfterComponentIsAdded

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:19,代碼來源:ForumBodyWidget.java

示例13: setEnabledElements

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
/**
 * 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() );
		}
	});
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:21,代碼來源:RoomUserAccessDialogUI.java

示例14: showPopup

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
/**
 * 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();
		}
	});
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:25,代碼來源:CopyUrlInfoPanel.java

示例15: updateUIElements

import com.google.gwt.core.client.Scheduler.ScheduledCommand; //導入依賴的package包/類
@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();
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:20,代碼來源:SendChatMessagePanelUI.java


注:本文中的com.google.gwt.core.client.Scheduler.ScheduledCommand類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。