示例#1
0
  /** {@inheritDoc} */
  @Override
  public boolean execute(IActionHandler actionHandler, Map<String, Object> context) {
    context.put(AbstractQbeAction.PAGINATE, null);
    IPageable pageableModel = getModel(context);
    /*
     * we are on the pagination button view.
     */
    int[] collectionViewPath = new int[] {-1, -1};
    List<?> stickyResults = null;
    IView<E> collectionView = getView(collectionViewPath, context);
    if (collectionView.getDescriptor() instanceof ICollectionViewDescriptor
        && ((ICollectionViewDescriptor) collectionView.getDescriptor()).getSelectionMode()
            == ESelectionMode.MULTIPLE_INTERVAL_CUMULATIVE_SELECTION
        && !(pageableModel instanceof FilterableBeanCollectionModule)) {
      stickyResults = getSelectedModels(collectionViewPath, context);
    }
    pageableModel.setStickyResults(stickyResults);

    try {
      if (pageOffset != null) {
        if (pageableModel.getPage() != null) {
          pageableModel.setPage(pageableModel.getPage() + pageOffset);
        } else {
          pageableModel.setPage(pageOffset);
        }
      }
      return super.execute(actionHandler, context);
    } finally {
      if (stickyResults != null) {
        setSelectedModels(collectionViewPath, stickyResults, context);
      }
      pageableModel.setStickyResults(null);
    }
  }
示例#2
0
  private void displayWizardStep(
      IWizardStepDescriptor wizardStep,
      IValueConnector modelConnector,
      IActionHandler actionHandler,
      Map<String, Object> context,
      boolean reuseCurrent) {

    ITranslationProvider translationProvider = getTranslationProvider(context);
    Locale locale = getLocale(context);
    IView<E> view =
        getViewFactory(context)
            .createView(wizardStep.getViewDescriptor(), actionHandler, getLocale(context));
    IModelDescriptor modelDescriptor = wizardStep.getViewDescriptor().getModelDescriptor();
    if (modelDescriptor instanceof IComponentDescriptor<?>) {
      for (IPropertyDescriptor propertyDescriptor :
          ((IComponentDescriptor<?>) modelDescriptor).getPropertyDescriptors()) {
        if (propertyDescriptor instanceof IScalarPropertyDescriptor
            && ((IScalarPropertyDescriptor) propertyDescriptor).getDefaultValue() != null) {
          Map<String, Object> wizardModel = modelConnector.getConnectorValue();
          if (!wizardModel.containsKey(propertyDescriptor.getName())) {
            wizardModel.put(
                propertyDescriptor.getName(),
                ((IScalarPropertyDescriptor) propertyDescriptor).getDefaultValue());
          }
        }
      }
    }
    getMvcBinder(context).bind(view.getConnector(), modelConnector);

    String title =
        getI18nName(translationProvider, locale)
            + " - "
            + wizardStep.getI18nName(translationProvider, locale);
    Dimension dialogSize = getDialogSize(context);
    getController(context)
        .displayModalDialog(
            view.getPeer(),
            createWizardStepActions(
                wizardStep,
                view,
                actionHandler,
                translationProvider,
                locale,
                modelConnector,
                context),
            title,
            getSourceComponent(context),
            context,
            dialogSize,
            reuseCurrent);
    // We must update the context
    context.putAll(
        getActionFactory(context)
            .createActionContext(
                actionHandler,
                view,
                view.getConnector(),
                getActionCommand(context),
                getActionWidget(context)));
  }