/**
   * Fires an asynchronous call to update the passed group.
   *
   * @param data The object to update.
   * @param asynch Pass <code>true</code> to save data asynchronously, <code>false</code> otherwise.
   */
  void fireAdminSaving(AdminObject data, boolean asynch) {
    SecurityContext c = ctx;
    if (MetadataViewerAgent.isAdministrator()) c = getAdminContext();

    MetadataLoader loader;
    GroupData group = data.getGroup();

    switch (data.getIndex()) {
      case AdminObject.UPDATE_GROUP:
        loaderID++;
        loader =
            new GroupEditor(
                component, c, group, data.getPermissions(), loaderID, GroupEditor.UPDATE);
        loaders.put(loaderID, loader);
        loader.load();
        state = MetadataViewer.SAVING;
        break;
      case AdminObject.UPDATE_EXPERIMENTER:
        loaderID++;
        loader = new AdminEditor(component, c, data.getGroup(), data.getExperimenters(), loaderID);
        loaders.put(loaderID, loader);
        loader.load();
        state = MetadataViewer.SAVING;
    }
  }
 /**
  * Cancels any ongoing data loading.
  *
  * @param loaderID The identifier of the loader.
  */
 void cancel(int loaderID) {
   MetadataLoader loader = loaders.get(loaderID);
   if (loader != null) {
     loader.cancel();
     loaders.remove(loaderID);
   }
 }
 /**
  * Sets the object in the {@link MetadataViewer#DISCARDED} state. Any ongoing data loading will be
  * cancelled.
  */
 void discard() {
   state = MetadataViewer.DISCARDED;
   loaders.entrySet().iterator();
   Iterator<Entry<Integer, MetadataLoader>> i = loaders.entrySet().iterator();
   MetadataLoader loader;
   while (i.hasNext()) {
     loader = i.next().getValue();
     if (loader != null) loader.cancel();
   }
   loaders.clear();
   if (multiDataLoader != null) multiDataLoader.cancel();
 }
 /**
  * Fires an asynchronous call to modify the default group of the logged in experimenter.
  *
  * @param group
  */
 void fireChangeGroup(GroupData group) {
   SecurityContext c = ctx;
   if (MetadataViewerAgent.isAdministrator()) c = getAdminContext();
   MetadataLoader loader = new GroupEditor(component, c, group, loaderID, GroupEditor.CHANGE);
   loader.load();
 }