/** Updates the contents of the panel. */
 public void updateContents() {
   ServerDescriptor server = null;
   if (getInfo() != null) {
     server = getInfo().getServerDescriptor();
   }
   CustomSearchResult csr = null;
   if (server != null) {
     csr = server.getEntryCachesMonitor();
   }
   if (csr != null) {
     updateMonitoringInfo(ngOperations, monitoringLabels, csr);
     int index = 0;
     for (MonitoringAttributes attr : ngOperations) {
       if (getFirstValueAsString(csr, attr.getAttributeName()) == null) {
         monitoringLabels.get(index).setVisible(false);
         labels.get(index).setVisible(false);
       }
       index++;
     }
     revalidate();
     repaint();
   } else {
     for (JLabel l : monitoringLabels) {
       l.setText(NO_VALUE_SET.toString());
     }
   }
 }
  /**
   * Refresh the contents of the panel with the provided server descriptor.
   *
   * @param desc the server descriptor.
   */
  private void refreshContents(final ServerDescriptor desc) {
    super.updateIndexMap(desc, hmIndexes);
    filterIndexes(hmIndexes);

    updateBaseDNComboBoxModel((DefaultComboBoxModel) baseDNs.getModel(), desc);

    // Check that all backends
    boolean allDisabled = false;
    for (BackendDescriptor backend : desc.getBackends()) {
      if (displayBackend(backend)) {
        if (backend.isEnabled()) {
          allDisabled = false;
          break;
        }
      }
    }
    if (!allDisabled) {
      updateErrorPaneAndOKButtonIfAuthRequired(
          desc,
          isLocal()
              ? INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_FOR_DISABLE_BACKEND.get()
              : INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname()));
    }
    SwingUtilities.invokeLater(
        new Runnable() {
          /** {@inheritDoc} */
          public void run() {
            ViewPositions pos;
            JScrollPane scroll = Utilities.getContainingScroll(RebuildIndexPanel.this);
            if (scroll != null) {
              pos = Utilities.getViewPositions(scroll);
            } else {
              pos = Utilities.getViewPositions(RebuildIndexPanel.this);
            }

            boolean comboVisible = baseDNs.getModel().getSize() > 0;
            baseDNs.setVisible(comboVisible);
            lNoBaseDNsFound.setVisible(!comboVisible);
            addRemove.getAvailableList().repaint();
            addRemove.getSelectedList().repaint();

            Utilities.updateViewPositions(pos);
            if (!desc.isLocal()) {
              displayErrorMessage(
                  INFO_CTRL_PANEL_SERVER_REMOTE_SUMMARY.get(),
                  INFO_CTRL_PANEL_SERVER_MUST_BE_LOCAL_REBUILD_INDEX_SUMMARY.get());
              setEnabledOK(false);
            } else {
              displayMainPanel();
              setEnabledOK(true);
            }
          }
        });
  }
Exemplo n.º 3
0
  /** {@inheritDoc} */
  @Override
  public void configurationChanged(ConfigurationChangeEvent ev) {
    final ServerDescriptor desc = ev.getNewDescriptor();
    Schema s = desc.getSchema();
    final boolean schemaChanged;
    if (schema != null && s != null) {
      schemaChanged = !ServerDescriptor.areSchemasEqual(s, schema);
    } else if (schema == null && s != null) {
      schemaChanged = true;
    } else if (s == null && schema != null) {
      schemaChanged = false;
    } else {
      schemaChanged = false;
    }
    if (schemaChanged) {
      schema = s;

      updateErrorPaneIfAuthRequired(
          desc,
          isLocal()
              ? INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_FOR_OBJECTCLASS_EDIT.get()
              : INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname()));
    } else if (schema == null) {
      updateErrorPane(
          errorPane,
          ERR_CTRL_PANEL_SCHEMA_NOT_FOUND_SUMMARY.get(),
          ColorAndFontConstants.errorTitleFont,
          ERR_CTRL_PANEL_SCHEMA_NOT_FOUND_DETAILS.get(),
          ColorAndFontConstants.defaultFont);
    }
    SwingUtilities.invokeLater(
        new Runnable() {
          /** {@inheritDoc} */
          @Override
          public void run() {
            delete.setEnabled(
                !authenticationRequired(desc) && !authenticationRequired(desc) && schema != null);
            checkEnableSaveChanges();
            saveChanges.setEnabled(
                saveChanges.isEnabled()
                    && !authenticationRequired(desc)
                    && !authenticationRequired(desc)
                    && schema != null);
            if (schemaChanged && schema != null) {
              superiors.setSchema(schema);
              updateAttributes();
            }
          }
        });
  }
Exemplo n.º 4
0
 /** {@inheritDoc} */
 public void configurationChanged(ConfigurationChangeEvent ev) {
   final ServerDescriptor desc = ev.getNewDescriptor();
   updateErrorPaneIfAuthRequired(
       desc,
       isLocal()
           ? INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_FOR_INDEX_EDITING.get()
           : INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname()));
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           checkSaveButton();
           deleteIndex.setEnabled(!authenticationRequired(desc));
         }
       });
 }