/**
   * Invoked when an action occurs.
   *
   * @param e the ActionEvent
   */
  public void actionPerformed(ActionEvent event) {
    Object o = event.getSource();

    if ((o == null) || !(o instanceof ManagementObjectPanel)) {
      Log.error(Bundle.getMessage(Bundle.ERROR_INVALID_ACTION_EVENT));
      return;
    }

    ConnectorManagementPanel p = (ConnectorManagementPanel) o;
    ConnectorManagementObject mo = (ConnectorManagementObject) p.getManagementObject();

    try {
      if (event.getID() == p.ACTION_EVENT_UPDATE) {
        saveConfiguration(mo);
      }
    } catch (AdminException e) {
      p.notifyError(e);
    }
  }
  /**
   * Starts the process to create a new SyncSouce
   *
   * @param node SyncTypeNode involved in the process
   * @throws AdminException if a error occurs during the process
   */
  public void editConnector(ConnectorNode node) throws AdminException {
    Sync4jModule module = node.getModule();
    Sync4jConnector connector = node.getConnector();

    Log.debug("node:" + node);

    final String panelName = module.getModuleName() + " - " + connector.getConnectorName();

    ConnectorManagementPanel panel = (ConnectorManagementPanel) PanelManager.getPanel(panelName);

    ConnectorManagementObject mo =
        new ConnectorManagementObject(
            null, module.getModuleId(), connector.getConnectorId(), connector.getConnectorName());

    if (panel != null) {
      //
      // Management object loading and setting
      //
      readConfiguration(mo);

      panel.setManagementObject(mo);
      panel.updateForm();
      PanelManager.showPanel(panelName);
    } else {
      String adminClassName = connector.getAdminClass();

      Log.debug("admin class name: " + adminClassName);

      if ((adminClassName == null) || (adminClassName.trim().length() == 0)) {
        //
        // There is no configuration panel for this connector... just
        // do nothing
        //
        return;
      }

      //
      // Admin class loading
      //

      Class adminClass = null;

      SyncAdminController adminController = ExplorerUtil.getSyncAdminController();

      ClassLoader cl = adminController.getSync4jClassLoader();

      try {
        adminClass = cl.loadClass(adminClassName);
        panel = (ConnectorManagementPanel) adminClass.newInstance();
      } catch (Exception e) {
        String errorMessage = Bundle.getMessage(Bundle.ERROR_LOADING_CONNECTOR_CONFIG_PANEL);
        Log.error(errorMessage + " (class name: " + adminClassName + ")");
        Log.error(e);
        NotifyDescriptor desc = new NotifyDescriptor.Message(errorMessage);
        DialogDisplayer.getDefault().notify(desc);
        return;
      }

      //
      // Management object loading and setting
      //
      readConfiguration(mo);

      panel.setName(panelName);
      panel.setManagementObject(mo);
      panel.addActionListener(this);

      //
      // Tell the panel to rewrite its content
      //
      panel.updateForm();

      panel.validate();

      PanelManager.addPanel(panel);
    }
  }