Java 类com.google.gwt.user.client.Command 实例源码

项目:empiria.player    文件:BookmarkProcessorExtension.java   
private Command createClickCommand(final IBookmarkable accModule) {
    return new Command() {
        @Override
        public void execute() {
            if (mode == Mode.BOOKMARKING) {
                bookmarkModule(accModule);
                resetMode();
            }
            if (mode == Mode.CLEARING) {
                if (isModuleBookmarked(accModule, currItemIndex)) {
                    bookmarkModule(accModule, false);
                    resetMode();
                }
            } else if (mode == Mode.EDITING) {
                if (isModuleBookmarked(accModule, currItemIndex)) {
                    editBookmark(accModule);
                    resetMode();
                }
            }
        }
    };
}
项目:EasyML    文件:DiagramController.java   
/**
 * Show the context menu of the mouse position.(Position from mouse down event)
 * 
 * @param event  mouse down event.
 */
public void showContextualMenu(MouseDownEvent event){
    final int X = event.getRelativeX(widgetPanel.getElement());
    final int Y = event.getRelativeY(widgetPanel.getElement());
    getMousePoint().setLeft(X);
    getMousePoint().setTop(Y);

    final int offsetX = event.getClientX();
    final int offsetY = event.getClientY();
    mouseOffsetPoint.setLeft(offsetX);
    mouseOffsetPoint.setTop(offsetY);

    cmenu.hide();
    cmenu = new ContextMenu();
    Command command = new Command() {
        @Override
        public void execute() {
            cmenu.hide();
        }
    };
}
项目:EasyML    文件:ProgramUpdateMenu.java   
public static MenuItem create(final ProgramLeaf node, final ProgramTree tree) {

        Command command = new MenuItemCommand(node) {

            @Override
            public void execute() {
                UpdateProgramPanel panel = new UpdateProgramPanel(tree,node);
                panel.show(node.getModule());
                this.component.getContextMenu().hide();
            }

        };

        MenuItem item = new MenuItem("Update", command);
        return item;
    }
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create DeleteItem
 * @param com
 * @return delete item
 */
public static MenuItem createDeleteItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            BaseWidget widget = (BaseWidget) this.component;
            DiagramController controller = widget.getController();
            controller.deleteWidget(widget);
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Delete", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create PremeterItem
 * @param com
 * @return PremeterItem
 */
public static MenuItem createPremeterItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            ProgramWidget widget = (ProgramWidget) this.component;
            widget.getParameterPanel();
            widget.setETLPanel();
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Configure parameters", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create DownloadDataItem
 * @param com
 * @return DownloadDataItem
 */
public static MenuItem createDownloadData(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {

            DatasetWidget widget = (DatasetWidget) this.component;
            widget.getContextMenu().hide();
            OutNodeShape shape = widget.getOutNodeShapes().get(0);
            String filename = shape.getAbsolutePath() + "/" + shape.getFileId();
            String url = GWT.getModuleBaseURL().split("EMLStudio")[0]
                    + "EMLStudioMonitor/filedownload?filename=" + filename;
            Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");

        }

    };

    MenuItem item = new MenuItem("Download", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create StderrItem
 * @param com
 * @return StderrItem
 */
public static MenuItem createStderrItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            ProgramWidget widget = (ProgramWidget) this.component;
            MonitorController controller = (MonitorController) widget
                    .getController();
            String oozJobId = widget.getAction().getJobId();
            String actionid = widget.getId();
            controller.getStdErr(oozJobId, actionid);
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Show Stderr", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create StdoutItem
 * @param com
 * @return StdoutItem
 */
public static MenuItem createStdoutItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            ProgramWidget widget = (ProgramWidget) this.component;
            MonitorController controller = (MonitorController) widget
                    .getController();
            String oozJobId = widget.getAction().getJobId();
            String actionid = widget.getId();
            controller.getStdOut(oozJobId, actionid);
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Show Stdout", command);
    return item;
}
项目:EasyML    文件:BaseShapeMenuItemFactory.java   
/**
 * Create result preview popup menuitem
 * 
 * @param com
 * @return
 */
public static MenuItem createShowResultItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {
        @Override
        public void execute() {
            NodeShape nodeShape = (NodeShape) this.component;
            //If the shape node is output node shape
            if(nodeShape instanceof OutNodeShape) {
                OutNodeShape outShape  = (OutNodeShape) nodeShape;
                String fileId = outShape.getFileId();
                String path = outShape.getAbsolutePath();
                DBController.showPreviewPopup(path,fileId);
            }
            nodeShape.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Results preview", command);
    return item;
}
项目:EasyML    文件:BaseShapeMenuItemFactory.java   
/**
 * Create data visualization popup menuitem
 * 
 * @param com
 * @return
 */
public static MenuItem createVisuallizeItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {
        @Override
        public void execute() {
            NodeShape nodeShape = (NodeShape) this.component;
            // If the node shape is output node shape
            if(nodeShape instanceof OutNodeShape) {
                OutNodeShape outShape  = (OutNodeShape) nodeShape;
                String fileId = outShape.getFileId();
                String path = outShape.getAbsolutePath();
                String fPath = path +"/"+fileId;
                DBController.showDataVisualPopup(fPath,fileId);
            }
            nodeShape.getContextMenu().hide();
        }
    };
    MenuItem item = new MenuItem("Visualization", command);
    return item;
}
项目:unitimes    文件:FilterBox.java   
private SuggestionMenuItem(final Suggestion suggestion) {
    super(suggestion.getDisplayString() == null
            ? suggestion.getChip().getLabel() + " <span class='item-command'>" + suggestion.getChip().getTranslatedCommand() + "</span>"
            : SafeHtmlUtils.htmlEscape(suggestion.getDisplayString()) + (suggestion.getHint() == null ? "" : " " + suggestion.getHint()),
        true,
        new Command() {
            @Override
            public void execute() {
                hideSuggestions();
                setStatus(ARIA.suggestionSelected(suggestion.toAriaString(FilterBox.this)));
                applySuggestion(suggestion);
                iLastValue = getValue();
                setAriaLabel(toAriaString());
                fireSelectionEvent(suggestion);
                ValueChangeEvent.fire(FilterBox.this, getValue());
            }
        });
    setStyleName("item");
    getElement().setAttribute("whiteSpace", "nowrap");
    iSuggestion = suggestion;
}
项目:unitimes    文件:EventRoomAvailability.java   
private EventFilterRpcRequest getEventsRequest() {
    EventFilterRpcRequest request = new EventFilterRpcRequest();
    request.setSessionId(iSession.getAcademicSessionId());
    request.setCommand(FilterRpcRequest.Command.ENUMERATE);
    iSelectedTimes = iTimes.getValue();
    if (iSelectedTimes.getStart() != null) {
        int startHour = Math.max(0, (iSelectedTimes.getStart() - 6) / 12);
        request.setOption("after", TimeUtils.slot2time(12 * startHour));
    }
    if (iSelectedTimes.getEnd() != null) {
        int endHour = Math.min(24, (17 + iSelectedTimes.getEnd()) / 12);
        request.setOption("before", TimeUtils.slot2time(12 * endHour));
    }
    iSelectedDates = iDates.getSelectedDays(); 
    for (Integer date: iSelectedDates) {
        request.addOption("dates", date.toString());
    }
    return request;     
}
项目:appinventor-extensions    文件:GenerateYailCommand.java   
@Override
protected void execute(final ProjectNode node) {
  Ode.getInstance().getEditorManager().generateYailForBlocksEditors(
      new Command() {
        @Override
        public void execute() {
          executeNextCommand(node);
        }
      },
      new Command() {
        @Override
        public void execute() {
          executionFailedOrCanceled();
        }
      });
}
项目:appinventor-extensions    文件:ProjectToolbar.java   
@Override
public void execute() {
  Ode.getInstance().getEditorManager().saveDirtyEditors(new Command() {
    @Override
    public void execute() {
      List<Project> selectedProjects =
          ProjectListBox.getProjectListBox().getProjectList().getSelectedProjects();
      if (selectedProjects.size() > 0) {
        // Show one confirmation window for selected projects.
        if (deleteConfirmation(selectedProjects)) {
          for (Project project : selectedProjects) {
            deleteProject(project);
          }
        }
      } else {
        // The user can select a project to resolve the
        // error.
        ErrorReporter.reportInfo(MESSAGES.noProjectSelectedForDelete());
      }
    }
  });
}
项目:appinventor-extensions    文件:TopToolbar.java   
@Override
    public void execute() {
      ProjectRootNode projectRootNode = Ode.getInstance().getCurrentYoungAndroidProjectRootNode();
      if (projectRootNode != null) {
        String target = YoungAndroidProjectNode.YOUNG_ANDROID_TARGET_ANDROID;
        ChainableCommand cmd = new SaveAllEditorsCommand(
            new GenerateYailCommand(
                new BuildCommand(target,
                    new ShowProgressBarCommand(target,
                        new WaitForBuildResultCommand(target,
                            new ShowBarcodeCommand(target)), "BarcodeAction"))));
//        updateBuildButton(true);
        cmd.startExecuteChain(Tracking.PROJECT_ACTION_BUILD_BARCODE_YA, projectRootNode,
            new Command() {
              @Override
              public void execute() {
//                updateBuildButton(false);
              }
            });
      }
    }
项目:appinventor-extensions    文件:TopToolbar.java   
@Override
    public void execute() {
      ProjectRootNode projectRootNode = Ode.getInstance().getCurrentYoungAndroidProjectRootNode();
      if (projectRootNode != null) {
        String target = YoungAndroidProjectNode.YOUNG_ANDROID_TARGET_ANDROID;
        ChainableCommand cmd = new SaveAllEditorsCommand(
            new GenerateYailCommand(
                new BuildCommand(target,
                    new ShowProgressBarCommand(target,
                        new WaitForBuildResultCommand(target,
                            new DownloadProjectOutputCommand(target)), "DownloadAction"))));
//        updateBuildButton(true);
        cmd.startExecuteChain(Tracking.PROJECT_ACTION_BUILD_DOWNLOAD_YA, projectRootNode,
            new Command() {
              @Override
              public void execute() {
//                updateBuildButton(false);
              }
            });
      }
    }
项目:appinventor-extensions    文件:TopToolbar.java   
@Override
public void execute() {
  Ode.getInstance().getUserInfoService().hasUserFile(StorageUtil.ANDROID_KEYSTORE_FILENAME,
      new OdeAsyncCallback<Boolean>(MESSAGES.uploadKeystoreError()) {
        @Override
        public void onSuccess(Boolean keystoreFileExists) {
          if (!keystoreFileExists || Window.confirm(MESSAGES.confirmOverwriteKeystore())) {
            KeystoreUploadWizard wizard = new KeystoreUploadWizard(new Command() {
              @Override
              public void execute() {
                Tracking.trackEvent(Tracking.USER_EVENT, Tracking.USER_ACTION_UPLOAD_KEYSTORE);
                updateKeystoreFileMenuButtons();
              }
            });
            wizard.center();
          }
        }
      });
}
项目:appinventor-extensions    文件:TopToolbar.java   
@Override
public void execute() {
  ProjectRootNode projectRootNode = Ode.getInstance().getCurrentYoungAndroidProjectRootNode();
  if (projectRootNode != null) {
    String target = YoungAndroidProjectNode.YOUNG_ANDROID_TARGET_ANDROID;
    ChainableCommand cmd = new SaveAllEditorsCommand(new GenerateYailCommand(null));
    //updateBuildButton(true);
    cmd.startExecuteChain(Tracking.PROJECT_ACTION_BUILD_YAIL_YA, projectRootNode,
        new Command() {
          @Override
          public void execute() {
            //updateBuildButton(false);
          }
        });
  }
}
项目:appinventor-extensions    文件:ColorChoicePropertyEditor.java   
/**
 * Creates a new instance of the property editor.
 *
 * @param hexPrefix  language specific hex number prefix
 * @param colors  colors to be shown in property editor - must not be
 *                {@code null} or empty
 */
public ColorChoicePropertyEditor(final Color[] colors, final String hexPrefix) {
  this.hexPrefix = hexPrefix;
  this.colors = colors;

  // Initialize UI
  List<DropDownItem> choices = Lists.newArrayList();
  for (final Color color : colors) {
    choices.add(new DropDownItem(WIDGET_NAME, color.getHtmlDescription(), new Command() {
      @Override
      public void execute() {
        property.setValue(hexPrefix + color.alphaString + color.rgbString);
      }
    }));
  }
  selectedColorMenu = new DropDownButton(WIDGET_NAME, colors[0].getHtmlDescription(), choices, false,  true, false);

  selectedColorMenu.setStylePrimaryName("ode-ColorChoicePropertyEditor");

  initWidget(selectedColorMenu);
}
项目:appinventor-extensions    文件:ChoicePropertyEditor.java   
/**
 * Creates a new instance of the property editor.
 *
 * @param choices  array of values to choose from
 */
public ChoicePropertyEditor(Choice[] choices) {
  // Initialize UI
  this.choices = choices;
  List<DropDownItem> items = Lists.newArrayList();
  for(final Choice choice : choices) {
    items.add(new DropDownItem("Choice Property Editor", choice.caption, new Command() {
      @Override
      public void execute() {
        property.setValue(choice.value);
      }
    }));
  }
  dropDownButton = new DropDownButton("Choice Property Editor", choices[0].caption, items, false);
  dropDownButton.setStylePrimaryName("ode-ChoicePropertyEditor");

  initWidget(dropDownButton);
}
项目:appinventor-extensions    文件:ProjectSettings.java   
@Override
public void saveSettings(final Command command) {
  if (Ode.getInstance().isReadOnly()) {
    return;                   // No changes when in read only mode
  } else if (!changed) {
    // Do not save project settings if they haven't changed.
    return;
  }
  String s = encodeSettings();
  OdeLog.log("Saving project settings: " + s);
  Ode.getInstance().getProjectService().storeProjectSettings(
      Ode.getInstance().getSessionId(),
      project.getProjectId(), s,
      new OdeAsyncCallback<Void>(
          // failure message
          MESSAGES.settingsSaveError()) {
        @Override
        public void onSuccess(Void result) {
          changed = false;
          if (command != null) {
            command.execute();
          }
        }
      });
}
项目:appinventor-extensions    文件:NewYoungAndroidProjectWizard.java   
@Override
public void show() {
  super.show();
  // Wizard size (having it resize between page changes is quite annoying)
  int width = 340;
  int height = 40;
  this.center();

  setPixelSize(width, height);
  super.setPagePanelHeight(85);

  DeferredCommand.addCommand(new Command() {
    public void execute() {
      projectNameTextBox.setFocus(true);
      projectNameTextBox.selectAll();
    }
  });
}
项目:appinventor-extensions    文件:RemixedYoungAndroidProjectWizard.java   
@Override
public void show() {
  super.show();
  // Wizard size (having it resize between page changes is quite annoying)
  int width = 320;
  int height = 40;
  this.center();

  setPixelSize(width, height);
  super.setPagePanelHeight(40);

  DeferredCommand.addCommand(new Command() {
    public void execute() {
      projectNameTextBox.setFocus(true);
      projectNameTextBox.selectAll();
    }
  });
}
项目:appinventor-extensions    文件:InputTemplateUrlWizard.java   
@Override
public void show() {
  super.show();
  // Wizard size (having it resize between page changes is quite annoying)
  int width = 500;
  int height = 40;
  this.center();

  setPixelSize(width, height);
  super.setPagePanelHeight(40);

  DeferredCommand.addCommand(new Command() {
    public void execute() {
      urlTextBox.setFocus(true);
      urlTextBox.selectAll();
    }
  });
}
项目:appinventor-extensions    文件:ComponentRenameWizard.java   
@Override
public void show() {
    super.show();
    int width = 320;
    int height = 40;
    this.center();

    setPixelSize(width, height);
    super.setPagePanelHeight(40);

    DeferredCommand.addCommand(new Command() {
        public void execute() {
            renameTextBox.setFocus(true);
        }
    });
}
项目:appinventor-extensions    文件:EditorManager.java   
/**
 * Creates the editor manager.
 */
public EditorManager() {
  openProjectEditors = Maps.newHashMap();

  dirtyProjectSettings = new HashSet<ProjectSettings>();
  dirtyFileEditors = new HashSet<FileEditor>();

  autoSaveTimer = new Timer() {
    @Override
    public void run() {
      // When the timer goes off, save all dirtyProjectSettings and
      // dirtyFileEditors.
      Ode.getInstance().lockScreens(true); // Lock out changes
      saveDirtyEditors(new Command() {
          @Override
          public void execute() {
            Ode.getInstance().lockScreens(false); // I/O finished, unlock
          }
        });
    }
  };
}
项目:LAS    文件:ActionsMenuBarActivity.java   
/**
 * @return an initialized ActionsMenuBar
 */
public ActionsMenuBar init(String id) {
    if ( eventBus == null )
        eventBus = clientFactory.getEventBus();
    ActionsMenuBar view = clientFactory.getActionsMenuBar(id);
    view.setPresenter(this);
    // Make menu commands
    view.getSaveAsItem().setCommand(new Command() {
        @Override
        public void execute() {
            // TODO Auto-generated method stub
            // Window.open("http://ferret.pmel.noaa.gov/LAS/home/documentation/introduction/using-the-las-user-interface/",
            // "_blank", "");

        }
    });
    return view;
}
项目:LAS    文件:Print.java   
public static void it(String html) {
try {
    buildFrame(html);

    if (USE_TIMER) {
    Timer timer = new Timer() {
        public void run() {
            printFrame();
        }
        };
    timer.schedule(TIMER_DELAY * 1000);
    } else {
    DeferredCommand.addCommand(new Command() {
        public void execute() {
            printFrame();
        }
        });
    }

} catch (Throwable exc) {
    Window.alert(exc.getMessage());
}
   }
项目:cuba    文件:CubaFileUploadProgressWindow.java   
@Override
protected void onAttach() {
    super.onAttach();

    /*
     * When this window gets reattached, set the tabstop to the previous
     * state.
     */
    setTabStopEnabled(doTabStop);

    // Fix for #14413. Any pseudo elements inside these elements are not
    // visible on initial render unless we shake the DOM.
    if (BrowserInfo.get().isIE8()) {
        closeBox.getStyle().setDisplay(Style.Display.NONE);
        Scheduler.get().scheduleFinally(new Command() {
            @Override
            public void execute() {
                closeBox.getStyle().clearDisplay();
            }
        });
    }
}
项目:Wiab.pro    文件:WebClient.java   
private void setupVersionChecker() {
  versionChecker = new ClientVersionChecker(new ClientVersionChecker.Listener() {

    @Override
    public void onClientUpdated() {
      UpdateIndicatorWidget.create(RootPanel.get("banner"), new UpdateIndicatorWidget.Listener() {

        @Override
        public void refresh() {
          completeWave(new Command() {

            @Override
            public void execute() {
              Location.assign(GWT.getHostPageBaseURL());
            }
          });
        }
      });
    }
  }, LOG);
}
项目:Wiab.pro    文件:WebClient.java   
private void closeWave(final Command whenReady) {
  if (LOG.trace().shouldLog()) {
    LOG.trace().log("WebClient.closeWave()");
  }

  errorPopup.hide();

  completeWave(new Command() {

    @Override
    public void execute() {
      destroyWave();
      whenReady.execute();
    }
  });
}
项目:Wiab.pro    文件:PasteExtractor.java   
/**
 * Handler for the browser's paste event
 *
 * @param cursorBias current bias direction of the cursor
 * @return true to cancel browser's default, false otherwise. Generally, we'd
 *         only cancel if we cannot paste, i.e. selection not known
 */
public boolean handlePasteEvent(final BiasDirection cursorBias) {
  // TODO(danilatos): Handle non-collapsed ranges
  final ContentRange previousSelection = aggressiveSelectionHelper.getOrderedSelectionPoints();

  // Selection shouldn't be null here, but its unsafe to make that assumption.
  // Cancel paste if we don't have selection.
  if (previousSelection == null) {
    return true;
  }

  busy = true;
  pasteBuffer.prepareForPaste();

  deferredCommands.addCommand(
      new Command() {

        @Override
        public void execute() {
          extract(pasteBuffer.getPasteContainer(), previousSelection, cursorBias);
          busy = false;
        }
      });
  return false;
}
项目:Wiab.pro    文件:EditorImpl.java   
@Override
public Point<ContentNode> deleteRange(Point<ContentNode> first, Point<ContentNode> second,
    boolean isReplace) {
  if (isReplace) {
    annotationLogic.supplementAnnotations(mutable().getLocation(first), BiasDirection.RIGHT,
        ContentType.PLAIN_TEXT);
  }

  final Point<ContentNode> filteredFirst = getFilteredPoint(first);
  final Point<ContentNode> filteredSecond = getFilteredPoint(second);      
  final Iterable<? extends ConversationThread> repliesToDelete = findInnerRepliesWithinRange(
      blip, mapper().getLocation(filteredFirst), mapper().getLocation(filteredSecond));

  if (repliesToDelete.iterator().hasNext()) {
    DialogBox.confirm(messages.confirmThreadDeletion(), new Command() {

      @Override
      public void execute() {
        deleteRangeInner(filteredFirst, filteredSecond, repliesToDelete);
      }
    });
    return filteredFirst;
  }

  return deleteRangeInner(filteredFirst, filteredSecond, repliesToDelete);
}
项目:Wiab.pro    文件:ActionsImpl.java   
@Override
public void deleteBlip(final ConversationBlip blip, DeleteOption option) {
  QuasiConversationBlip quasiBlip = (QuasiConversationBlip) blip;
  if (quasiBlip.isQuasiDeleted()) {
    return; // cannot delete blip twice
  }
  if (!isEmpty(blip)) {
    switch (option) {
      case DELETE_EMPTY_ONLY:
        return;

      case WITH_CONFIRMATION:
        focusFrame.focus(blip);
        DialogBox.confirm(messages.confirmBlipDeletion(), new Command() {

          @Override
          public void execute() {
            deleteBlipInner(blip);
          }
        });
        return;
    }
  }
  deleteBlipInner(blip);
}
项目:Wiab.pro    文件:EditSession.java   
void finishEditing(final boolean endWithDone) {
  if (isDraftModified() && !endWithDone) {
    finisher.onEndEditing(new Command() {

      @Override
      public void execute() {
        if (finisher.isExitAllowed()) {
          leaveDraftMode(finisher.shouldDraftBeSaved());

          //if edited blip is empty => delete it
          ConversationBlip edited = editing;
          endSession();
          actions.deleteBlip(edited, Actions.DeleteOption.DELETE_EMPTY_ONLY);
        }
      }
    });
  } else {
    stopEditing();
  }  
}
项目:Wiab.pro    文件:EditSession.java   
@Override
public boolean canMoveFocus(ConversationBlip oldBlip, final ConversationBlip newBlip) {
  if (isDraftModified()) {
    finisher.onFocusMove(new Command() {

      @Override
      public void execute() {
        if (finisher.isExitAllowed()) {
          leaveDraftMode(finisher.shouldDraftBeSaved());
          endSession();
          focus.focus(newBlip);
        }
      }
    });
    return false;
  }
  return true;    
}
项目:Wiab.pro    文件:ParticipantController.java   
/**
 * Shows a participation profileUi for the clicked participant.
 */
private void handleParticipantClicked(Element context) {
  ParticipantView participantView = views.asParticipant(context);
  Pair<Conversation, ParticipantId> participation = models.getParticipant(participantView);
  Profile profile = profiles.getProfile(participation.second);

  // Summon a popup view from a participant, and attach profile-popup logic to
  // it.
  ProfilePopupView profileView = participantView.showParticipation();
  final Conversation conversation = participation.getFirst();
  final ParticipantId participantId = participation.getSecond();
  boolean isRemoved = ParticipantState.REMOVED.equals(participantView.getState());
  SafeHtml buttonText = EscapeUtils.fromSafeConstant(isRemoved ? messages.close()
      : messages.remove());
  Command buttonCommand = isRemoved ? null : new Command() {

    @Override
    public void execute() {
      conversation.removeParticipant(participantId);
      markAsRead();
    }
  };
  ProfilePopupPresenter profileUi = ProfilePopupPresenter.create(profile, profileView, profiles,
      (ObservableConversation) conversation, buttonText, buttonCommand);
  profileUi.show();
}
项目:Wiab.pro    文件:DialogBox.java   
/**
 * Standard information dialog with prompt and "OK" button.
 *
 * @param message message to display
 */
public static void information(String message) {
  PopupChrome chrome = PopupChromeFactory.createPopupChrome();
  final UniversalPopup popup = PopupFactory.createPopup(RootPanel.getBodyElement(),
      new CenterPopupPositioner(), chrome, true);

  VerticalPanel verticalPanel = new VerticalPanel();
  verticalPanel.setStyleName(Dialog.getCss().verticalPanel());
  Label label = new Label(message);
  verticalPanel.add(label);

  DialogButton okButton = new DialogButton(messages.ok(), new Command() {

    @Override
    public void execute() {
      popup.hide();
    }
  });

  DialogBox.create(popup, messages.confirmation(), verticalPanel,
      new DialogButton[] { okButton });

  popup.show();
  requestFocus(okButton.getButton());
}
项目:Wiab.pro    文件:ProfilePopupPresenter.java   
/**
 * Creates a profile popup presenter. This presenter destroys itself and
 * detaches from the view as soon as the popup hides.
 *
 * @param model profile to present
 * @param view view in which to present
 * @param events source of profile events
 * @param conversation conversation to be listened to
 * @return a new presenter.
 */
public static ProfilePopupPresenter create(Profile model, final ProfilePopupView view,
    ProfileManager events, ObservableConversation conversation, SafeHtml buttonText,
    final Command buttonCommand) {
  ProfilePopupPresenter profileUi = new ProfilePopupPresenter(model, view, events, conversation);
  profileUi.init();

  // Add button to the profile card
  view.addButton(buttonText,
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          if (buttonCommand != null) {
            buttonCommand.execute();
          }  
          view.hide();
        }
      });
  return profileUi;
}
项目:firefly    文件:CatalogPopupPanel.java   
public void bind(FormHub formHub) {
    this.formHub = formHub;
    if (formHub != null) {
        formHub.getEventManager().addListener(FormHub.FIELD_VALUE_CHANGE, new WebEventListener() {
            public void eventNotify(WebEvent ev) {
                Param p = (Param) ev.getData();
                if (p.getName().equalsIgnoreCase(fieldLink)) {
                    fieldValue = p.getValue();
                }

                setDefaultValues();
            }
        });

        DeferredCommand.addCommand(new Command() {
            public void execute() {
                fieldValue = getFormHub().getValue(fieldLink);
            }
        });
    }
}