コード例 #1
0
  /* (non-Javadoc)
   * @see de.jwic.base.Control#actionPerformed(java.lang.String, java.lang.String)
   */
  @Override
  public void actionPerformed(String actionId, String parameter) {
    if ("undoChanges".equalsIgnoreCase(actionId)) {

      tableModel.getUserConfigHandler().updateRelatedConfig(true);
      onCancel(); // to close the window

    } else if ("saveCurrent".equalsIgnoreCase(actionId)) {

      tableModel.getUserConfigHandler().updateRelatedConfig(false);
      onCancel(); // to close the window

    } else if ("saveNew".equalsIgnoreCase(actionId)) {

      final IUserViewConfiguration uvc =
          tableModel.getUserConfigHandler().createConfigWithCurrentSettings();
      UserViewConfigurationControl ctrl = createUserConfigControl(uvc, true);
      ctrl.actionEdit();

      ctrl.addListener(
          new IUserViewConfigurationControlListener() {
            @Override
            public void onConfigDeleted(Event event) {}

            @Override
            public void onConfigApplied(Event event) {}

            @Override
            public void onConfigUpdated(Event event) {
              // if it's a new config created from current settings, we need to apply it after it's
              // saved, to make it the main one
              tableModel.getUserConfigHandler().applyConfig(uvc);
            }
          });
    } else if ("loadProfile".equalsIgnoreCase(actionId)) {
      // to prevent opening the dialog multiple times
      if (loadProfileWindow != null) {
        return;
      }

      loadProfileWindow =
          new LoadProfileWindow(ExtendedApplication.getInstance(this).getSite(), tableModel);
      loadProfileWindow.addDialogWindowListener(
          new DialogWindowAdapter() {
            @Override
            public void onDialogAborted(DialogEvent event) {
              loadProfileWindow = null;
            }
          });
      loadProfileWindow.show();
    }
  }
コード例 #2
0
  /**
   * @param userConfig
   * @return
   */
  private UserViewConfigurationControl createUserConfigControl(
      IUserViewConfiguration userConfig, boolean isNew) {
    UserViewConfigurationControl ctrl =
        new UserViewConfigurationControl(
            configControlsContainer, userConfig, tableModel, userConfig.getId() == 0, false);
    ctrl.addListener(controlListener);
    if (isNew) {
      configControls.add(0, ctrl);
    } else {
      configControls.add(ctrl);
    }

    requireRedraw();

    return ctrl;
  }