com.google.gwt.user.client.Command类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中com.google.gwt.user.client.Command类的一些代码示例,展示了Command类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Command类的具体详情如下:
包路径:com.google.gwt.user.client.Command
类名称:Command

Command介绍

[英]Encapsulates an action for later execution, often from a different context.

The Command interface provides a layer of separation between the code specifying some behavior and the code invoking that behavior. This separation aids in creating reusable code. For example, a com.google.gwt.user.client.ui.MenuItem can have a Command associated with it that it executes when the menu item is chosen by the user. Importantly, the code that constructed the Command to be executed when the menu item is invoked knows nothing about the internals of the MenuItem class and vice-versa.

The Command interface is often implemented with an anonymous inner class. For example,

Command sayHello = new Command() { 
public void execute() { 
Window.alert("Hello"); 
} 
}; 
sayHello.execute();

This type extends ScheduledCommand to help migrate from DeferredCommand API.
[中]封装操作以供以后执行,通常来自不同的上下文。
命令接口在指定某些行为的代码和调用该行为的代码之间提供了一层分隔。这种分离有助于创建可重用代码。例如,一个com。谷歌。gwt。使用者客户用户界面。MenuItem可以有一个与之关联的命令,当用户选择菜单项时,它将执行该命令。重要的是,构造要在调用菜单项时执行的命令的代码对MenuItem类的内部内容一无所知,反之亦然。
命令接口通常由匿名内部类实现。例如

Command sayHello = new Command() { 
public void execute() { 
Window.alert("Hello"); 
} 
}; 
sayHello.execute();

此类型扩展ScheduledCommand以帮助从DeferredCommand API迁移。

代码示例

代码示例来源:origin: kiegroup/appformer

public void onWindowClose(final Command command) {
    if (command != null) {
      command.execute();
    }
  }
}

代码示例来源:origin: jbossas/console

public void execute() {
 if (command != null) {
  command.execute();
 }
}

代码示例来源:origin: org.kie.guvnor/guvnor-guided-rule-editor-client

private void executeOnChangeCommand() {
  if ( this.onChangeCommand != null ) {
    this.onChangeCommand.execute();
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-guided-rule-editor-client

private void executeOnModifiedCommands() {
  for ( Command command : onModifiedCommands ) {
    command.execute();
  }
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-common-ui

private void executeCallback(final Command callback) {
  if (callback == null) {
    return;
  }
  callback.execute();
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

@Override
  public void onResponseHandlingEnded(ApplicationConnection.ResponseHandlingEndedEvent e) {
    isResponseProcessingInProgress = false;
    if (pendingAppZoomCommand != null) {
      pendingAppZoomCommand.execute();
      pendingAppZoomCommand = null;
    }
  }
};

代码示例来源:origin: org.kie.guvnor/guvnor-commons-ui

private void executeCallback( final Command callback ) {
  if ( callback == null ) {
    return;
  }
  callback.execute();
}

代码示例来源:origin: org.kie.guvnor/guvnor-commons-ui

private void executePostSaveCommand() {
  if (postSaveCommand != null) {
    postSaveCommand.execute();
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

private void executeOnValueChangeCommand() {
  if (this.onValueChangeCommand != null) {
    this.onValueChangeCommand.execute();
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

private void executeOnModifiedCommands() {
  for (Command command : onModifiedCommands) {
    command.execute();
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

private void executeOnChangeCommand() {
  if (this.onChangeCommand != null) {
    this.onChangeCommand.execute();
  }
}

代码示例来源:origin: ArcBees/GWTP

public void pump() {
    while (!commands.isEmpty()) {
      commands.remove(0).execute();
    }
  }
}

代码示例来源:origin: org.jresearch.commons.gxt.crud/org.jresearch.commons.gxt.crud.widget

/**
 * Checks the delete preconditions and return some error/warning message if
 * delete impossible
 *
 * @param model
 *            - object to check
 */
protected void checkDeleteContions(@Nonnull final M model, @Nonnull final Command command) {
  command.execute();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

command.execute();
} else if (element instanceof IncrementalCommand) {
 IncrementalCommand incrementalCommand = (IncrementalCommand) element;

代码示例来源:origin: org.uberfire/widgets-commons

public void execute() {
    if ( Window.confirm( "constants.DeleteAreYouSure()" ) ) {
      deleteCommand.execute();
    }
  }
} );

代码示例来源:origin: com.googlecode.gwt-measure/gwt-measure

public static void onUnload() {
  detachOnUnloadHook();
  if (command != null) {
    command.execute();
  }
}

代码示例来源:origin: kiegroup/appformer

private void cleanupPlaceRequest() {
  if (shouldICleanupPlaceRequest()) {
    cleanupPlaceRequest.execute();
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-commons-ui

@UiHandler("okButton")
  public void onOKButtonClick( final ClickEvent e ) {
    okCommand.execute();
  }
}

代码示例来源:origin: org.uberfire/uberfire-runtime-plugins-client

private void cleanupPlaceRequest() {
  if (shouldICleanupPlaceRequest()) {
    cleanupPlaceRequest.execute();
  }
}

代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-bs2

@Override
public void onComplete() {
  super.onComplete();
  onCompleteCommand.execute();
}

相关文章

Command类方法