guitools + quicksetup: added @Override + Autorefactor'ed comments
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 Parametric Technology Corporation (PTC) |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads.util; |
| | | |
| | | import java.net.Socket; |
| | |
| | | import java.security.UnrecoverableKeyException; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import javax.net.ssl.KeyManager; |
| | | import javax.net.ssl.KeyManagerFactory; |
| | | import javax.net.ssl.TrustManagerFactory; |
| | | import javax.net.ssl.X509KeyManager; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.util.Platform; |
| | | |
| | | |
| | | /** |
| | | * This class is in charge of checking whether the certificates that are |
| | | * presented are trusted or not. |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The default keyManager. |
| | | */ |
| | | /** The default keyManager. */ |
| | | private X509KeyManager keyManager; |
| | | |
| | | /** |
| | |
| | | KeyManager kms[] = kmf.getKeyManagers(); |
| | | /* |
| | | * Iterate over the returned keymanagers, look for an instance |
| | | * of X509KeyManager. If found, use that as our "default" key |
| | | * manager. |
| | | * of X509KeyManager. If found, use that as our "default" key manager. |
| | | */ |
| | | for (int j = 0; j < kms.length; j++) |
| | | for (KeyManager km : kms) |
| | | { |
| | | if (kms[i] instanceof X509KeyManager) |
| | | { |
| | | keyManager = (X509KeyManager) kms[j]; |
| | | keyManager = (X509KeyManager) km; |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Choose an alias to authenticate the client side of a secure |
| | | * socket given the public key type and the list of certificate |
| | | * issuer authorities recognized by the peer (if any). |
| | | * |
| | | * @param keyType |
| | | * the key algorithm type name(s), ordered with the |
| | | * most-preferred key type first. |
| | | * @param issuers |
| | | * the list of acceptable CA issuer subject names or null |
| | | * if it does not matter which issuers are used. |
| | | * @param socket |
| | | * the socket to be used for this connection. This |
| | | * parameter can be null, in which case this method will |
| | | * return the most generic alias to use. |
| | | * @return the alias name for the desired key, or null if there are |
| | | * no matches. |
| | | */ |
| | | public String chooseClientAlias(String[] keyType, Principal[] issuers, |
| | | Socket socket) |
| | | @Override |
| | | public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) |
| | | { |
| | | if (keyManager != null) |
| | | { |
| | | return keyManager.chooseClientAlias(keyType, issuers, socket); |
| | | } |
| | | return null; |
| | | return keyManager != null ? keyManager.chooseClientAlias(keyType, issuers, socket) : null; |
| | | } |
| | | |
| | | /** |
| | | * Choose an alias to authenticate the client side of a secure |
| | | * socket given the public key type and the list of certificate |
| | | * issuer authorities recognized by the peer (if any). |
| | | * |
| | | * @param keyType |
| | | * the key algorithm type name(s), ordered with the |
| | | * most-preferred key type first. |
| | | * @param issuers |
| | | * the list of acceptable CA issuer subject names or null |
| | | * if it does not matter which issuers are used. |
| | | * @param socket |
| | | * the socket to be used for this connection. This |
| | | * parameter can be null, in which case this method will |
| | | * return the most generic alias to use. |
| | | * @return the alias name for the desired key, or null if there are |
| | | * no matches. |
| | | */ |
| | | public String chooseServerAlias(String keyType, Principal[] issuers, |
| | | Socket socket) |
| | | @Override |
| | | public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) |
| | | { |
| | | if (keyManager != null) |
| | | { |
| | | return keyManager.chooseServerAlias(keyType, issuers, socket); |
| | | } |
| | | return null; |
| | | return keyManager != null ? keyManager.chooseServerAlias(keyType, issuers, socket) : null; |
| | | } |
| | | |
| | | /** |
| | | * Returns the certificate chain associated with the given alias. |
| | | * |
| | | * @param alias |
| | | * the alias name |
| | | * @return the certificate chain (ordered with the user's |
| | | * certificate first and the root certificate authority |
| | | * last), or null if the alias can't be found. |
| | | */ |
| | | @Override |
| | | public X509Certificate[] getCertificateChain(String alias) |
| | | { |
| | | if (keyManager != null) |
| | | { |
| | | return keyManager.getCertificateChain(alias); |
| | | } |
| | | return null; |
| | | return keyManager != null ? keyManager.getCertificateChain(alias) : null; |
| | | } |
| | | |
| | | /** |
| | | * Get the matching aliases for authenticating the server side of a |
| | | * secure socket given the public key type and the list of |
| | | * certificate issuer authorities recognized by the peer (if any). |
| | | * |
| | | * @param keyType |
| | | * the key algorithm type name |
| | | * @param issuers |
| | | * the list of acceptable CA issuer subject names or null |
| | | * if it does not matter which issuers are used. |
| | | * @return an array of the matching alias names, or null if there |
| | | * were no matches. |
| | | */ |
| | | @Override |
| | | public String[] getClientAliases(String keyType, Principal[] issuers) |
| | | { |
| | | if (keyManager != null) |
| | | { |
| | | return keyManager.getClientAliases(keyType, issuers); |
| | | } |
| | | return null; |
| | | return keyManager != null ? keyManager.getClientAliases(keyType, issuers) : null; |
| | | } |
| | | |
| | | /** |
| | | * Returns the key associated with the given alias. |
| | | * |
| | | * @param alias |
| | | * the alias name |
| | | * @return the requested key, or null if the alias can't be found. |
| | | */ |
| | | @Override |
| | | public PrivateKey getPrivateKey(String alias) |
| | | { |
| | | if (keyManager != null) |
| | | { |
| | | return keyManager.getPrivateKey(alias); |
| | | } |
| | | return null; |
| | | return keyManager != null ? keyManager.getPrivateKey(alias) : null; |
| | | } |
| | | |
| | | /** |
| | | * Get the matching aliases for authenticating the server side of a |
| | | * secure socket given the public key type and the list of |
| | | * certificate issuer authorities recognized by the peer (if any). |
| | | * |
| | | * @param keyType |
| | | * the key algorithm type name |
| | | * @param issuers |
| | | * the list of acceptable CA issuer subject names or null |
| | | * if it does not matter which issuers are used. |
| | | * @return an array of the matching alias names, or null if there |
| | | * were no matches. |
| | | */ |
| | | @Override |
| | | public String[] getServerAliases(String keyType, Principal[] issuers) |
| | | { |
| | | if (keyManager != null) |
| | | { |
| | | return keyManager.getServerAliases(keyType, issuers); |
| | | } |
| | | return null; |
| | | return keyManager != null ? keyManager.getServerAliases(keyType, issuers) : null; |
| | | } |
| | | } |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 Parametric Technology Corporation (PTC) |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads.util; |
| | | |
| | | import java.security.KeyStore; |
| | |
| | | * it cannot be retrieved this class will only accept the certificates |
| | | * explicitly accepted by the user (and specified by calling acceptCertificate). |
| | | * |
| | | * NOTE: this class is not aimed to be used when we have connections in |
| | | * parallel. |
| | | * NOTE: this class is not aimed to be used when we have connections in parallel. |
| | | */ |
| | | public class ApplicationTrustManager implements X509TrustManager |
| | | { |
| | |
| | | */ |
| | | public enum Cause |
| | | { |
| | | /** |
| | | * The certificate was not trusted. |
| | | */ |
| | | /** The certificate was not trusted. */ |
| | | NOT_TRUSTED, |
| | | /** |
| | | * The certificate's subject DN's value and the host name we tried to |
| | | * connect to do not match. |
| | | */ |
| | | /** The certificate's subject DN's value and the host name we tried to connect to do not match. */ |
| | | HOST_NAME_MISMATCH |
| | | } |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | |
| | | private String host; |
| | | |
| | | |
| | | /** |
| | | * The default constructor. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | throws CertificateException |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | verifyHostName(chain, authType); |
| | | verifyHostName(chain); |
| | | } |
| | | catch (CertificateException ce) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, |
| | | String authType) throws CertificateException |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | verifyHostName(chain, authType); |
| | | verifyHostName(chain); |
| | | } |
| | | catch (CertificateException ce) |
| | | { |
| | |
| | | throw new OpendsCertificateException(chain, ce); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | if (trustManager != null) |
| | |
| | | * @throws CertificateException if the subject DN of the certificate does |
| | | * not match with the host name specified with the method setHost. |
| | | */ |
| | | private void verifyHostName(X509Certificate[] chain, String authType) |
| | | throws CertificateException |
| | | private void verifyHostName(X509Certificate[] chain) throws CertificateException |
| | | { |
| | | if (host != null) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads.util; |
| | | |
| | | import javax.net.ssl.HostnameVerifier; |
| | | import javax.net.ssl.SSLSession; |
| | | |
| | | /** |
| | | * A HostnameVerifier which verifies nothing. |
| | | */ |
| | | /** A HostnameVerifier which verifies nothing. */ |
| | | class BlindHostnameVerifier implements HostnameVerifier |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) |
| | | { |
| | | return true; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.admin.ads.util; |
| | | |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | import javax.net.ssl.X509TrustManager; |
| | | |
| | | /** |
| | | * An X509TrustManager which trusts everything. |
| | | */ |
| | | /** An X509TrustManager which trusts everything. */ |
| | | public class BlindTrustManager implements X509TrustManager { |
| | | |
| | | /** {@inheritDoc} */ |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | throws CertificateException |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | throws CertificateException |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[0]; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads.util; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.Socket; |
| | | import java.net.InetAddress; |
| | | import java.util.Map; |
| | | import java.util.HashMap; |
| | | |
| | | import java.net.Socket; |
| | | import java.security.GeneralSecurityException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.net.SocketFactory; |
| | | import javax.net.ssl.KeyManager; |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.SSLSocketFactory; |
| | | import javax.net.ssl.SSLKeyException; |
| | | import javax.net.ssl.SSLSocketFactory; |
| | | import javax.net.ssl.TrustManager; |
| | | |
| | | /** |
| | | * An implementation of SSLSocketFactory. |
| | | */ |
| | | /** An implementation of SSLSocketFactory. */ |
| | | public class TrustedSocketFactory extends SSLSocketFactory |
| | | { |
| | | private static Map<Thread, TrustManager> hmTrustManager = new HashMap<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | // |
| | | // SocketFactory implementation |
| | | // |
| | | /** |
| | | * Returns the default SSL socket factory. The default |
| | | * implementation can be changed by setting the value of the |
| | |
| | | hmDefaultFactoryTm.put(trustManager, result); |
| | | hmDefaultFactoryKm.put(keyManager, result); |
| | | } |
| | | else |
| | | if ( !tmsf.equals(kmsf) ) |
| | | else if (!tmsf.equals(kmsf)) |
| | | { |
| | | result = new TrustedSocketFactory(trustManager, keyManager); |
| | | hmDefaultFactoryTm.put(trustManager, result); |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Socket createSocket(InetAddress address, int port) throws IOException { |
| | | return getInnerFactory().createSocket(address, port); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Socket createSocket(InetAddress address, int port, |
| | | InetAddress clientAddress, int clientPort) throws IOException |
| | | { |
| | | return getInnerFactory().createSocket(address, port, clientAddress, |
| | | clientPort); |
| | | return getInnerFactory().createSocket(address, port, clientAddress, clientPort); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Socket createSocket(String host, int port) throws IOException |
| | | { |
| | | return getInnerFactory().createSocket(host, port); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Socket createSocket(String host, int port, InetAddress clientHost, |
| | | int clientPort) throws IOException |
| | | { |
| | | return getInnerFactory().createSocket(host, port, clientHost, clientPort); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Socket createSocket(Socket s, String host, int port, boolean autoClose) |
| | | throws IOException |
| | | { |
| | | return getInnerFactory().createSocket(s, host, port, autoClose); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String[] getDefaultCipherSuites() |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String[] getSupportedCipherSuites() |
| | | { |
| | | try |
| | |
| | | if (innerFactory == null) |
| | | { |
| | | String algorithm = "TLSv1"; |
| | | SSLKeyException xx; |
| | | KeyManager[] km = null; |
| | | TrustManager[] tm = null; |
| | | |
| | | try { |
| | | KeyManager[] km = null; |
| | | TrustManager[] tm = null; |
| | | SSLContext sslCtx = SSLContext.getInstance(algorithm); |
| | | if (trustManager != null) |
| | | { |
| | |
| | | innerFactory = sslCtx.getSocketFactory(); |
| | | } |
| | | catch(GeneralSecurityException x) { |
| | | xx = new SSLKeyException("Failed to create SSLContext for " + |
| | | algorithm); |
| | | SSLKeyException xx = new SSLKeyException("Failed to create SSLContext for " + algorithm); |
| | | xx.initCause(x); |
| | | throw xx; |
| | | } |
| | |
| | | return innerFactory; |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel; |
| | |
| | | final ControlPanel test = new ControlPanel(); |
| | | test.initialize(args); |
| | | javax.swing.SwingUtilities.invokeLater(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | test.createAndDisplayGUI(); |
| | | } |
| | |
| | | info.setConnectTimeout(argParser.getConnectTimeout()); |
| | | } |
| | | |
| | | /** |
| | | * Creates the main Control Panel dialog and displays it. |
| | | */ |
| | | /** Creates the main Control Panel dialog and displays it. */ |
| | | public void createAndDisplayGUI() |
| | | { |
| | | LocalOrRemotePanel localOrRemotePanel = new LocalOrRemotePanel(); |
| | |
| | | |
| | | ComponentListener listener = new ComponentAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void componentHidden(ComponentEvent e) |
| | | { |
| | | handleWindowClosed(localOrRemote, info); |
| | |
| | | // calling pack. |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | // Create and set up the content pane. |
| | |
| | | dlg.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
| | | final MainMenuBar menuBar = new MainMenuBar(info); |
| | | dlg.addWindowListener(new WindowAdapter() { |
| | | @Override |
| | | public void windowClosing(WindowEvent e) { |
| | | menuBar.quitClicked(); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel; |
| | | |
| | |
| | | * class basically displays a splash screen and then calls the methods in |
| | | * ControlPanel. It also is in charge of detecting whether there are issues |
| | | * with the |
| | | * |
| | | */ |
| | | public class ControlPanelLauncher |
| | | { |
| | |
| | | } |
| | | catch (InterruptedException ie) |
| | | { |
| | | /* An error occurred, so the return value will be -1. We got nothing to |
| | | do with this exception. */ |
| | | /* An error occurred, so the return value will be -1. We got nothing to do with this exception. */ |
| | | } |
| | | System.setErr(printStream); |
| | | return returnValue[0]; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * The enumeration containing the different return codes that the command-line |
| | | * can have. |
| | | * |
| | | */ |
| | | /** The enumeration containing the different return codes that the command-line can have. */ |
| | | enum ErrorReturnCode |
| | | { |
| | | /** |
| | | * Successful display of the status. |
| | | */ |
| | | /** Successful display of the status. */ |
| | | SUCCESSFUL(0), |
| | | /** |
| | | * We did no have an error but the status was not displayed (displayed |
| | | * version or usage). |
| | | */ |
| | | /** We did no have an error but the status was not displayed (displayed version or usage). */ |
| | | SUCCESSFUL_NOP(0), |
| | | /** |
| | | * Unexpected error (potential bug). |
| | | */ |
| | | /** Unexpected error (potential bug). */ |
| | | ERROR_UNEXPECTED(1), |
| | | /** |
| | | * Cannot parse arguments. |
| | | */ |
| | | /** Cannot parse arguments. */ |
| | | ERROR_PARSING_ARGS(2), |
| | | /** |
| | | * User cancelled (for instance not accepting the certificate proposed) or |
| | | * could not use the provided connection parameters in interactive mode. |
| | | */ |
| | | USER_CANCELLED_OR_DATA_ERROR(3), |
| | | /** |
| | | * This occurs for instance when the authentication provided by the user is |
| | | * not valid. |
| | | */ |
| | | /** This occurs for instance when the authentication provided by the user is not valid. */ |
| | | ERROR_READING_CONFIGURATION_WITH_LDAP(4); |
| | | |
| | | private int returnCode; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The splash screen for the control panel. |
| | | * |
| | | */ |
| | | /** The splash screen for the control panel. */ |
| | | class ControlPanelSplashScreen extends org.opends.quicksetup.SplashScreen |
| | | { |
| | | private static final long serialVersionUID = 4472839063380302713L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cancels the searching/refreshing process. |
| | | * |
| | | */ |
| | | /** Cancels the searching/refreshing process. */ |
| | | public void cancel() { |
| | | cancelled = true; |
| | | } |
| | |
| | | return cancelled; |
| | | } |
| | | |
| | | /** |
| | | * The method that is called to refresh/search the node. |
| | | */ |
| | | /** The method that is called to refresh/search the node. */ |
| | | @Override |
| | | public abstract void run(); |
| | | } |
| | |
| | | public class BrowserController |
| | | implements TreeExpansionListener, ReferralAuthenticationListener |
| | | { |
| | | /** |
| | | * The mask used to display the number of ACIs or not. |
| | | */ |
| | | /** The mask used to display the number of ACIs or not. */ |
| | | private static final int DISPLAY_ACI_COUNT = 0x01; |
| | | |
| | | /** |
| | | * The list of attributes that are used to sort the entries (if the sorting |
| | | * option is used). |
| | | */ |
| | | /** The list of attributes that are used to sort the entries (if the sorting option is used). */ |
| | | private static final String[] SORT_ATTRIBUTES = |
| | | { "cn", "givenname", "o", "ou", "sn", "uid" }; |
| | | |
| | |
| | | */ |
| | | private static final String RDN_ATTRIBUTE = "rdn attribute"; |
| | | |
| | | /** |
| | | * The filter used to retrieve all the entries. |
| | | */ |
| | | /** The filter used to retrieve all the entries. */ |
| | | public static final String ALL_OBJECTS_FILTER = |
| | | "(|(objectClass=*)(objectClass=ldapsubentry))"; |
| | | |
| | |
| | | startRefreshNode(node, null, false); |
| | | } |
| | | |
| | | /** |
| | | * Notify this controller that authentication data have changed in the |
| | | * connection pool. |
| | | */ |
| | | /** Notify this controller that authentication data have changed in the connection pool. */ |
| | | @Override |
| | | public void notifyAuthDataChanged() { |
| | | notifyAuthDataChanged(null); |
| | |
| | | startRefreshNode(node, null, true); |
| | | } |
| | | |
| | | /** |
| | | * Stop the current refreshing. |
| | | * Nodes being expanded are collapsed. |
| | | */ |
| | | /** Stop the current refreshing. Nodes being expanded are collapsed. */ |
| | | private void stopRefresh() { |
| | | stopRefreshNode(rootNode); |
| | | // TODO: refresh must be stopped in a clean state. |
| | |
| | | * are not invoked directly by the task classes: they are |
| | | * invoked using SwingUtilities.invokeAndWait() (each of the |
| | | * methods XXX() below has a matching wrapper invokeXXX()). |
| | | * |
| | | */ |
| | | |
| | | /** |
| | |
| | | updateNodeRendering(node, task.getDisplayedEntry()); |
| | | nodeChanged = true; |
| | | if (node.isLeaf()) { |
| | | /* We didn't detect any child: remove the previously existing |
| | | * ones */ |
| | | /* We didn't detect any child: remove the previously existing ones */ |
| | | removeAllChildNodes(node, false /* Remove suffixes */); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Collection utilities |
| | | */ |
| | | /** Collection utilities. */ |
| | | /** |
| | | * Returns an array of integer from a Collection of Integer objects. |
| | | * @param v the Collection of Integer objects. |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * The default implementation of the BrowserNodeInfo interface. |
| | | */ |
| | | /** The default implementation of the BrowserNodeInfo interface. */ |
| | | private class BrowserNodeInfoImpl implements BrowserNodeInfo |
| | | { |
| | | private BasicNode node; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | |
| | | */ |
| | | public class IconPool { |
| | | |
| | | /** |
| | | * Mask for the leaf node. |
| | | */ |
| | | /** Mask for the leaf node. */ |
| | | public static final int MODIFIER_LEAF = 0x01; |
| | | /** |
| | | * Mask for the referral node. |
| | | */ |
| | | /** Mask for the referral node. */ |
| | | public static final int MODIFIER_REFERRAL = 0x02; |
| | | /** |
| | | * Mask for the node that has an error. |
| | | */ |
| | | /** Mask for the node that has an error. */ |
| | | public static final int MODIFIER_ERROR = 0x04; |
| | | |
| | | private final HashMap<String, ImageIcon> iconTable = new HashMap<>(); |
| | |
| | | private ImageIcon errorMaskIcon; |
| | | private ImageIcon referralMaskIcon; |
| | | |
| | | /** |
| | | * The path that contains the icons. |
| | | */ |
| | | /** The path that contains the icons. */ |
| | | public static final String IMAGE_PATH = |
| | | "org/opends/guitools/controlpanel/images"; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Notifies the listeners that a referral authentication change happened. |
| | | * |
| | | */ |
| | | /** Notifies the listeners that a referral authentication change happened. */ |
| | | private void notifyListeners() |
| | | { |
| | | for (ReferralAuthenticationListener listener : listeners) |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * A structure representing authentication data. |
| | | */ |
| | | /** A structure representing authentication data. */ |
| | | class AuthRecord { |
| | | String dn; |
| | | String password; |
| | | } |
| | | |
| | | /** |
| | | * A structure representing an active connection. |
| | | */ |
| | | /** A structure representing an active connection. */ |
| | | class ConnectionRecord { |
| | | InitialLdapContext ctx; |
| | | int counter; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | |
| | | * |
| | | * The queue will basically start a certain number of threads and this threads |
| | | * will "consume" the AbstractNodeTask objects that are added to this queue. |
| | | * |
| | | */ |
| | | class NodeSearcherQueue implements Runnable { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Shutdown this queue. |
| | | * All the associated threads are stopped. |
| | | */ |
| | | /** Shutdown this queue. All the associated threads are stopped. */ |
| | | public void shutdown() { |
| | | threadGroup.interrupt(); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cancel all the object from this queue. |
| | | */ |
| | | /** Cancel all the object from this queue. */ |
| | | public synchronized void cancelAll() { |
| | | waitingQueue.clear(); |
| | | for (BasicNode node : workingList.keySet()) |
| | |
| | | * the NodeSearchQueue constructor. |
| | | * Basically this method fetches objects from the waiting queue and runs them. |
| | | */ |
| | | @Override |
| | | public void run() { |
| | | boolean interrupted = false; |
| | | while (!interrupted) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | /** |
| | | * Abstract class used to describe the configuration of an index. |
| | | * |
| | | */ |
| | | /** Abstract class used to describe the configuration of an index. */ |
| | | public abstract class AbstractIndexDescriptor |
| | | implements Comparable<AbstractIndexDescriptor> |
| | | { |
| | |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Method used to minimize the times the hashcode is calculated. |
| | | * |
| | | */ |
| | | /** Method used to minimize the times the hashcode is calculated. */ |
| | | protected abstract void recalculateHashCode(); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | * Table Model used to store information about indexes. It is used basically |
| | | * by the tables that appear on the right side of the 'Manage Indexes...' |
| | | * dialog when the user clicks on 'Indexes' or 'VLV Indexes'. |
| | | * |
| | | */ |
| | | public abstract class AbstractIndexTableModel extends SortableTableModel |
| | | implements Comparator<AbstractIndexDescriptor> |
| | |
| | | private ArrayList<String[]> dataArray = new ArrayList<>(); |
| | | private ArrayList<AbstractIndexDescriptor> indexArray = new ArrayList<>(); |
| | | private final String[] COLUMN_NAMES = getColumnNames(); |
| | | /** |
| | | * The sort column of the table. |
| | | */ |
| | | /** The sort column of the table. */ |
| | | protected int sortColumn; |
| | | /** |
| | | * Whether the sorting is ascending or descending. |
| | | */ |
| | | /** Whether the sorting is ascending or descending. */ |
| | | protected boolean sortAscending = true; |
| | | private ControlPanelInfo info; |
| | | |
| | |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | @Override |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return COLUMN_NAMES.length; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | | } |
| | |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | @Override |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | @Override |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | @Override |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | @Override |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | |
| | | return getRebuildRequiredString(i1).compareTo(getRebuildRequiredString(i2)); |
| | | } |
| | | |
| | | /** |
| | | * Updates the array data. This includes resorting it. |
| | | */ |
| | | /** Updates the array data. This includes resorting it. */ |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<AbstractIndexDescriptor> sortedSet = new TreeSet<>(this); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | return entries; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | return monitoringEntry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | |
| | | * @param baseDns the base DNs associated with the Backend. |
| | | * @param indexes the indexes defined in the backend. |
| | | * @param vlvIndexes the VLV indexes defined in the backend. |
| | | * |
| | | */ |
| | | private void updateBaseDnsAndIndexes(Set<BaseDNDescriptor> baseDns, |
| | | Set<IndexDescriptor> indexes, Set<VLVIndexDescriptor> vlvIndexes) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | |
| | | import javax.swing.table.AbstractTableModel; |
| | | |
| | | /** |
| | | * The table used to display the backups. |
| | | * |
| | | */ |
| | | /** The table used to display the backups. */ |
| | | public class BackupTableModel extends AbstractTableModel |
| | | { |
| | | private static final long serialVersionUID = -3511425157550147124L; |
| | |
| | | backups.add(backup); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int column) |
| | | { |
| | | switch (column) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the row count. |
| | | * @return the row count. |
| | | */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return backups.size(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the column count. |
| | | * @return the column count. |
| | | */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return 4; |
| | |
| | | /** |
| | | * This class is used to represent a Base DN / Replica and is aimed to be |
| | | * used by the classes in the BackendTableModel class. |
| | | * |
| | | */ |
| | | public class BaseDNDescriptor implements Comparable<BaseDNDescriptor> |
| | | { |
| | | /** |
| | | * An enumeration describing the type of base DN for a given backend. |
| | | */ |
| | | /** An enumeration describing the type of base DN for a given backend. */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * The base DN is not replicated. |
| | | */ |
| | | /** The base DN is not replicated. */ |
| | | NOT_REPLICATED, |
| | | /** |
| | | * The base DN is replicated. |
| | | */ |
| | | /** The base DN is replicated. */ |
| | | REPLICATED, |
| | | /** |
| | | * Replication is disabled. |
| | | */ |
| | | /** Replication is disabled. */ |
| | | DISABLED |
| | | } |
| | | |
| | |
| | | return baseDn; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object v) |
| | | { |
| | |
| | | && getBackend().getBackendID().equals(desc.getBackend().getBackendID()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compareTo(BaseDNDescriptor desc) |
| | | { |
| | | int returnValue = desc.getDn().compareTo(getDn()); |
| | |
| | | * Method called when one of the elements that affect the value of the |
| | | * hashcode is modified. It is used to minimize the time spent calculating |
| | | * hashCode. |
| | | * |
| | | */ |
| | | private void recalculateHashCode() |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The table model used to display all the base DNs. |
| | | * |
| | | */ |
| | | /** The table model used to display all the base DNs. */ |
| | | public class BaseDNTableModel extends SortableTableModel |
| | | implements Comparator<BaseDNDescriptor> |
| | | { |
| | |
| | | private boolean sortAscending = true; |
| | | private boolean displayReplicationInformation; |
| | | |
| | | /** |
| | | * Key value to identify the case of a value not available because the server |
| | | * is down. |
| | | */ |
| | | /** Key value to identify the case of a value not available because the server is down. */ |
| | | public static String NOT_AVAILABLE_SERVER_DOWN = "NOT_AVAILABLE_SERVER_DOWN"; |
| | | |
| | | /** |
| | | * Key value to identify the case of a value not available because |
| | | * authentication is required. |
| | | */ |
| | | /** Key value to identify the case of a value not available because authentication is required. */ |
| | | public static String NOT_AVAILABLE_AUTHENTICATION_REQUIRED = |
| | | "NOT_AVAILABLE_AUTHENTICATION_REQUIRED"; |
| | | |
| | | /** |
| | | * Key value to identify the case of a value not available. |
| | | */ |
| | | /** Key value to identify the case of a value not available. */ |
| | | public static String NOT_AVAILABLE = "NOT_AVAILABLE"; |
| | | |
| | | /** |
| | |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | @Override |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | @Override |
| | | public int compare(BaseDNDescriptor desc1, BaseDNDescriptor desc2) |
| | | { |
| | | int result = 0; |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return displayReplicationInformation ? 6 : 4; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | @Override |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | @Override |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | @Override |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | @Override |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | */ |
| | | public enum BasicMonitoringAttributes implements MonitoringAttributes |
| | | { |
| | | /** |
| | | * Start Date. |
| | | */ |
| | | /** Start Date. */ |
| | | START_DATE(LocalizableMessage.EMPTY, ServerConstants.ATTR_START_TIME), |
| | | /** |
| | | * Current Date. |
| | | */ |
| | | /** Current Date. */ |
| | | CURRENT_DATE(LocalizableMessage.EMPTY, ServerConstants.ATTR_CURRENT_TIME), |
| | | /** |
| | | * Current Connections. |
| | | */ |
| | | /** Current Connections. */ |
| | | CURRENT_CONNECTIONS(LocalizableMessage.EMPTY, ServerConstants.ATTR_CURRENT_CONNS), |
| | | /** |
| | | * Maximum Connections. |
| | | */ |
| | | /** Maximum Connections. */ |
| | | MAX_CONNECTIONS(LocalizableMessage.EMPTY, ServerConstants.ATTR_MAX_CONNS), |
| | | /** |
| | | * Total Connections. |
| | | */ |
| | | /** Total Connections. */ |
| | | TOTAL_CONNECTIONS(LocalizableMessage.EMPTY, ServerConstants.ATTR_TOTAL_CONNS), |
| | | /** |
| | | * Average Request Backlog. |
| | | */ |
| | | /** Average Request Backlog. */ |
| | | AVERAGE_REQUEST_BACKLOG(INFO_CTRL_PANEL_AVERAGE_REQUEST_BACKLOG.get(), |
| | | TraditionalWorkQueueMonitor.ATTR_AVERAGE_BACKLOG), |
| | | /** |
| | | * Max Request Backlog. |
| | | */ |
| | | /** Max Request Backlog. */ |
| | | MAX_REQUEST_BACKLOG(INFO_CTRL_PANEL_MAX_REQUEST_BACKLOG.get(), |
| | | TraditionalWorkQueueMonitor.ATTR_MAX_BACKLOG), |
| | | /** |
| | | * Current Request Backlog. |
| | | */ |
| | | /** Current Request Backlog. */ |
| | | CURRENT_REQUEST_BACKLOG(INFO_CTRL_PANEL_CURRENT_REQUEST_BACKLOG.get(), |
| | | TraditionalWorkQueueMonitor.ATTR_CURRENT_BACKLOG), |
| | | /** |
| | | * Requests submitted. |
| | | */ |
| | | /** Requests submitted. */ |
| | | REQUESTS_SUBMITTED(INFO_CTRL_PANEL_REQUESTS_SUBMITTED.get(), |
| | | TraditionalWorkQueueMonitor.ATTR_OPS_SUBMITTED), |
| | | /** |
| | | * Requests rejected. |
| | | */ |
| | | /** Requests rejected. */ |
| | | REQUESTS_REJECTED(INFO_CTRL_PANEL_REQUESTS_REJECTED.get(), |
| | | TraditionalWorkQueueMonitor.ATTR_OPS_REJECTED_QUEUE_FULL), |
| | | /** |
| | | * Entry cache Hits. |
| | | */ |
| | | /** Entry cache Hits. */ |
| | | ENTRY_CACHE_HITS(INFO_CTRL_PANEL_ENTRY_CACHE_HITS.get(), |
| | | "entryCacheHits"), |
| | | /** |
| | | * Current entry cache count. |
| | | */ |
| | | /** Current entry cache count. */ |
| | | CURRENT_ENTRY_CACHE_COUNT(INFO_CTRL_PANEL_CURRENT_ENTRY_CACHE_COUNT.get(), |
| | | "currentEntryCacheCount"), |
| | | /** |
| | | * Entry cache tries. |
| | | */ |
| | | /** Entry cache tries. */ |
| | | ENTRY_CACHE_TRIES(INFO_CTRL_PANEL_ENTRY_CACHE_TRIES.get(), |
| | | "entryCacheTries"), |
| | | /** |
| | | * Entry cache hit ratio. |
| | | */ |
| | | /** Entry cache hit ratio. */ |
| | | ENTRY_CACHE_HIT_RATIO(INFO_CTRL_PANEL_ENTRY_CACHE_HIT_RATIO.get(), |
| | | "entryCacheHitRatio"), |
| | | /** |
| | | * Entry cache current size. |
| | | */ |
| | | /** Entry cache current size. */ |
| | | CURRENT_ENTRY_CACHE_SIZE(INFO_CTRL_PANEL_CURRENT_ENTRY_CACHE_SIZE.get(), |
| | | "currentEntryCacheSize"), |
| | | /** |
| | | * Entry cache max size. |
| | | */ |
| | | /** Entry cache max size. */ |
| | | MAX_ENTRY_CACHE_SIZE(INFO_CTRL_PANEL_MAX_ENTRY_CACHE_SIZE.get(), |
| | | "maxEntryCacheSize"), |
| | | /** |
| | | * Entry cache max count. |
| | | */ |
| | | /** Entry cache max count. */ |
| | | MAX_ENTRY_CACHE_COUNT(INFO_CTRL_PANEL_MAX_ENTRY_CACHE_COUNT.get(), |
| | | "maxEntryCacheCount"), |
| | | /** |
| | | * Available CPUs. |
| | | */ |
| | | /** Available CPUs. */ |
| | | AVAILABLE_CPUS(INFO_CTRL_PANEL_AVAILABLE_CPUS.get(), |
| | | "availableCPUs"), |
| | | /** |
| | | * System Name. |
| | | */ |
| | | /** System Name. */ |
| | | SYSTEM_NAME(INFO_CTRL_PANEL_SYSTEM_NAME.get(), |
| | | "systemName"), |
| | | /** |
| | | * Operating System. |
| | | */ |
| | | /** Operating System. */ |
| | | OPERATING_SYSTEM(INFO_CTRL_PANEL_OPERATING_SYSTEM.get(), |
| | | "operatingSystem"), |
| | | /** |
| | | * Free used memory. |
| | | */ |
| | | /** Free used memory. */ |
| | | FREE_USED_MEMORY(INFO_CTRL_PANEL_FREE_USED_MEMORY.get(), |
| | | "freeUsedMemory"), |
| | | /** |
| | | * Max memory. |
| | | */ |
| | | /** Max memory. */ |
| | | MAX_MEMORY(INFO_CTRL_PANEL_MAX_MEMORY.get(), |
| | | "maxMemory"), |
| | | /** |
| | | * Used memory. |
| | | */ |
| | | /** Used memory. */ |
| | | USED_MEMORY(INFO_CTRL_PANEL_USED_MEMORY.get(), |
| | | "usedMemory"), |
| | | /** |
| | | * Class path. |
| | | */ |
| | | /** Class path. */ |
| | | CLASS_PATH(INFO_CTRL_PANEL_CLASS_PATH.get(), |
| | | "classPath"), |
| | | /** |
| | | * Java Vendor. |
| | | */ |
| | | /** Java Vendor. */ |
| | | JAVA_VENDOR(INFO_CTRL_PANEL_JAVA_VENDOR.get(), |
| | | "javaVendor"), |
| | | /** |
| | | * JVM Vendor. |
| | | */ |
| | | /** JVM Vendor. */ |
| | | JVM_VENDOR(INFO_CTRL_PANEL_JVM_VENDOR.get(), |
| | | "javaVendor"), |
| | | /** |
| | | * Java Version. |
| | | */ |
| | | /** Java Version. */ |
| | | JAVA_VERSION(INFO_CTRL_PANEL_JAVA_VERSION.get(), |
| | | "javaVersion"), |
| | | /** |
| | | * JVM Version. |
| | | */ |
| | | /** JVM Version. */ |
| | | JVM_VERSION(INFO_CTRL_PANEL_JVM_VERSION.get(), |
| | | "jvmVersion"), |
| | | /** |
| | | * JVM Architecture. |
| | | */ |
| | | /** JVM Architecture. */ |
| | | JVM_ARCHITECTURE(INFO_CTRL_PANEL_JVM_ARCHITECTURE.get(), |
| | | "jvmArchitecture"), |
| | | /** |
| | | * JVM Arguments. |
| | | */ |
| | | /** JVM Arguments. */ |
| | | JVM_ARGUMENTS(INFO_CTRL_PANEL_JVM_ARGUMENTS.get(), |
| | | "jvmArguments"), |
| | | /** |
| | | * Add Request. |
| | | */ |
| | | /** Add Request. */ |
| | | ADD_REQUESTS(INFO_CTRL_PANEL_ADD_REQUESTS_LABEL.get(), |
| | | "addRequests"), |
| | | /** |
| | | * Add Responses. |
| | | */ |
| | | /** Add Responses. */ |
| | | ADD_RESPONSES(INFO_CTRL_PANEL_ADD_RESPONSES_LABEL.get(), |
| | | "addResponses"), |
| | | /** |
| | | * Bind Request. |
| | | */ |
| | | /** Bind Request. */ |
| | | BIND_REQUESTS(INFO_CTRL_PANEL_BIND_REQUESTS_LABEL.get(), |
| | | "bindRequests"), |
| | | /** |
| | | * Bind Responses. |
| | | */ |
| | | /** Bind Responses. */ |
| | | BIND_RESPONSES(INFO_CTRL_PANEL_BIND_RESPONSES_LABEL.get(), |
| | | "bindResponses"), |
| | | /** |
| | | * Compare Requests. |
| | | */ |
| | | /** Compare Requests. */ |
| | | COMPARE_REQUESTS(INFO_CTRL_PANEL_COMPARE_REQUESTS_LABEL.get(), |
| | | "compareRequests"), |
| | | /** |
| | | * Compare Responses. |
| | | */ |
| | | /** Compare Responses. */ |
| | | COMPARE_RESPONSES(INFO_CTRL_PANEL_COMPARE_RESPONSES_LABEL.get(), |
| | | "compareResponses"), |
| | | /** |
| | | * Delete Request. |
| | | */ |
| | | /** Delete Request. */ |
| | | DELETE_REQUESTS(INFO_CTRL_PANEL_DELETE_REQUESTS_LABEL.get(), |
| | | "deleteRequests"), |
| | | /** |
| | | * Delete Responses. |
| | | */ |
| | | /** Delete Responses. */ |
| | | DELETE_RESPONSES(INFO_CTRL_PANEL_DELETE_RESPONSES_LABEL.get(), |
| | | "deleteResponses"), |
| | | /** |
| | | * Extended Request. |
| | | */ |
| | | /** Extended Request. */ |
| | | EXTENDED_REQUESTS(INFO_CTRL_PANEL_EXTENDED_REQUESTS_LABEL.get(), |
| | | "extendedRequests"), |
| | | /** |
| | | * Extended Responses. |
| | | */ |
| | | /** Extended Responses. */ |
| | | EXTENDED_RESPONSES(INFO_CTRL_PANEL_EXTENDED_RESPONSES_LABEL.get(), |
| | | "extendedResponses"), |
| | | /** |
| | | * Modify DN Request. |
| | | */ |
| | | /** Modify DN Request. */ |
| | | MOD_DN_REQUESTS(INFO_CTRL_PANEL_MOD_DN_REQUESTS_LABEL.get(), |
| | | "modifyDNRequests"), |
| | | /** |
| | | * Modify DN Responses. |
| | | */ |
| | | /** Modify DN Responses. */ |
| | | MOD_DN_RESPONSES(INFO_CTRL_PANEL_MOD_DN_RESPONSES_LABEL.get(), |
| | | "modifyDNResponses"), |
| | | /** |
| | | * Modify Request. |
| | | */ |
| | | /** Modify Request. */ |
| | | MOD_REQUESTS(INFO_CTRL_PANEL_MOD_REQUESTS_LABEL.get(), |
| | | "modifyRequests"), |
| | | /** |
| | | * Modify Responses. |
| | | */ |
| | | /** Modify Responses. */ |
| | | MOD_RESPONSES(INFO_CTRL_PANEL_MOD_RESPONSES_LABEL.get(), |
| | | "modifyResponses"), |
| | | /** |
| | | * Search Request. |
| | | */ |
| | | /** Search Request. */ |
| | | SEARCH_REQUESTS(INFO_CTRL_PANEL_SEARCH_REQUESTS_LABEL.get(), |
| | | "searchRequests"), |
| | | /** |
| | | * Searches Done. |
| | | */ |
| | | /** Searches Done. */ |
| | | SEARCH_DONE(INFO_CTRL_PANEL_SEARCH_DONE_LABEL.get(), |
| | | "searchResultsDone"), |
| | | /** |
| | | * Unbind Request. |
| | | */ |
| | | /** Unbind Request. */ |
| | | UNBIND_REQUESTS(INFO_CTRL_PANEL_UNBIND_REQUESTS_LABEL.get(), |
| | | "unbindRequests"),; |
| | | |
| | |
| | | this.attributeName = attributeName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getMessage() |
| | | { |
| | | return msg; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAttributeName() |
| | | { |
| | | return attributeName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAborted() |
| | | { |
| | | return isAborted; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isNumeric() |
| | | { |
| | | return isNumeric; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isTime() |
| | | { |
| | | return isTime; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isGMTDate() |
| | | { |
| | | return isGMTDate; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isValueInBytes() |
| | | { |
| | | return isValueInBytes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canHaveAverage() |
| | | { |
| | | return canHaveAverage; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isNumericDate() |
| | | { |
| | | return false; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | * when the user wants to use the value in a file. To be able to reflect |
| | | * this this object is used: it contains the binary itself, the base 64 |
| | | * representation and the file that has been used. |
| | | * |
| | | */ |
| | | public class BinaryValue |
| | | { |
| | |
| | | private File file; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * The type of the binary value. |
| | | * |
| | | */ |
| | | /** The type of the binary value. */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * The binary value is provided as Base 64 string. |
| | | */ |
| | | /** The binary value is provided as Base 64 string. */ |
| | | BASE64_STRING, |
| | | /** |
| | | * The binary value is provided as a byte array. |
| | | */ |
| | | /** The binary value is provided as a byte array. */ |
| | | BYTE_ARRAY |
| | | } |
| | | |
| | | /** |
| | | * This is done to force the use of the factory methods (createBase64 and |
| | | * createFromFile). |
| | | * |
| | | */ |
| | | /** This is done to force the use of the factory methods (createBase64 and createFromFile). */ |
| | | private BinaryValue() |
| | | { |
| | | } |
| | |
| | | return file; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | | if (this == o) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | /** |
| | | * Class used in the combo box models. It is used to have special rendering in |
| | | * the combo boxes. |
| | | */ |
| | | /** Class used in the combo box models. It is used to have special rendering in the combo boxes. */ |
| | | public class CategorizedComboBoxElement |
| | | { |
| | | private Object value; |
| | | private Type type; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * The type of the element. |
| | | * |
| | | */ |
| | | /** The type of the element. */ |
| | | public enum Type |
| | | { |
| | | /** |
| | |
| | | * type category, for instance). |
| | | */ |
| | | CATEGORY, |
| | | /** |
| | | * Regular type. |
| | | */ |
| | | /** Regular type. */ |
| | | REGULAR |
| | | } |
| | | |
| | |
| | | return type; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | | if (o instanceof CategorizedComboBoxElement) |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * Exception that occurs reading the server configuration. |
| | | * |
| | | */ |
| | | /** Exception that occurs reading the server configuration. */ |
| | | public class ConfigReadException extends OpenDsException |
| | | { |
| | | private static final long serialVersionUID = 1266482779183126905L; |
| | |
| | | this.monitoringEntries = Collections.unmodifiableSet(monitoringEntries); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return toString; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | /** |
| | | * The table model used by the table that displays the connection handlers. |
| | | * |
| | | */ |
| | | import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor.State; |
| | | |
| | | /** The table model used by the table that displays the connection handlers. */ |
| | | public class ConnectionHandlerTableModel extends SortableTableModel |
| | | implements Comparator<ConnectionHandlerDescriptor> |
| | | { |
| | |
| | | private int sortColumn; |
| | | private boolean sortAscending = true; |
| | | |
| | | /** |
| | | * Constructor for this table model. |
| | | */ |
| | | /** Constructor for this table model. */ |
| | | public ConnectionHandlerTableModel() |
| | | { |
| | | this(true); |
| | |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | @Override |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | @Override |
| | | public int compare(ConnectionHandlerDescriptor desc1, |
| | | ConnectionHandlerDescriptor desc2) |
| | | { |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return 3; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | @Override |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | @Override |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | @Override |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | @Override |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | |
| | | |
| | | private String getProtocolString(ConnectionHandlerDescriptor desc) |
| | | { |
| | | String returnValue; |
| | | switch (desc.getProtocol()) |
| | | { |
| | | case OTHER: |
| | | returnValue = desc.getName(); |
| | | break; |
| | | return desc.getName(); |
| | | default: |
| | | returnValue = desc.getProtocol().getDisplayMessage().toString(); |
| | | break; |
| | | return desc.getProtocol().getDisplayMessage().toString(); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | private void updateDataArray() |
| | |
| | | dataArray.clear(); |
| | | for (ConnectionHandlerDescriptor desc : sortedSet) |
| | | { |
| | | String[] s = new String[3]; |
| | | s[0] = getAddressPortString(desc); |
| | | s[1] = getProtocolString(desc); |
| | | dataArray.add(new String[] { |
| | | getAddressPortString(desc), |
| | | getProtocolString(desc), |
| | | toLabel(desc.getState()) |
| | | }); |
| | | } |
| | | } |
| | | |
| | | switch (desc.getState()) |
| | | private String toLabel(State state) |
| | | { |
| | | switch (state) |
| | | { |
| | | case ENABLED: |
| | | s[2] = INFO_ENABLED_LABEL.get().toString(); |
| | | break; |
| | | |
| | | return INFO_ENABLED_LABEL.get().toString(); |
| | | case DISABLED: |
| | | s[2] = INFO_DISABLED_LABEL.get().toString(); |
| | | break; |
| | | |
| | | return INFO_DISABLED_LABEL.get().toString(); |
| | | case UNKNOWN: |
| | | s[2] = INFO_UNKNOWN_LABEL.get().toString(); |
| | | break; |
| | | |
| | | return INFO_UNKNOWN_LABEL.get().toString(); |
| | | default: |
| | | throw new RuntimeException("Unknown state: "+desc.getState()); |
| | | } |
| | | dataArray.add(s); |
| | | throw new RuntimeException("Unknown state: " + state); |
| | | } |
| | | } |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | import static org.opends.guitools.controlpanel.util.Utilities.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | /** |
| | | * The table model used to display the monitoring information of connection |
| | | * handlers. |
| | | */ |
| | | /** The table model used to display the monitoring information of connection handlers. */ |
| | | public class ConnectionHandlersMonitoringTableModel extends |
| | | MonitoringTableModel<ConnectionHandlerDescriptor, |
| | | AddressConnectionHandlerDescriptor> |
| | | { |
| | | private static final long serialVersionUID = -8891998773191495L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Set<AddressConnectionHandlerDescriptor> convertToInternalData( |
| | | Set<ConnectionHandlerDescriptor> newData) |
| | |
| | | return newAddresses; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(AddressConnectionHandlerDescriptor desc1, |
| | | AddressConnectionHandlerDescriptor desc2) |
| | |
| | | return getName(ach1).compareTo(getName(ach2)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected CustomSearchResult getMonitoringEntry( |
| | | AddressConnectionHandlerDescriptor ach) |
| | |
| | | return ach.getMonitoringEntry(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getName(AddressConnectionHandlerDescriptor ach) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getNameHeader() |
| | | { |
| | |
| | | /** |
| | | * The table model has one line per address, this object represents that |
| | | * address and all the associated monitoring information. |
| | | * |
| | | */ |
| | | class AddressConnectionHandlerDescriptor |
| | | { |
| | |
| | | return monitoringEntry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | |
| | | /** |
| | | * Policy to follow to choose the protocol to be used. |
| | | * |
| | | * */ |
| | | /** Policy to follow to choose the protocol to be used. */ |
| | | public enum ConnectionProtocolPolicy |
| | | { |
| | | /** |
| | | * Force to use Start TLS. |
| | | */ |
| | | /** Force to use Start TLS. */ |
| | | USE_STARTTLS, |
| | | /** |
| | | * Force to use LDAP. |
| | | */ |
| | | /** Force to use LDAP. */ |
| | | USE_LDAP, |
| | | /** |
| | | * Force to use LDAPs. |
| | | */ |
| | | /** Force to use LDAPs. */ |
| | | USE_LDAPS, |
| | | /** |
| | | * Force to use the Administration Connector. |
| | | */ |
| | | /** Force to use the Administration Connector. */ |
| | | USE_ADMIN, |
| | | /** |
| | | * Use the most secure available (LDAPs, StartTLS and finally LDAP). |
| | | */ |
| | | /** Use the most secure available (LDAPs, StartTLS and finally LDAP). */ |
| | | USE_MOST_SECURE_AVAILABLE, |
| | | /** |
| | | * Use the less secure available (LDAP, and then LDAPs). |
| | | */ |
| | | /** Use the less secure available (LDAP, and then LDAPs). */ |
| | | USE_LESS_SECURE_AVAILABLE; |
| | | |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | fireTableDataChanged(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return columnNames.length; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return columnNames[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(BackendDescriptor desc1, BackendDescriptor desc2) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Updates the array data. This includes resorting it. |
| | | */ |
| | | /** Updates the array data. This includes resorting it. */ |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<BackendDescriptor> sortedSet = new TreeSet<>(this); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | fireTableDataChanged(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return columnNames.length; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return columnNames[col]; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Updates the array data. This includes resorting it. |
| | | */ |
| | | /** Updates the array data. This includes resorting it. */ |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<P> sortedSet = new TreeSet<>(this); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | return structural; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | | if (this == o) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | return cronValue; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | | if (o == this) |
| | |
| | | && toString().equals(o.toString()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return toString; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | |
| | | this.taskEntries = Collections.unmodifiableSet(taskEntries); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | && desc.getTaskEntries().equals(getTaskEntries()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | * of calls to the add/remove methods and a single call to notify that |
| | | * things have changed is enough. |
| | | * |
| | | * @param <T> |
| | | * @param <T> type of the elements in this list model |
| | | */ |
| | | public class SortableListModel<T> extends AbstractListModel |
| | | public class SortableListModel<T> extends AbstractListModel<T> |
| | | { |
| | | private static final long serialVersionUID = 3241258779190228463L; |
| | | private SortedSet<T> data = new TreeSet<>(); |
| | | |
| | | /** |
| | | * Returns the size of the list model. |
| | | * @return the size of the list model. |
| | | */ |
| | | @Override |
| | | public int getSize() |
| | | { |
| | | return data.size(); |
| | |
| | | data.addAll(copy); |
| | | } |
| | | |
| | | /** |
| | | * Returns the element at the specified index. |
| | | * @param i the index of the element. |
| | | * @return the element at the specified index. |
| | | */ |
| | | @Override |
| | | public T getElementAt(int i) |
| | | { |
| | | int index = 0; |
| | |
| | | return data.remove(value); |
| | | } |
| | | |
| | | /** |
| | | * Clears the list model. |
| | | * |
| | | */ |
| | | /** Clears the list model. */ |
| | | public void clear() |
| | | { |
| | | data.clear(); |
| | |
| | | data.addAll(newData); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void fireContentsChanged(Object source, int index0, int index1) |
| | | { |
| | | super.fireContentsChanged(source, index0, index1); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * A generic interface that must implement table models that are sortable. |
| | | */ |
| | | /** A generic interface that must implement table models that are sortable. */ |
| | | public abstract class SortableTableModel extends AbstractTableModel |
| | | { |
| | | private static final long serialVersionUID = 123129879083L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.forgerock.util.Utils.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.tools.tasks.TaskEntry; |
| | | |
| | | /** |
| | | * The table used to display the tasks. |
| | | * |
| | | */ |
| | | /** The table used to display the tasks. */ |
| | | public class TaskTableModel extends SortableTableModel |
| | | implements Comparator<TaskEntry> |
| | | { |
| | | private static final long serialVersionUID = -351142550147124L; |
| | | private Set<TaskEntry> data = new HashSet<>(); |
| | | private ArrayList<TaskEntry> dataSourceArray = new ArrayList<>(); |
| | | private final Set<TaskEntry> data = new HashSet<>(); |
| | | private final List<TaskEntry> dataSourceArray = new ArrayList<>(); |
| | | |
| | | LinkedHashSet<LocalizableMessage> displayedAttributes = new LinkedHashSet<>(); |
| | | final LinkedHashSet<LocalizableMessage> defaultAttributes = new LinkedHashSet<>(); |
| | | { |
| | | defaultAttributes.add(INFO_TASKINFO_FIELD_ID.get()); |
| | | defaultAttributes.add(INFO_TASKINFO_FIELD_TYPE.get()); |
| | | defaultAttributes.add(INFO_TASKINFO_FIELD_STATUS.get()); |
| | | defaultAttributes.add(INFO_CTRL_PANEL_TASK_CANCELABLE.get()); |
| | | } |
| | | LinkedHashSet<LocalizableMessage> allAttributes = new LinkedHashSet<>(); |
| | | { |
| | | allAttributes.addAll(defaultAttributes); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_SCHEDULED_START.get()); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_ACTUAL_START.get()); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_COMPLETION_TIME.get()); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_DEPENDENCY.get()); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_FAILED_DEPENDENCY_ACTION.get()); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_NOTIFY_ON_COMPLETION.get()); |
| | | allAttributes.add(INFO_TASKINFO_FIELD_NOTIFY_ON_ERROR.get()); |
| | | } |
| | | private final Set<LocalizableMessage> displayedAttributes = new LinkedHashSet<>(); |
| | | private final Set<LocalizableMessage> defaultAttributes = newLinkedHashSet( |
| | | INFO_TASKINFO_FIELD_ID.get(), |
| | | INFO_TASKINFO_FIELD_TYPE.get(), |
| | | INFO_TASKINFO_FIELD_STATUS.get(), |
| | | INFO_CTRL_PANEL_TASK_CANCELABLE.get() |
| | | ); |
| | | private LinkedHashSet<LocalizableMessage> allAttributes = newLinkedHashSet( |
| | | INFO_TASKINFO_FIELD_SCHEDULED_START.get(), |
| | | INFO_TASKINFO_FIELD_ACTUAL_START.get(), |
| | | INFO_TASKINFO_FIELD_COMPLETION_TIME.get(), |
| | | INFO_TASKINFO_FIELD_DEPENDENCY.get(), |
| | | INFO_TASKINFO_FIELD_FAILED_DEPENDENCY_ACTION.get(), |
| | | INFO_TASKINFO_FIELD_NOTIFY_ON_COMPLETION.get(), |
| | | INFO_TASKINFO_FIELD_NOTIFY_ON_ERROR.get() |
| | | ); |
| | | |
| | | private String[] columnNames = {}; |
| | | |
| | | /** |
| | | * The sort column of the table. |
| | | */ |
| | | /** The sort column of the table. */ |
| | | private int sortColumn; |
| | | /** |
| | | * Whether the sorting is ascending or descending. |
| | | */ |
| | | /** Whether the sorting is ascending or descending. */ |
| | | private boolean sortAscending = true; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public TaskTableModel() |
| | | { |
| | | super(); |
| | |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | @Override |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | |
| | | fireTableDataChanged(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the array data. This includes resorting it. |
| | | */ |
| | | /** Updates the array data. This includes resorting it. */ |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<TaskEntry> sortedSet = new TreeSet<>(this); |
| | |
| | | * Sets the operations displayed by this table model. |
| | | * @param attributes the attributes displayed by this table model. |
| | | */ |
| | | public void setAttributes(LinkedHashSet<LocalizableMessage> attributes) |
| | | public void setAttributes(Set<LocalizableMessage> attributes) |
| | | { |
| | | if (!allAttributes.containsAll(attributes)) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Class<?> getColumnClass(int column) |
| | | { |
| | | return LocalizableMessage.class; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return columnNames[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int column) |
| | | { |
| | | LocalizableMessage value; |
| | |
| | | * Returns the row count. |
| | | * @return the row count. |
| | | */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataSourceArray.size(); |
| | |
| | | * Returns the column count. |
| | | * @return the column count. |
| | | */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return columnNames.length; |
| | |
| | | * Returns the set of attributes ordered. |
| | | * @return the set of attributes ordered. |
| | | */ |
| | | public LinkedHashSet<LocalizableMessage> getDisplayedAttributes() |
| | | public Set<LocalizableMessage> getDisplayedAttributes() |
| | | { |
| | | return displayedAttributes; |
| | | } |
| | |
| | | return allAttributes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(TaskEntry desc1, TaskEntry desc2) |
| | | { |
| | | int result; |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | @Override |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | @Override |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | @Override |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | @Override |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | |
| | | |
| | | private LocalizableMessage getValue(List<String> values, LocalizableMessage valueIfEmpty) |
| | | { |
| | | LocalizableMessage msg; |
| | | if (values.isEmpty()) |
| | | { |
| | | msg = valueIfEmpty; |
| | | return valueIfEmpty; |
| | | } |
| | | else |
| | | { |
| | | String s = joinAsString("<br>", values); |
| | | if (values.size() > 1) |
| | | if (values.size() <= 1) |
| | | { |
| | | msg = LocalizableMessage.raw( |
| | | "<html>"+Utilities.applyFont(s, ColorAndFontConstants.tableFont)); |
| | | return LocalizableMessage.raw(s); |
| | | } |
| | | else |
| | | { |
| | | msg = LocalizableMessage.raw(s); |
| | | } |
| | | } |
| | | return msg; |
| | | return LocalizableMessage.raw("<html>" + Utilities.applyFont(s, ColorAndFontConstants.tableFont)); |
| | | } |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | * table that appears on the right side of the Manage Index dialog when the user |
| | | * clicks on the node "VLV Indexes" and it gives a global view of the VLV |
| | | * indexes defined on a given backend. |
| | | * |
| | | */ |
| | | public class VLVIndexTableModel extends AbstractIndexTableModel |
| | | { |
| | | private static final long serialVersionUID = 897379916278218775L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String[] getColumnNames() |
| | | { |
| | | return new String[] { |
| | |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | @Override |
| | | public int compare(AbstractIndexDescriptor index1, |
| | | AbstractIndexDescriptor index2) |
| | | { |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String[] getLine(AbstractIndexDescriptor index) |
| | | { |
| | | VLVIndexDescriptor i = (VLVIndexDescriptor)index; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | /** |
| | | * Class that describes the VLV sort order. |
| | | */ |
| | | /** Class that describes the VLV sort order. */ |
| | | public class VLVSortOrder |
| | | { |
| | | private String attributeName; |
| | |
| | | return isAscending; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | | if (o == this) { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * The listeners that receive notifications when a set of backends are |
| | | * populated. |
| | | * |
| | | */ |
| | | /** The listeners that receive notifications when a set of backends are populated. */ |
| | | public interface BackendPopulatedListener |
| | | { |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.BackupDescriptor; |
| | | |
| | | /** |
| | | * The event used to notify that a backup has been created. |
| | | * |
| | | */ |
| | | /** The event used to notify that a backup has been created. */ |
| | | public class BackupCreatedEvent |
| | | { |
| | | private BackupDescriptor newBackup; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * The listeners that receive notifications when a backup is created. |
| | | * |
| | | */ |
| | | /** The listeners that receive notifications when a backup is created. */ |
| | | public interface BackupCreatedListener |
| | | { |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | * in the buttons and text fields so that a file chooser will be displayed |
| | | * when the user clicks on the button and if the user chooses a file or a |
| | | * directory the text field will be updated accordingly. |
| | | * |
| | | */ |
| | | public class BrowseActionListener implements ActionListener |
| | | { |
| | |
| | | |
| | | private BrowseType type; |
| | | |
| | | /** |
| | | * Enumeration used to specify which kind of file browser dialog must be |
| | | * displayed. |
| | | * |
| | | */ |
| | | /** Enumeration used to specify which kind of file browser dialog must be displayed. */ |
| | | public enum BrowseType |
| | | { |
| | | /** |
| | | * The Browser is used to retrieve a directory. |
| | | */ |
| | | /** The Browser is used to retrieve a directory. */ |
| | | LOCATION_DIRECTORY, |
| | | /** |
| | | * The Browser is used to retrieve an LDIF file. |
| | | */ |
| | | /** The Browser is used to retrieve an LDIF file. */ |
| | | OPEN_LDIF_FILE, |
| | | /** |
| | | * The Browser is used to retrieve a .zip file. |
| | | */ |
| | | /** The Browser is used to retrieve a .zip file. */ |
| | | OPEN_ZIP_FILE, |
| | | /** |
| | | * The Browser is used to retrieve a generic file. |
| | | */ |
| | | /** The Browser is used to retrieve a generic file. */ |
| | | OPEN_GENERIC_FILE, |
| | | /** |
| | | * The Browser is used to create a generic file. |
| | | */ |
| | | /** The Browser is used to create a generic file. */ |
| | | CREATE_GENERIC_FILE, |
| | | /** |
| | | * The Browser is used to create an LDIF file. |
| | | */ |
| | | /** The Browser is used to create an LDIF file. */ |
| | | CREATE_LDIF_FILE, |
| | | /** |
| | | * The Browser is used to create a generic directory. |
| | | */ |
| | | /** The Browser is used to create a generic directory. */ |
| | | CREATE_DIRECTORY |
| | | } |
| | | |
| | |
| | | * dialog. |
| | | * |
| | | * @param e the ActionEvent we receive. |
| | | * |
| | | */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) |
| | | { |
| | | int returnVal; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The method that is called after the text field is updated. |
| | | * |
| | | */ |
| | | /** The method that is called after the text field is updated. */ |
| | | protected void fieldUpdated() |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * browse events. |
| | | * |
| | | */ |
| | | /** Interface that must be implemented by the objects that want to receive browse events. */ |
| | | public interface BrowserEventListener extends java.util.EventListener { |
| | | |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | /** |
| | | * This class listens to events and displays a tooltip when the user clicks on |
| | | * the object that registered this listener. |
| | | * |
| | | */ |
| | | public class ClickTooltipDisplayer extends MouseAdapter |
| | | { |
| | | private boolean isTooltipVisible; |
| | | private Popup tipWindow; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseExited(MouseEvent event) |
| | | { |
| | | hideToolTip(event); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mousePressed(MouseEvent event) |
| | | { |
| | | if (isTooltipVisible) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | |
| | | list = new JList(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int selectionForKey(char key, ComboBoxModel model) |
| | | { |
| | | int selectedIndex = -1; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | * the scrollpane if no scrollbars are visible. So the code basically adds |
| | | * a component listener to the scroll pane and depending on whether the scroll |
| | | * bars are displayed or not some border to the scroll pane is added (or not). |
| | | * |
| | | */ |
| | | public class ScrollPaneBorderListener extends ComponentAdapter |
| | | { |
| | |
| | | private Border etchedBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, |
| | | ColorAndFontConstants.defaultBorderColor); |
| | | |
| | | /** |
| | | * Private constructor. |
| | | * |
| | | */ |
| | | /** Private constructor. */ |
| | | private ScrollPaneBorderListener() |
| | | { |
| | | } |
| | |
| | | return listener; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void componentShown(ComponentEvent ev) |
| | | { |
| | | updateBorder(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void componentHidden(ComponentEvent ev) |
| | | { |
| | | updateBorder(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the border depending on whether the scroll bars are visible or not. |
| | | * |
| | | */ |
| | | /** Updates the border depending on whether the scroll bars are visible or not. */ |
| | | public void updateBorder() |
| | | { |
| | | boolean displayBorder = scroll.getVerticalScrollBar().isVisible() || |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | |
| | | import javax.swing.text.JTextComponent; |
| | | |
| | | /** |
| | | * A class used to be able to select the contents of the text field when |
| | | * it gets the focus. |
| | | * |
| | | */ |
| | | /** A class used to be able to select the contents of the text field when it gets the focus. */ |
| | | public class TextComponentFocusListener implements FocusListener |
| | | { |
| | | private JTextComponent tf; |
| | |
| | | this.tf = tf; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | if (tf.getText() == null || "".equals(tf.getText())) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The class that is in charge of adding a set of entries to a set of static |
| | | * groups. |
| | | */ |
| | | /** The class that is in charge of adding a set of entries to a set of static groups. */ |
| | | public class AddToGroupTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.MODIFY_ENTRY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return AdminToolMessages.INFO_CTRL_PANEL_ADD_TO_GROUP_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | printEquivalentCommandToModify(groupDn, modifications, false); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | import org.opends.server.tools.ManageTasks; |
| | | import org.opends.server.tools.tasks.TaskEntry; |
| | | |
| | | /** |
| | | * Task used to cancel tasks in server. |
| | | * |
| | | */ |
| | | /** Task used to cancel tasks in server. */ |
| | | public class CancelTaskTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | this.tasks = new ArrayList<>(tasks); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | // TODO: change this |
| | | return Type.MODIFY_ENTRY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_CANCEL_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<>(); |
| | |
| | | return args; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(true); |
| | |
| | | final boolean isFirst = numberCanceled == 0; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (isFirst) |
| | |
| | | final int fNumberCanceled = numberCanceled; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (fNumberCanceled == 1) |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The task that is launched when an entry must be deleted. |
| | | */ |
| | | /** The task that is launched when an entry must be deleted. */ |
| | | public class DeleteEntryTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.DELETE_ENTRY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_ENTRY_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | toNotify.clear(); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | notifyEntriesDeleted(fToNotify); |
| | |
| | | // Only display the first entry equivalent command-line. |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (!equivalentCommandWithoutControlPrinted) |
| | |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | |
| | | // Only display the first entry equivalent command-line. |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (!equivalentCommandWithControlPrinted) |
| | |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | |
| | | this.attrsToDelete.addAll(allAttrsToDelete); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.NEW_SCHEMA_ELEMENT; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected List<String> getCommandLineArguments() |
| | | { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | |
| | | /** |
| | | * Abstract task used to factorize some code shared by different tasks involving |
| | | * indexes. |
| | | * |
| | | */ |
| | | /** Abstract task used to factorize some code shared by different tasks involving indexes. */ |
| | | public abstract class IndexTask extends Task |
| | | { |
| | | /** |
| | | * The set of backends that are affected by this task. |
| | | */ |
| | | /** The set of backends that are affected by this task. */ |
| | | protected Set<String> backendSet; |
| | | /** |
| | | * The set of base DNs that are affected by this task. |
| | | */ |
| | | /** The set of base DNs that are affected by this task. */ |
| | | protected Set<String> baseDNs; |
| | | |
| | | /** |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | |
| | | this.newAttribute = newAttribute; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.MODIFY_SCHEMA_ELEMENT; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_MODIFY_ATTRIBUTE_TASK_DESCRIPTION.get( |
| | | oldAttribute.getNameOrOID()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected List<String> getCommandLineArguments() |
| | | { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | try |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont("<br><br>", |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.MODIFY_SCHEMA_ELEMENT; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_MODIFY_OBJECTCLASS_TASK_DESCRIPTION.get( |
| | | oldObjectClass.getNameOrOID()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected List<String> getCommandLineArguments() |
| | | { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | try |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont("<br><br>", |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.NEW_ENTRY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_NEW_ENTRY_TASK_DESCRIPTION.get(dn); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | printEquivalentCommand(); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Prints the equivalent command-line in the progress dialog. |
| | | * |
| | | */ |
| | | /** Prints the equivalent command-line in the progress dialog. */ |
| | | private void printEquivalentCommand() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(getObfuscatedCommandLineArguments( |
| | |
| | | useAdminCtx = controller.isConfigurationNode(node); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.MODIFY_ENTRY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_RESET_USER_PASSWORD_TASK_DESCRIPTION.get( |
| | | node.getDN()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("ldappasswordmodify"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | |
| | | return args; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The task called when we want to restart the server. |
| | | * |
| | | */ |
| | | /** The task called when we want to restart the server. */ |
| | | public class RestartServerTask extends StartStopTask |
| | | { |
| | | private boolean starting; |
| | |
| | | startTask = new StartServerTask(info, dlg); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | if (starting) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_RESTART_SERVER_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | |
| | | return getCommandLinePath("stop-ds"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | final ProgressDialog dlg = getProgressDialog(); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | String cmdLine = getStopCommandLineName(); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The task called when we want to start the server. |
| | | * |
| | | */ |
| | | /** The task called when we want to start the server. */ |
| | | public class StartServerTask extends StartStopTask |
| | | { |
| | | |
| | |
| | | super(info, dlg); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.START_SERVER; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_START_SERVER_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("start-ds"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * An abstract class used to re-factor some code between the start, stop and |
| | | * restart tasks. |
| | | */ |
| | | /** An abstract class used to re-factor some code between the start, stop and restart tasks. */ |
| | | public abstract class StartStopTask extends Task |
| | | { |
| | | Set<String> backendSet; |
| | |
| | | |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | getInfo().startPooling(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<>(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The task called when we want to start the server. |
| | | * |
| | | */ |
| | | /** The task called when we want to start the server. */ |
| | | public class StopServerTask extends StartStopTask |
| | | { |
| | | |
| | |
| | | super(info, dlg); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.STOP_SERVER; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_STOP_SERVER_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | super.runTask(); |
| | |
| | | // Verify that the server is actually stopped |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("stop-ds"); |
| | |
| | | * Method called just after calling the command-line. To be overwritten |
| | | * by the inheriting classes. |
| | | */ |
| | | @Override |
| | | protected void postCommandLine() |
| | | { |
| | | if (returnCode != 0) |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | * class are the two panels that appear on the right side of the |
| | | * 'Manage Indexes...' dialog when the user clicks on 'Indexes' or |
| | | * 'VLV Indexes'. |
| | | * |
| | | */ |
| | | public abstract class AbstractBackendIndexesPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 2702054131388877743L; |
| | | private String backendName; |
| | | /** |
| | | * The table model. |
| | | */ |
| | | /** The table model. */ |
| | | protected AbstractIndexTableModel tableModel; |
| | | /** |
| | | * The table contained by this panel. |
| | | */ |
| | | /** The table contained by this panel. */ |
| | | protected JTable table; |
| | | /** |
| | | * The scroll pane that contains the table. |
| | | */ |
| | | /** The scroll pane that contains the table. */ |
| | | protected JScrollPane tableScroll; |
| | | private Set<IndexSelectionListener> indexListeners = new HashSet<>(); |
| | | private int lastRowMouseOver = -1; |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return table; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | update(backendName); |
| | |
| | | final BackendDescriptor b = backend; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | updateTableModel(b); |
| | |
| | | */ |
| | | protected abstract void updateTableModel(BackendDescriptor backend); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No OK button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | |
| | | */ |
| | | protected abstract AbstractIndexTableModel getIndexTableModel(); |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | * |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | table.addMouseListener(new MouseAdapter() |
| | | { |
| | | @Override |
| | | public void mouseReleased(MouseEvent ev) |
| | | { |
| | | int selectedRow = table.getSelectedRow(); |
| | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** Call it this way to let the painting events happen. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | for (IndexSelectionListener listener : indexListeners) |
| | |
| | | }); |
| | | table.addMouseMotionListener(new MouseMotionAdapter() |
| | | { |
| | | @Override |
| | | public void mouseMoved(MouseEvent ev) |
| | | { |
| | | lastRowMouseOver = table.rowAtPoint(ev.getPoint()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void mouseDragged(MouseEvent ev) |
| | | { |
| | | lastRowMouseOver = -1; |
| | |
| | | |
| | | private List<DN> otherBaseDns = new ArrayList<>(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public AbstractBrowseEntriesPanel() |
| | | { |
| | | super(); |
| | |
| | | return buttonsPanel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return baseDNs; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | |
| | | */ |
| | | protected abstract Component createMainPanel(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backendPopulated(BackendPopulatedEvent ev) |
| | | { |
| | |
| | | controller.setMaxChildren(MAX_NUMBER_ENTRIES); |
| | | controller.addBrowserEventListener(new BrowserEventListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processBrowserEvent(BrowserEvent ev) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | final ArrayList<LocalizableMessage> errors = new ArrayList<>(); |
| | |
| | | { |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | @Override |
| | | public Void processBackgroundTask() |
| | | { |
| | | try |
| | |
| | | checkSyntax(errors); |
| | | return null; |
| | | } |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, Throwable t) |
| | | { |
| | | if (t != null) |
| | |
| | | Utilities.getParentDialog(this).setVisible(false); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | dlg.toFront(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | updateErrorPaneIfServerRunningAndAuthRequired(ev.getNewDescriptor(), |
| | |
| | | private GenericDialog browseGroupDlg; |
| | | private LDAPEntrySelectionPanel browseGroupPanel; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public AddToGroupPanel() |
| | | { |
| | | super(); |
| | |
| | | packParentDialog(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return groups; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | final ArrayList<LocalizableMessage> errors = new ArrayList<>(); |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Void processBackgroundTask() |
| | | { |
| | | try |
| | |
| | | updateErrors(errors); |
| | | return null; |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, Throwable t) |
| | | { |
| | | if (t != null) |
| | |
| | | worker.startBackgroundTask(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_ADD_TO_GROUP_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(browse, gbc); |
| | | browse.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | browseGroupsClicked(); |
| | |
| | | |
| | | DropTargetListener dropTargetlistener = new DropTargetListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragEnter(DropTargetDragEvent e) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragExit(DropTargetEvent e) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragOver(DropTargetDragEvent e) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dropActionChanged(DropTargetDragEvent e) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void drop(DropTargetDropEvent e) |
| | | { |
| | | try { |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | setPrimaryValid(lGroups); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | setPrimaryInvalid(lGroups); |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * Panel containing information about an attribute syntax. |
| | | * |
| | | */ |
| | | /** Panel containing information about an attribute syntax. */ |
| | | public class AttributeSyntaxPanel extends SchemaElementPanel |
| | | { |
| | | private static final long serialVersionUID = -2426247742251904863L; |
| | |
| | | private JLabel description = Utilities.createDefaultLabel(); |
| | | private JList usedByAttributes = new JList(new DefaultListModel()); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public AttributeSyntaxPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_ATTRIBUTE_SYNTAX_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return usedByAttributes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | KeyAdapter keyListener = new KeyAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void keyTyped(KeyEvent ev) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * Panel displaying a table containing the indexes of a backend. |
| | | * |
| | | */ |
| | | /** Panel displaying a table containing the indexes of a backend. */ |
| | | public class BackendIndexesPanel extends AbstractBackendIndexesPanel |
| | | { |
| | | private static final long serialVersionUID = 7214847636854721907L; |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return AdminToolMessages.INFO_CTRL_PANEL_BACKEND_INDEXES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected AbstractIndexTableModel getIndexTableModel() |
| | | { |
| | | return new IndexTableModel(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void updateTableModel(BackendDescriptor backend) |
| | | { |
| | | tableModel.setData( |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * Panel displaying a table containing the VLV indexes of a backend. |
| | | * |
| | | */ |
| | | /** Panel displaying a table containing the VLV indexes of a backend. */ |
| | | public class BackendVLVIndexesPanel extends AbstractBackendIndexesPanel |
| | | { |
| | | private static final long serialVersionUID = -5864660402543106492L; |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return AdminToolMessages.INFO_CTRL_PANEL_BACKEND_VLV_INDEXES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected AbstractIndexTableModel getIndexTableModel() |
| | | { |
| | | return new VLVIndexTableModel(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void updateTableModel(BackendDescriptor backend) |
| | | { |
| | | tableModel.setData( |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.server.types.BackupInfo; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The panel that appears when the user clicks on 'Backup...'. |
| | | * |
| | | */ |
| | | /** The panel that appears when the user clicks on 'Backup...'. */ |
| | | public class BackupPanel extends BackupListPanel |
| | | { |
| | | private static final long serialVersionUID = -1626301350756394814L; |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BackupPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_BACKUP_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return backupID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void verifyBackupClicked() |
| | | { |
| | | // Nothing to do: the button is not visible. |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | * |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent ev) |
| | | { |
| | | backends.setEnabled(!allBackends.isSelected()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Check status of incremental backup radio/checkbox |
| | | * Check status of incremental backup radio/checkbox. |
| | | * |
| | | * @return boolean true if both incremental and parent base ID |
| | | * are selected |
| | |
| | | incrementalBackup.isSelected(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | final ServerDescriptor desc = ev.getNewDescriptor(); |
| | | updateSimpleBackendComboBoxModel(backends, lNoBackendsFound, desc); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | allBackends.setVisible(backends.getModel().getSize() > 0); |
| | |
| | | INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | setPrimaryValid(lBackend); |
| | |
| | | final String path = parentDirectory.getText(); |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Void processBackgroundTask() throws Throwable |
| | | { |
| | | // Open the backup directory and make sure it is valid. |
| | |
| | | errors.add(ERR_CTRL_PANEL_BACKUP_ID_ALREADY_EXIST.get(id, path)); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | setPrimaryInvalid(lBackupID); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, |
| | | Throwable t) |
| | | { |
| | |
| | | return schedulePanel.getSchedule(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(lBackend); |
| | |
| | | super.cancelClicked(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Initialize the backup ID field with a value. |
| | | * |
| | | */ |
| | | /** Initialize the backup ID field with a value. */ |
| | | private void initializeBackupID() |
| | | { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat( |
| | |
| | | backupID.setText(id); |
| | | } |
| | | |
| | | /** |
| | | * Class that launches the backup. |
| | | * |
| | | */ |
| | | /** Class that launches the backup. */ |
| | | protected class BackupTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.BACKUP; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_BACKUP_TASK_DESCRIPTION.get( |
| | | Utilities.getStringFromCollection(backendSet, ", "), dir); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | |
| | | return args; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("backup"); |
| | |
| | | private JLabel dnLabel; |
| | | private String baseDn; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BaseDNPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_OTHER_BASE_DN_TITLE.get(); |
| | |
| | | return baseDn; |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return dn; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | setPrimaryValid(dnLabel); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(dnLabel); |
| | |
| | | super.cancelClicked(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BinaryAttributeEditorPanel() |
| | | { |
| | | super(); |
| | |
| | | // Read the file or encode the base 64 content. |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Void processBackgroundTask() throws Throwable |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, Throwable t) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return file; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | // Read the file or encode the base 64 content. |
| | | BackgroundTask<BinaryValue> worker = new BackgroundTask<BinaryValue>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public BinaryValue processBackgroundTask() throws Throwable |
| | | { |
| | |
| | | return returnValue; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(BinaryValue returnValue, Throwable t) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_EDIT_BINARY_ATTRIBUTE_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | |
| | | return valueChanged; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(Box.createHorizontalGlue(), gbc); |
| | | refreshButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | |
| | | useBase64.addActionListener(listener); |
| | | } |
| | | |
| | | /** |
| | | * Updates the enabling state of all the components in the panel. |
| | | * |
| | | */ |
| | | /** Updates the enabling state of all the components in the panel. */ |
| | | private void updateEnabling() |
| | | { |
| | | base64.setEnabled(useBase64.isSelected()); |
| | |
| | | * Class used to refresh automatically the contents in the panel after the |
| | | * user provides a path value through the JFileChooser associated with the |
| | | * browse button. |
| | | * |
| | | */ |
| | | class CustomBrowseActionListener extends BrowseActionListener |
| | | { |
| | |
| | | super(field, type, parent); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void fieldUpdated() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Called when the refresh button is clicked by the user. |
| | | * |
| | | */ |
| | | /** Called when the refresh button is clicked by the user. */ |
| | | private void refreshButtonClicked() |
| | | { |
| | | refresh(false, true); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * The panel used to display a binary value. |
| | | * |
| | | */ |
| | | /** The panel used to display a binary value. */ |
| | | public class BinaryValuePanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 2536360199438858665L; |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BinaryValuePanel() |
| | | { |
| | | super(); |
| | |
| | | lastBytes = bytes; |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Void processBackgroundTask() throws Throwable |
| | | { |
| | | try |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, Throwable t) |
| | | { |
| | | displayMainPanel(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return base64; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.CLOSE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No OK Button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_VIEW_BINARY_ATTRIBUTE_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | private boolean forceRefreshWhenOpening; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public JMenuBar getMenuBar() |
| | | { |
| | | if (menuBar == null) |
| | |
| | | return menuBar; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_MANAGE_ENTRIES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getBrowseButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.CLOSE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void createBrowserController(ControlPanelInfo info) |
| | | { |
| | | super.createBrowserController(info); |
| | | entryPane.setController(controller); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createMainPanel() |
| | | { |
| | | JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
| | |
| | | { |
| | | TreeSelectionListener treeSelectionListener = new TreeSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void valueChanged(TreeSelectionEvent ev) |
| | | { |
| | | if (ignoreTreeSelectionEvents) |
| | |
| | | final DragSource dragSource = DragSource.getDefaultDragSource(); |
| | | final DragSourceListener dragSourceListener = new DragSourceListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragDropEnd(DragSourceDropEvent dsde) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragEnter(DragSourceDragEvent dsde) |
| | | { |
| | | DragSourceContext context = dsde.getDragSourceContext(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragOver(DragSourceDragEvent dsde) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dropActionChanged(DragSourceDragEvent dsde) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragExit(DragSourceEvent dsde) |
| | | { |
| | | } |
| | | }; |
| | | final DragGestureListener dragGestureListener = new DragGestureListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void dragGestureRecognized(DragGestureEvent e) |
| | | { |
| | | //Get the selected node |
| | |
| | | ); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | | entryPane.setInfo(info); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | final ServerDescriptor desc = ev.getNewDescriptor(); |
| | |
| | | LDAPEntryReader reader; |
| | | CustomSearchResult sr; |
| | | Throwable t; |
| | | @Override |
| | | public void run() |
| | | { |
| | | while (true) |
| | |
| | | } |
| | | SwingUtilities.invokeAndWait(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | reader.backgroundTaskCompleted(sr, t); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Adds a pop up menu to the tree. |
| | | * |
| | | */ |
| | | /** Adds a pop up menu to the tree. */ |
| | | private void addPopupMenu() |
| | | { |
| | | popup = new JPopupMenu(); |
| | |
| | | INFO_CTRL_PANEL_NEW_USER_MENU.get()); |
| | | popupNewUserMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newUser(); |
| | |
| | | INFO_CTRL_PANEL_NEW_GROUP_MENU.get()); |
| | | popupNewGroupMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newGroup(); |
| | |
| | | INFO_CTRL_PANEL_NEW_ORGANIZATIONAL_UNIT_MENU.get()); |
| | | popupNewOUMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newOrganizationalUnit(); |
| | |
| | | INFO_CTRL_PANEL_NEW_ORGANIZATION_MENU.get()); |
| | | popupNewOrganizationMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newOrganization(); |
| | |
| | | INFO_CTRL_PANEL_NEW_DOMAIN_MENU.get()); |
| | | popupNewDomainMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newDomain(); |
| | |
| | | INFO_CTRL_PANEL_NEW_FROM_LDIF_MENU.get()); |
| | | popupNewEntryFromLDIFMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newEntryFromLDIF(); |
| | |
| | | INFO_CTRL_PANEL_RESET_USER_PASSWORD_MENU.get()); |
| | | popupResetUserPasswordMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | resetUserPassword(); |
| | |
| | | INFO_CTRL_PANEL_ADD_TO_GROUP_MENU.get()); |
| | | popupAddToGroupMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | addToGroup(); |
| | |
| | | INFO_CTRL_PANEL_DUPLICATE_ENTRY_MENU.get()); |
| | | popupDuplicateEntryMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | duplicateEntry(); |
| | |
| | | INFO_CTRL_PANEL_COPY_DN_MENU.get()); |
| | | popupCopyDNMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | copyDN(); |
| | |
| | | INFO_CTRL_PANEL_DELETE_ENTRY_MENU.get()); |
| | | popupDeleteMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteClicked(); |
| | |
| | | { |
| | | newGroupPanel = new NewGroupPanel(); |
| | | newGroupPanel.setInfo(getInfo()); |
| | | /* First argument: Component to associate the target with |
| | | * Second argument: DropTargetListener |
| | | */ |
| | | /* First argument: Component to associate the target with Second argument: DropTargetListener */ |
| | | newGroupDlg = new GenericDialog(Utilities.getFrame(this), newGroupPanel); |
| | | Utilities.centerGoldenMean(newGroupDlg, |
| | | Utilities.getParentDialog(this)); |
| | |
| | | { |
| | | ClipboardOwner owner = new ClipboardOwner() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void lostOwnership( Clipboard aClipboard, |
| | | Transferable aContents) { |
| | | //do nothing |
| | |
| | | frame.setVisible(true); |
| | | } |
| | | |
| | | /** |
| | | * The specific menu bar of this panel. |
| | | * |
| | | */ |
| | | /** The specific menu bar of this panel. */ |
| | | class BrowseMenuBar extends GenericMenuBar |
| | | { |
| | | private static final long serialVersionUID = 505187832236882370L; |
| | |
| | | INFO_CTRL_PANEL_NEW_BROWSER_WINDOW_MENU.get()); |
| | | newWindow.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newWindow(); |
| | |
| | | INFO_CTRL_PANEL_CLOSE_MENU.get()); |
| | | close.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | closeClicked(); |
| | |
| | | { |
| | | private boolean ignoreEvents; |
| | | private JRadioButtonMenuItem lastSelected = menus[0]; |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | if (ignoreEvents) |
| | |
| | | entryPane.getController().getFollowReferrals()); |
| | | sortUserData.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | try |
| | |
| | | }); |
| | | followReferrals.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | try |
| | |
| | | menu.add(refresh); |
| | | refresh.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | refreshClicked(); |
| | |
| | | INFO_CTRL_PANEL_NEW_USER_MENU.get()); |
| | | newUserMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newUser(); |
| | |
| | | INFO_CTRL_PANEL_NEW_GROUP_MENU.get()); |
| | | newGroupMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newGroup(); |
| | |
| | | INFO_CTRL_PANEL_NEW_ORGANIZATIONAL_UNIT_MENU.get()); |
| | | newOUMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newOrganizationalUnit(); |
| | |
| | | INFO_CTRL_PANEL_NEW_ORGANIZATION_MENU.get()); |
| | | newOrganizationMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newOrganization(); |
| | |
| | | INFO_CTRL_PANEL_NEW_DOMAIN_MENU.get()); |
| | | newDomainMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newDomain(); |
| | |
| | | INFO_CTRL_PANEL_NEW_FROM_LDIF_MENU.get()); |
| | | newEntryFromLDIFMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newEntryFromLDIF(); |
| | |
| | | INFO_CTRL_PANEL_RESET_USER_PASSWORD_MENU.get()); |
| | | resetPasswordMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | resetUserPassword(); |
| | |
| | | INFO_CTRL_PANEL_ADD_TO_GROUP_MENU.get()); |
| | | addToGroupMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | addToGroup(); |
| | |
| | | INFO_CTRL_PANEL_DUPLICATE_ENTRY_MENU.get()); |
| | | duplicateEntryMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | duplicateEntry(); |
| | |
| | | INFO_CTRL_PANEL_COPY_DN_MENU.get()); |
| | | copyDNMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | copyDN(); |
| | |
| | | INFO_CTRL_PANEL_DELETE_ENTRY_MENU.get()); |
| | | deleteMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteClicked(); |
| | |
| | | INFO_CTRL_PANEL_DELETE_BASE_DN_MENU.get()); |
| | | deleteBaseDNMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteBaseDN(); |
| | |
| | | INFO_CTRL_PANEL_DELETE_BACKEND_MENU.get()); |
| | | deleteBackendMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteBackend(); |
| | |
| | | |
| | | treePane.getTree().addTreeSelectionListener(new TreeSelectionListener() |
| | | { |
| | | @Override |
| | | public void valueChanged(TreeSelectionEvent ev) |
| | | { |
| | | if (!ignoreSelectionEvents) |
| | |
| | | entryPane.setInfo(info); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | ServerDescriptor server = ev.getNewDescriptor(); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | String serverName = getServerName(lastServer); |
| | |
| | | final LocalizableMessage fErrorDetails = errorDetails; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | errorPane.setVisible(fDisplayErrorPane); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.ViewPositions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The pane that is displayed when the user clicks on 'Browse Indexes'. |
| | | * |
| | | */ |
| | | /** The pane that is displayed when the user clicks on 'Browse Indexes'. */ |
| | | public class BrowseIndexPanel extends StatusGenericPanel |
| | | implements IndexModifiedListener |
| | | { |
| | |
| | | |
| | | private boolean firstTreeRepopulate = true; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BrowseIndexPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | super.toBeDisplayed(visible); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | setBackground(ColorAndFontConstants.greyBackground); |
| | |
| | | backends.setModel(new DefaultComboBoxModel(new String[]{})); |
| | | ItemListener comboListener = new ItemListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void itemStateChanged(ItemEvent ev) |
| | | { |
| | | if (!ignoreSelectionEvents && |
| | |
| | | newIndex.setOpaque(false); |
| | | newIndex.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newIndexClicked(); |
| | |
| | | newVLVIndex.setOpaque(false); |
| | | newVLVIndex.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newVLVIndexClicked(); |
| | |
| | | add(createSplitPane(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_MANAGE_INDEXES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return backends; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void closeClicked() |
| | | { |
| | | super.closeClicked(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.CLOSE; |
| | |
| | | |
| | | entryPane.addIndexSelectionListener(new IndexSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void indexSelected(IndexSelectionEvent ev) |
| | | { |
| | | AbstractIndexDescriptor index = ev.getIndex(); |
| | |
| | | |
| | | treePane.getTree().addTreeSelectionListener(new TreeSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void valueChanged(TreeSelectionEvent ev) |
| | | { |
| | | if (!ignoreSelectionEvents) |
| | |
| | | return pane; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | |
| | | info.addIndexModifiedListener(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | ignoreSelectionEvents = true; |
| | |
| | | refreshContents(desc); |
| | | } |
| | | |
| | | /** |
| | | * Adds a pop up menu. |
| | | * |
| | | */ |
| | | /** Adds a pop up menu. */ |
| | | private void addPopupMenu() |
| | | { |
| | | final JPopupMenu popup = new JPopupMenu(); |
| | |
| | | INFO_CTRL_PANEL_NEW_INDEX_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newIndexClicked(); |
| | |
| | | INFO_CTRL_PANEL_NEW_VLV_INDEX_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | newVLVIndexClicked(); |
| | |
| | | INFO_CTRL_PANEL_DELETE_INDEX_MENU.get()); |
| | | deleteMenuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteClicked(); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | repopulateTree(treePane.getTree()); |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void indexModified(IndexModifiedEvent ev) |
| | | { |
| | | refreshContents(getInfo().getServerDescriptor()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backendIndexesModified(IndexModifiedEvent ev) |
| | | { |
| | | refreshContents(getInfo().getServerDescriptor()); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (firstTreeRepopulate) |
| | |
| | | ignoreSelectionEvents = false; |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the right panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the right panel. */ |
| | | private void updateEntryPane() |
| | | { |
| | | ViewPositions pos = Utilities.getViewPositions(entryPane); |
| | |
| | | newIndexPanel.addConfigurationElementCreatedListener( |
| | | new ConfigurationElementCreatedListener() |
| | | { |
| | | @Override |
| | | public void elementCreated(ConfigurationElementCreatedEvent ev) |
| | | { |
| | | Object o = ev.getConfigurationObject(); |
| | |
| | | newVLVIndexPanel.addConfigurationElementCreatedListener( |
| | | new ConfigurationElementCreatedListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void elementCreated(ConfigurationElementCreatedEvent ev) |
| | | { |
| | | Object o = ev.getConfigurationObject(); |
| | |
| | | |
| | | private static final long serialVersionUID = -6953837045703643228L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTreeCellRendererComponent(JTree tree, Object value, |
| | | boolean isSelected, boolean isExpanded, boolean isLeaf, int row, |
| | | boolean hasFocus) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * Class containing some Fonts and Colors used in the Control Panel. |
| | | * |
| | | */ |
| | | /** Class containing some Fonts and Colors used in the Control Panel. */ |
| | | public class ColorAndFontConstants |
| | | { |
| | | /** |
| | | * Foreground color (the color of normal text). |
| | | */ |
| | | /** Foreground color (the color of normal text). */ |
| | | public static final Color foreground = |
| | | UIManager.getColor("TextField.foreground"); |
| | | /** |
| | | * Background color (the color of the panels). |
| | | */ |
| | | /** Background color (the color of the panels). */ |
| | | public static final Color background; |
| | | private static Color toggleButtonColor; |
| | | /** |
| | | * The border to be used for a text area. |
| | | */ |
| | | /** The border to be used for a text area. */ |
| | | public static final Border textAreaBorder; |
| | | static |
| | | { |
| | |
| | | textAreaBorder = border; |
| | | background = bg; |
| | | } |
| | | /** |
| | | * The text color of buttons. |
| | | */ |
| | | /** The text color of buttons. */ |
| | | public static final Color buttonForeground = |
| | | UIManager.getColor("Button.foreground"); |
| | | /** |
| | | * The text color of the category items. |
| | | */ |
| | | /** The text color of the category items. */ |
| | | public static final Color categoryForeground = foreground; |
| | | /** |
| | | * The text color of the BasicExpander components. |
| | | */ |
| | | /** The text color of the BasicExpander components. */ |
| | | public static final Color expanderForeground = foreground; |
| | | /** |
| | | * The grey color background that is used for instance as background for the |
| | |
| | | UIManager.getColor("MenuBar.background") : |
| | | UIManager.getColor("Panel.background"); |
| | | |
| | | /** |
| | | * The default border color. |
| | | */ |
| | | /** The default border color. */ |
| | | public static final Color defaultBorderColor = |
| | | Utilities.deriveColorHSB(toggleButtonColor, 0, 0, -.2f); |
| | | |
| | | /** |
| | | * The grid color for the table. |
| | | */ |
| | | /** The grid color for the table. */ |
| | | public static final Color gridColor = |
| | | isMacOS() ? defaultBorderColor : |
| | | UIManager.getColor("Table.gridColor"); |
| | | /** |
| | | * The color of the text in the table. |
| | | */ |
| | | /** The color of the text in the table. */ |
| | | public static final Color tableForeground = foreground; |
| | | /** |
| | | * The background color of the table. |
| | | */ |
| | | /** The background color of the table. */ |
| | | public static final Color tableBackground = background; |
| | | /** |
| | | * The text color of the tree. |
| | | */ |
| | | /** The text color of the tree. */ |
| | | public static final Color treeForeground = foreground; |
| | | /** |
| | | * The background color of the tree. |
| | | */ |
| | | /** The background color of the tree. */ |
| | | public static final Color treeBackground = background; |
| | | /** |
| | | * The color of the background when the mouse is over (this is used in some |
| | |
| | | */ |
| | | public static final Color mouseOverBackground = |
| | | UIManager.getColor("TextField.selectionBackground"); |
| | | /** |
| | | * Text color indicating that a field is valid. |
| | | */ |
| | | /** Text color indicating that a field is valid. */ |
| | | public static final Color validFontColor = foreground; |
| | | |
| | | /** |
| | |
| | | Utilities.deriveColorHSB(mouseOverForeground, |
| | | 0, 0, +.20f); |
| | | |
| | | /** |
| | | * The default font of the labels. |
| | | */ |
| | | /** The default font of the labels. */ |
| | | public static final Font defaultFont = UIManager.getFont("Label.font"); |
| | | /** |
| | | * The font of the BasicExpander component. |
| | | */ |
| | | /** The font of the BasicExpander component. */ |
| | | public static final Font expanderFont = defaultFont.deriveFont(Font.BOLD); |
| | | /** |
| | | * The in-line help font. |
| | | */ |
| | | /** The in-line help font. */ |
| | | public static final Font inlineHelpFont = defaultFont.deriveFont( |
| | | (float)(defaultFont.getSize() - 2)); |
| | | /** |
| | | * The font of the table header. |
| | | */ |
| | | /** The font of the table header. */ |
| | | public static final Font headerFont = |
| | | UIManager.getFont("TableHeader.font").deriveFont(Font.BOLD); |
| | | /** |
| | | * The font to be used in the title of the error panes. |
| | | */ |
| | | /** The font to be used in the title of the error panes. */ |
| | | public static final Font errorTitleFont = |
| | | defaultFont.deriveFont(Font.BOLD).deriveFont(13f); |
| | | /** |
| | | * The font to be used in the CategoryButton component. |
| | | */ |
| | | /** The font to be used in the CategoryButton component. */ |
| | | public static final Font categoryFont = |
| | | UIManager.getFont("Label.font").deriveFont(Font.BOLD); |
| | | /** |
| | | * The top border of the accordion component. |
| | | */ |
| | | /** The top border of the accordion component. */ |
| | | public static final Color topAccordionBorderColor = Utilities.deriveColorHSB( |
| | | toggleButtonColor, 0, 0, .2f); |
| | | /** |
| | | * The font to be used in primary labels. |
| | | */ |
| | | /** The font to be used in primary labels. */ |
| | | public static final Font primaryFont = defaultFont.deriveFont(Font.BOLD); |
| | | /** |
| | | * The font to be used in the tree. |
| | | */ |
| | | /** The font to be used in the tree. */ |
| | | public static final Font treeFont = UIManager.getFont("Tree.font"); |
| | | /** |
| | | * The font to be used in the table. |
| | | */ |
| | | /** The font to be used in the table. */ |
| | | public static final Font tableFont = UIManager.getFont("Table.font"); |
| | | /** |
| | | * The font to be used in the title of the TitlePanel component. |
| | | */ |
| | | /** The font to be used in the title of the TitlePanel component. */ |
| | | public static final Font titleFont = |
| | | defaultFont.deriveFont(Font.BOLD).deriveFont(14f); |
| | | /** |
| | | * Text color indicating that a field is not valid. |
| | | */ |
| | | /** Text color indicating that a field is not valid. */ |
| | | public static final Color invalidFontColor = Color.red; |
| | | /** |
| | | * The font to be used when the field associated with a primary label is not |
| | | * valid. |
| | | */ |
| | | /** The font to be used when the field associated with a primary label is not valid. */ |
| | | public static final Font primaryInvalidFont = |
| | | primaryFont.deriveFont(Font.ITALIC); |
| | | /** |
| | | * The font to be used when the field associated with a normal label is not |
| | | * valid. |
| | | */ |
| | | /** The font to be used when the field associated with a normal label is not valid. */ |
| | | public static final Font invalidFont = defaultFont.deriveFont(Font.ITALIC); |
| | | /** |
| | | * The font to be used in the progress dialog's 'Details' section. |
| | | */ |
| | | /** The font to be used in the progress dialog's 'Details' section. */ |
| | | public static final Font progressFont = UIManager.getFont("EditorPane.font"); |
| | | /** |
| | | * Specifies the font for the command-line output in the detail panel. |
| | | */ |
| | | /** Specifies the font for the command-line output in the detail panel. */ |
| | | public static final Font outputFont = Font.decode("Monospaced-PLAIN-12"); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The panel that displays a configuration attribute definition. |
| | | */ |
| | | /** The panel that displays a configuration attribute definition. */ |
| | | public class ConfigurationAttributePanel extends StandardAttributePanel |
| | | { |
| | | private static final long serialVersionUID = -6072885354690411482L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_CONFIGURATION_ATTRIBUTE_TITLE.get(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The panel that displays a configuration objectclass definition. |
| | | */ |
| | | /** The panel that displays a configuration objectclass definition. */ |
| | | public class ConfigurationObjectClassPanel extends StandardObjectClassPanel |
| | | { |
| | | private static final long serialVersionUID = 8875851764570955881L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_CONFIGURATION_OBJECTCLASS_TITLE.get(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | * It proposes the user to save the changes, do not save them or cancel the |
| | | * action that make the dialog appear (for instance when the user is editing |
| | | * an entry and clicks on another node, this dialog appears). |
| | | * |
| | | */ |
| | | public class ConfirmInitializeAndImportDialog extends GenericDialog |
| | | { |
| | | /** |
| | | * The different input that the user can provide. |
| | | * |
| | | */ |
| | | /** The different input that the user can provide. */ |
| | | public enum Result |
| | | { |
| | | /** |
| | | * The user asks to do the import and then the initialization. |
| | | */ |
| | | /** The user asks to do the import and then the initialization. */ |
| | | INITIALIZE_ALL, |
| | | /** |
| | | * The user asks to only do the import locally. |
| | | */ |
| | | /** The user asks to only do the import locally. */ |
| | | IMPORT_ONLY, |
| | | /** |
| | | * The user asks to cancel the operation that made this dialog to appear. |
| | | */ |
| | | /** The user asks to cancel the operation that made this dialog to appear. */ |
| | | CANCEL |
| | | } |
| | | private static final long serialVersionUID = -442311801035162311L; |
| | |
| | | pack(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVisible(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** |
| | | * The panel to be displayed inside the dialog. |
| | | * |
| | | */ |
| | | /** The panel to be displayed inside the dialog. */ |
| | | private static class ConfirmInitializeAndImportPanel |
| | | extends StatusGenericPanel |
| | | { |
| | |
| | | |
| | | private Result result; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ConfirmInitializeAndImportPanel() |
| | | { |
| | | super(); |
| | |
| | | add(createButtonsPanel(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | |
| | | buttonsPanel.add(initializeAllButton, gbc); |
| | | initializeAllButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | result = Result.INITIALIZE_ALL; |
| | |
| | | buttonsPanel.add(importOnlyButton, gbc); |
| | | importOnlyButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | result = Result.IMPORT_ONLY; |
| | |
| | | buttonsPanel.add(cancelButton, gbc); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | result = Result.CANCEL; |
| | |
| | | return buttonsPanel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return initializeAllButton; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_CONFIRM_INITIALIZE_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | /** |
| | | * Class that displays the monitoring information of connection handlers. |
| | | * |
| | | */ |
| | | /** Class that displays the monitoring information of connection handlers. */ |
| | | public class ConnectionHandlerMonitoringPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -6462932160985559830L; |
| | |
| | | private LocalizableMessage ALL_CONNECTION_HANDLERS = |
| | | INFO_CTRL_PANEL_ALL_CONNECTION_HANDLERS.get(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ConnectionHandlerMonitoringPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | new IgnoreItemListener(connectionHandlers)); |
| | | connectionHandlers.addItemListener(new ItemListener() |
| | | { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent ev) |
| | | { |
| | | if (ev.getStateChange() == ItemEvent.SELECTED) |
| | |
| | | updateTableSizes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_CONNECTION_HANDLER_MONITORING_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public JMenuBar getMenuBar() |
| | | { |
| | |
| | | return menuBar; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | final ServerDescriptor server = ev.getNewDescriptor(); |
| | |
| | | new TreeSet<>( |
| | | new Comparator<ConnectionHandlerDescriptor>() |
| | | { |
| | | @Override |
| | | public int compare(ConnectionHandlerDescriptor desc1, |
| | | ConnectionHandlerDescriptor desc2) |
| | | { |
| | |
| | | final LocalizableMessage fErrorDetails = errorDetails; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | ViewPositions pos = Utilities.getViewPositions( |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return connectionHandlers; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Displays a dialog allowing the user to select which operations to display. |
| | | * |
| | | */ |
| | | /** Displays a dialog allowing the user to select which operations to display. */ |
| | | private void operationViewClicked() |
| | | { |
| | | if (operationViewDlg == null) |
| | |
| | | /** |
| | | * Updates the contents of the tables depending on whether the averages |
| | | * must be displayed or not. |
| | | * |
| | | */ |
| | | private void showAverageClicked() |
| | | { |
| | |
| | | || ch.getProtocol() == Protocol.OTHER); |
| | | } |
| | | |
| | | /** |
| | | * The specific menu bar of this panel. |
| | | * |
| | | */ |
| | | /** The specific menu bar of this panel. */ |
| | | class ConnectionHandlerMonitoringMenuBar extends MainMenuBar |
| | | { |
| | | private static final long serialVersionUID = 505187831116443370L; |
| | |
| | | super(info); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void addMenus() |
| | | { |
| | |
| | | menu.add(viewOperations); |
| | | viewOperations.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | operationViewClicked(); |
| | |
| | | menu.add(showAveragesMenu); |
| | | showAveragesMenu.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | showAverageClicked(); |
| | |
| | | * The main panel of the control panel. It contains a split pane. On the left |
| | | * we have some actions and on the right some global information about the |
| | | * server. |
| | | * |
| | | */ |
| | | public class ControlCenterMainPane extends JPanel |
| | | { |
| | |
| | | info.addConfigChangeListener(new ConfigChangeListener() |
| | | { |
| | | private boolean lastStatusStopped; |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(final ConfigurationChangeEvent ev) |
| | | { |
| | |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_CUSTOM_ATTRIBUTE_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(delete, gbc); |
| | | delete.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | |
| | | add(saveChanges, gbc); |
| | | saveChanges.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | |
| | | final BasicExpander expander = expanders[i]; |
| | | ChangeListener changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | |
| | | |
| | | ItemListener itemListener = new ItemListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void itemStateChanged(ItemEvent ev) |
| | | { |
| | |
| | | final JList list = lists[i]; |
| | | MouseAdapter clickListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent ev) |
| | | { |
| | |
| | | |
| | | KeyAdapter keyListener = new KeyAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void keyTyped(KeyEvent ev) |
| | | { |
| | |
| | | |
| | | DocumentListener docListener = new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) |
| | | { |
| | | checkEnableSaveChanges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) |
| | | { |
| | | checkEnableSaveChanges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent arg0) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mustCheckUnsavedChanges() |
| | | { |
| | | return saveChanges.isEnabled(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public UnsavedChangesDialog.Result checkUnsavedChanges() |
| | | { |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | |
| | | ignoreChangeEvents = false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | return schema == null && s != null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | private boolean ignoreChangeEvents; |
| | | |
| | | |
| | | /** |
| | | * Default constructor of the panel. |
| | | * |
| | | */ |
| | | /** Default constructor of the panel. */ |
| | | public CustomObjectClassPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_CUSTOM_OBJECTCLASS_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | protected void createLayout() |
| | | { |
| | | JPanel p = new JPanel(new GridBagLayout()); |
| | |
| | | add(delete, gbc); |
| | | delete.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | |
| | | add(saveChanges, gbc); |
| | | saveChanges.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | |
| | | SuperiorObjectClassesChangedListener listener = |
| | | new SuperiorObjectClassesChangedListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void parentObjectClassesChanged( |
| | | SuperiorObjectClassesChangedEvent ev) |
| | |
| | | attributes = new DoubleAddRemovePanel<>(0, AttributeType.class); |
| | | Comparator<AttributeType> comparator = new Comparator<AttributeType>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(AttributeType attr1, AttributeType attr2) |
| | | { |
| | |
| | | add(labels, comps, inlineHelps, p, gbc1); |
| | | ChangeListener changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | |
| | | |
| | | DocumentListener docListener = new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) |
| | | { |
| | | checkEnableSaveChanges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) |
| | | { |
| | | checkEnableSaveChanges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent arg0) |
| | | { |
| | |
| | | |
| | | ListDataListener dataListener = new ListDataListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void contentsChanged(ListDataEvent e) |
| | | { |
| | | checkEnableSaveChanges(); |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void intervalAdded(ListDataEvent e) |
| | | { |
| | | checkEnableSaveChanges(); |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void intervalRemoved(ListDataEvent e) |
| | | { |
| | |
| | | ignoreChangeEvents = false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mustCheckUnsavedChanges() |
| | | { |
| | | return saveChanges.isEnabled(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public UnsavedChangesDialog.Result checkUnsavedChanges() |
| | | { |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | /** |
| | | * A renderer for the attribute lists. The renderer basically marks the |
| | | * inherited attributes with an asterisk. |
| | | * |
| | | */ |
| | | private class AttributeTypeCellRenderer implements ListCellRenderer |
| | | { |
| | | private ListCellRenderer defaultRenderer; |
| | | |
| | | /** |
| | | * Renderer constructor. |
| | | * |
| | | */ |
| | | /** Renderer constructor. */ |
| | | public AttributeTypeCellRenderer() |
| | | { |
| | | defaultRenderer = attributes.getAvailableList().getCellRenderer(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | /** |
| | | * The panel displayed when the user clicks on 'Delete Backend...' in the |
| | | * browse entries dialog. |
| | | * |
| | | */ |
| | | public class DeleteBackendPanel extends DeleteBaseDNPanel |
| | | { |
| | | private static final long serialVersionUID = 8744925738292396658L; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_BACKEND_TITLE.get(); |
| | |
| | | * Returns the no backend found label. |
| | | * @return the no backend found label. |
| | | */ |
| | | @Override |
| | | protected LocalizableMessage getNoElementsFoundLabel() |
| | | { |
| | | return INFO_CTRL_PANEL_NO_BACKENDS_FOUND_LABEL.get(); |
| | |
| | | * Returns the list label. |
| | | * @return the list label. |
| | | */ |
| | | @Override |
| | | protected LocalizableMessage getListLabel() |
| | | { |
| | | return INFO_CTRL_PANEL_SELECT_BACKENDS_TO_DELETE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | ServerDescriptor desc = ev.getNewDescriptor(); |
| | |
| | | INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | final LinkedHashSet<LocalizableMessage> errors = new LinkedHashSet<>(); |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_BASE_DN_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return list; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | @SuppressWarnings("deprecation") |
| | |
| | | INFO_CTRL_PANEL_SELECT_ALL_BUTTON.get()); |
| | | selectAllButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | int[] indices = new int[list.getModel().getSize()]; |
| | |
| | | INFO_CTRL_PANEL_CLEAR_SELECTION_BUTTON.get()); |
| | | unselectAllButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | list.clearSelection(); |
| | |
| | | |
| | | list.addListSelectionListener(new ListSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void valueChanged(ListSelectionEvent ev) |
| | | { |
| | | checkOKButtonEnable(); |
| | |
| | | mainPanel.add(Box.createVerticalGlue(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void checkOKButtonEnable() |
| | | { |
| | | setEnabledOK(!list.isSelectionEmpty() && mainPanel.isVisible()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | ServerDescriptor desc = ev.getNewDescriptor(); |
| | |
| | | INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | final LinkedHashSet<LocalizableMessage> errors = new LinkedHashSet<>(); |
| | |
| | | private CustomSearchResult entryToDuplicate; |
| | | private String rdnAttribute; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public DuplicateEntryPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setParent(BasicNode parentNode, BrowserController controller) |
| | | { |
| | | throw new IllegalArgumentException("this method must not be called"); |
| | |
| | | return INFO_CTRL_PANEL_DUPLICATE_ENTRY_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_DUPLICATE_ENTRY_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(browse, gbc); |
| | | browse.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | browseClicked(); |
| | |
| | | |
| | | DocumentListener listener = new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) |
| | | { |
| | | updateDNValue(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent ev) |
| | | { |
| | | insertUpdate(ev); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) |
| | | { |
| | | insertUpdate(ev); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void checkSyntax(ArrayList<LocalizableMessage> errors) |
| | | { |
| | | int origSize = errors.size(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getLDIF() |
| | | { |
| | | String dn = this.dn.getText(); |
| | |
| | | BackgroundTask<CustomSearchResult> task = |
| | | new BackgroundTask<CustomSearchResult>() |
| | | { |
| | | @Override |
| | | public CustomSearchResult processBackgroundTask() throws Throwable |
| | | { |
| | | InitialLdapContext ctx = |
| | |
| | | return reader.processBackgroundTask(); |
| | | } |
| | | |
| | | @Override |
| | | public void backgroundTaskCompleted(CustomSearchResult sr, |
| | | Throwable throwable) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import static org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes.*; |
| | | import static org.opends.guitools.controlpanel.util.Utilities.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | /** |
| | | * The panel displaying the entry caches monitor panel. |
| | | */ |
| | | /** The panel displaying the entry caches monitor panel. */ |
| | | public class EntryCachesMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563700069830L; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public EntryCachesMonitoringPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return monitoringLabels.get(0); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the panel. */ |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | /** |
| | | * Class used to display an collection of error messages. |
| | | * |
| | | */ |
| | | /** Class used to display an collection of error messages. */ |
| | | public class ErrorPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -4494826284037288552L; |
| | |
| | | createLayout(errors); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return title; |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.OK; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | Utilities.getParentDialog(this).setVisible(false); |
| | |
| | | errorPane.setVisible(true); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return errorPane; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_ERROR_SEARCHING_ENTRY_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import javax.swing.event.DocumentEvent; |
| | | import javax.swing.event.DocumentListener; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.ScheduleType; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | |
| | | import org.opends.guitools.controlpanel.task.Task; |
| | | import org.opends.guitools.controlpanel.ui.components.ScheduleSummaryPanel; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.tools.ExportLDIF; |
| | | |
| | | /** |
| | | * The panel where the user can export the contents of the server to an LDIF |
| | | * file. |
| | | * |
| | | */ |
| | | /** The panel where the user can export the contents of the server to an LDIF file. */ |
| | | public class ExportLDIFPanel extends InclusionExclusionPanel |
| | | { |
| | | private static final long serialVersionUID = 2256902594454214644L; |
| | |
| | | |
| | | private ScheduleSummaryPanel schedulePanel; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ExportLDIFPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_EXPORT_LDIF_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return file; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | file = Utilities.createTextField(); |
| | | documentListener = new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent ev) |
| | | { |
| | | String text = file.getText().trim(); |
| | | setEnabledOK(text != null && text.length() > 0 && !errorPane.isVisible()); |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) |
| | | { |
| | | changedUpdate(ev); |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) |
| | | { |
| | | changedUpdate(ev); |
| | |
| | | |
| | | encryptData = Utilities.createCheckBox( |
| | | INFO_CTRL_PANEL_ENCRYPT_DATA_LABEL.get()); |
| | | |
| | | /* |
| | | gbc.gridy ++; |
| | | gbc.insets.top = 5; |
| | | add(encryptData, gbc); |
| | | */ |
| | | generateSignedHash = Utilities.createCheckBox( |
| | | INFO_CTRL_PANEL_EXPORT_GENERATE_SIGNED_HASH.get()); |
| | | |
| | | encryptData.addChangeListener(new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent ev) |
| | | { |
| | | generateSignedHash.setEnabled(encryptData.isSelected()); |
| | |
| | | encryptData.setSelected(false); |
| | | generateSignedHash.setEnabled(false); |
| | | |
| | | /* |
| | | gbc.gridy ++; |
| | | gbc.insets.left = 30; |
| | | add(generateSignedHash, gbc); |
| | | */ |
| | | /* gbc.gridy ++; gbc.insets.left = 30; add(generateSignedHash, gbc); */ |
| | | wrapText = Utilities.createCheckBox(INFO_CTRL_PANEL_EXPORT_WRAP_TEXT.get()); |
| | | wrapText.setOpaque(false); |
| | | gbc.insets.left = 10; |
| | |
| | | |
| | | wrapText.addChangeListener(new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent ev) |
| | | { |
| | | wrapColumn.setEnabled(wrapText.isSelected()); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | ServerDescriptor desc = ev.getNewDescriptor(); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | lRemoteFileHelp.setVisible(!isLocal()); |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void checkOKButtonEnable() |
| | | { |
| | | documentListener.changedUpdate(null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | setPrimaryValid(lBackend); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(lBackend); |
| | |
| | | return schedulePanel.getSchedule(); |
| | | } |
| | | |
| | | /** |
| | | * The class that performs the export. |
| | | * |
| | | */ |
| | | /** The class that performs the export. */ |
| | | protected class ExportTask extends InclusionExclusionTask |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | fileName = file.getText(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.EXPORT_LDIF; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_EXPORT_TASK_DESCRIPTION.get( |
| | | backendSet.iterator().next(), fileName); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | |
| | | return args; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("export-ldif"); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | protected static LocalizableMessage NO_VALUE_SET = |
| | | INFO_CTRL_PANEL_NO_MONITORING_VALUE.get(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return LocalizableMessage.EMPTY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | /** |
| | | * The panel on the right of the 'General Information' panel. |
| | | * |
| | | */ |
| | | /** The panel on the right of the 'General Information' panel. */ |
| | | public class GeneralMonitoringRightPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -4197460101279681042L; |
| | |
| | | * Displays a panel containing a message. |
| | | * @param msg the message. |
| | | */ |
| | | @Override |
| | | public void displayMessage(LocalizableMessage msg) |
| | | { |
| | | noEntryPanel.setMessage(msg); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, noEntryPanelTitle); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | |
| | | add(mainPanel, gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return LocalizableMessage.EMPTY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.util.DynamicConstants; |
| | | |
| | | /** |
| | | * The generic dialog of the Control Panel. It contains a StatusGenericPanel. |
| | | */ |
| | | /** The generic dialog of the Control Panel. It contains a StatusGenericPanel. */ |
| | | public class GenericDialog extends JDialog |
| | | { |
| | | private static final long serialVersionUID = -2643144936460484112L; |
| | |
| | | KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); |
| | | ActionListener actionListener = new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | setVisible(false); |
| | |
| | | |
| | | FocusListener focusListener = new FocusAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void focusGained(FocusEvent ev) |
| | | { |
| | | lastComponentWithFocus = ev.getComponent(); |
| | |
| | | addFocusListener(focusListener, panel); |
| | | |
| | | addWindowListener(new WindowAdapter() { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void windowClosing(WindowEvent e) { |
| | | GenericDialog.this.panel.closeClicked(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVisible(boolean visible) |
| | | { |
| | | if (visible && lastComponentWithFocus == null) |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.okClicked(); |
| | |
| | | cancelButton.setOpaque(false); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.cancelClicked(); |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.okClicked(); |
| | |
| | | buttonsPanel.add(closeButton, gbc); |
| | | closeButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.closeClicked(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.util.DynamicConstants; |
| | | |
| | | /** |
| | | * The generic frame of the Control Panel. It contains a StatusGenericPanel. |
| | | */ |
| | | /** The generic frame of the Control Panel. It contains a StatusGenericPanel. */ |
| | | public class GenericFrame extends JFrame |
| | | { |
| | | private static final long serialVersionUID = -2643144936460484112L; |
| | |
| | | KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); |
| | | ActionListener actionListener = new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | setVisible(false); |
| | |
| | | |
| | | FocusListener focusListener = new FocusAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void focusGained(FocusEvent ev) |
| | | { |
| | | lastComponentWithFocus = ev.getComponent(); |
| | |
| | | addFocusListener(focusListener, panel); |
| | | |
| | | addWindowListener(new WindowAdapter() { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void windowClosing(WindowEvent e) { |
| | | GenericFrame.this.panel.closeClicked(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVisible(boolean visible) |
| | | { |
| | | if (visible && lastComponentWithFocus == null) |
| | |
| | | closeButton.setEnabled(enable); |
| | | } |
| | | |
| | | /** |
| | | * Updates the title of the frame using the title of the panel. |
| | | * |
| | | */ |
| | | /** Updates the title of the frame using the title of the panel. */ |
| | | public void updateTitle() |
| | | { |
| | | if (panel.getTitle() != null) |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.okClicked(); |
| | |
| | | cancelButton.setOpaque(false); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.cancelClicked(); |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.okClicked(); |
| | |
| | | buttonsPanel.add(closeButton, gbc); |
| | | closeButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.closeClicked(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.quicksetup.util.WebBrowserLauncher; |
| | | import org.opends.server.util.DynamicConstants; |
| | | |
| | | /** |
| | | * An abstract class that the different menu bars in the Control Panel extend. |
| | | * |
| | | */ |
| | | /** An abstract class that the different menu bars in the Control Panel extend. */ |
| | | |
| | | public abstract class GenericMenuBar extends JMenuBar |
| | | { |
| | |
| | | |
| | | private ControlPanelInfo info; |
| | | |
| | | /** |
| | | * The URL to the administration guide. |
| | | */ |
| | | /** The URL to the administration guide. */ |
| | | protected final String ADMINISTRATION_GUIDE_URL = |
| | | Utils.getCustomizedObject("ADMINISTRATION_GUIDE_URL", |
| | | DynamicConstants.ADMINISTRATION_GUIDE_URL, String.class); |
| | | |
| | | /** |
| | | * The URL to the wiki main page. |
| | | */ |
| | | /** The URL to the wiki main page. */ |
| | | protected final String DOC_REFERENCE_WIKI = |
| | | Utils.getCustomizedObject("DOC_REFERENCE_WIKI", |
| | | DynamicConstants.DOC_REFERENCE_WIKI, String.class); |
| | |
| | | INFO_CTRL_PANEL_ADMINISTRATION_GUIDE_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | displayURL(ADMINISTRATION_GUIDE_URL); |
| | |
| | | INFO_CTRL_PANEL_DOCUMENTATION_WIKI_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | displayURL(DOC_REFERENCE_WIKI); |
| | |
| | | { |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Void processBackgroundTask() throws WebBrowserException |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, Throwable throwable) |
| | | { |
| | | WebBrowserException ex = (WebBrowserException) throwable; |
| | |
| | | import org.opends.server.tools.dsreplication.ReplicationCliException; |
| | | import org.opends.server.tools.dsreplication.ReplicationCliMain; |
| | | |
| | | /** |
| | | * The panel where the user can import the contents of an LDIF file to the |
| | | * server. |
| | | */ |
| | | /** The panel where the user can import the contents of an LDIF file to the server. */ |
| | | public class ImportLDIFPanel extends InclusionExclusionPanel |
| | | { |
| | | private static final long serialVersionUID = 1143246529610229229L; |
| | |
| | | |
| | | private DocumentListener documentListener; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ImportLDIFPanel() |
| | | { |
| | | super(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | return baseDNs; |
| | | } |
| | | |
| | | /** |
| | | * The class that performs the import. |
| | | * |
| | | */ |
| | | /** The class that performs the import. */ |
| | | protected class ImportTask extends InclusionExclusionTask |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | import java.awt.GridBagLayout; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | import javax.swing.JLabel; |
| | | import javax.swing.JPanel; |
| | |
| | | import javax.swing.event.ChangeListener; |
| | | import javax.swing.text.JTextComponent; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | |
| | | import org.opends.guitools.controlpanel.task.Task; |
| | | import org.opends.guitools.controlpanel.ui.components.BasicExpander; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | /** |
| | | * Abstract class used to refactor some code used by the import LDIF and export |
| | | * LDIF panels. |
| | | * |
| | | */ |
| | | /** Abstract class used to refactor some code used by the import LDIF and export LDIF panels. */ |
| | | public abstract class InclusionExclusionPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -3826176895778069011L; |
| | | /** |
| | | * The DNs to exclude. |
| | | */ |
| | | /** The DNs to exclude. */ |
| | | protected JTextArea dnsToExclude; |
| | | /** |
| | | * The attributes to exclude. |
| | | */ |
| | | /** The attributes to exclude. */ |
| | | protected JTextField attributesToExclude; |
| | | /** |
| | | * The exclusion filter. |
| | | */ |
| | | /** The exclusion filter. */ |
| | | protected JTextField exclusionFilter; |
| | | /** |
| | | * The DNs to include. |
| | | */ |
| | | /** The DNs to include. */ |
| | | protected JTextArea dnsToInclude; |
| | | /** |
| | | * The attributes to include. |
| | | */ |
| | | /** The attributes to include. */ |
| | | protected JTextField attributesToInclude; |
| | | /** |
| | | * The inclusion filter. |
| | | */ |
| | | /** The inclusion filter. */ |
| | | protected JTextField inclusionFilter; |
| | | |
| | | /** |
| | | * The DNs to include. |
| | | */ |
| | | /** The DNs to include. */ |
| | | protected JLabel lDnsToInclude; |
| | | /** |
| | | * The attributes to include. |
| | | */ |
| | | /** The attributes to include. */ |
| | | protected JLabel lAttributesToInclude; |
| | | /** |
| | | * The inclusion filter label. |
| | | */ |
| | | /** The inclusion filter label. */ |
| | | protected JLabel lInclusionFilter; |
| | | /** |
| | | * The DNs to exclude label. |
| | | */ |
| | | /** The DNs to exclude label. */ |
| | | protected JLabel lDnsToExclude; |
| | | /** |
| | | * The attributes to exclude label. |
| | | */ |
| | | /** The attributes to exclude label. */ |
| | | protected JLabel lAttributesToExclude; |
| | | /** |
| | | * The exclusion filter label. |
| | | */ |
| | | /** The exclusion filter label. */ |
| | | protected JLabel lExclusionFilter; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(lDnsToInclude); |
| | |
| | | |
| | | ChangeListener changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | | lDnsToInclude.setVisible(expander.isSelected()); |
| | |
| | | |
| | | ChangeListener changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | | lDnsToExclude.setVisible(expander.isSelected()); |
| | |
| | | * Abstract class that provides some methods that can be used to generate the |
| | | * equivalent command-line arguments for some of the things that are contained |
| | | * in the inclusion/exclusion panels. |
| | | * |
| | | */ |
| | | protected abstract class InclusionExclusionTask extends Task |
| | | { |
| | |
| | | * @return the command line arguments corresponding to the elements |
| | | * displayed in the inclusion/exclusion panels. |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | @Override |
| | | protected List<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | | List<String> args = new ArrayList<>(); |
| | | String s = dnsToInclude.getText(); |
| | | if (s.trim().length() > 0) |
| | | { |
| | | String[] dnArray = s.split("\n"); |
| | | for (int i=0; i<dnArray.length; i++) |
| | | for (String dn : dnArray) |
| | | { |
| | | args.add("--includeBranch"); |
| | | args.add(dnArray[i]); |
| | | args.add(dn); |
| | | } |
| | | } |
| | | s = attributesToInclude.getText(); |
| | | if (s.trim().length() > 0) |
| | | { |
| | | String[] attrArray = s.split(","); |
| | | for (int i=0; i<attrArray.length; i++) |
| | | for (String attr : attrArray) |
| | | { |
| | | args.add("--includeAttribute"); |
| | | args.add(attrArray[i]); |
| | | args.add(attr); |
| | | } |
| | | } |
| | | s = inclusionFilter.getText(); |
| | |
| | | if (s.trim().length() > 0) |
| | | { |
| | | String[] dnArray = s.split("\n"); |
| | | for (int i=0; i<dnArray.length; i++) |
| | | for (String dn : dnArray) |
| | | { |
| | | args.add("--excludeBranch"); |
| | | args.add(dnArray[i]); |
| | | args.add(dn); |
| | | } |
| | | } |
| | | s = attributesToExclude.getText(); |
| | | if (s.trim().length() > 0) |
| | | { |
| | | String[] attrArray = s.split(","); |
| | | for (int i=0; i<attrArray.length; i++) |
| | | for (String attr : attrArray) |
| | | { |
| | | args.add("--excludeAttribute"); |
| | | args.add(attrArray[i]); |
| | | args.add(attr); |
| | | } |
| | | } |
| | | s = exclusionFilter.getText(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.event.IndexSelectionListener; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The panel on the right of the 'Manage Indexes' panel. |
| | | * |
| | | */ |
| | | /** The panel on the right of the 'Manage Indexes' panel. */ |
| | | public class IndexBrowserRightPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -6904674789074101772L; |
| | |
| | | private static final String NOTHING_SELECTED = "Nothing Selected"; |
| | | private static final String MULTIPLE_SELECTED = "Multiple Selected"; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public IndexBrowserRightPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** |
| | | * Displays a panel informing that no item is selected. |
| | | * |
| | | */ |
| | | /** Displays a panel informing that no item is selected. */ |
| | | public void displayVoid() |
| | | { |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, NOTHING_SELECTED); |
| | | } |
| | | |
| | | /** |
| | | * Displays a panel informing that multiple items are selected. |
| | | * |
| | | */ |
| | | /** Displays a panel informing that multiple items are selected. */ |
| | | public void displayMultiple() |
| | | { |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, MULTIPLE_SELECTED); |
| | |
| | | backendVLVIndexesPanel.removeIndexSelectionListener(listener); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | |
| | | backendVLVIndexesPanel.getTitle().toString()); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(mainPanel, gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_INDEX_BROWSER_RIGHT_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | // TODO |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | /** |
| | | * The panel displaying the java monitoring information. |
| | | */ |
| | | /** The panel displaying the java monitoring information. */ |
| | | public class JavaInformationMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563799969830L; |
| | |
| | | private List<JLabel> memoryLabels = new ArrayList<>(); |
| | | private JPanel memoryPanel; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public JavaInformationMonitoringPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return generalMonitoringComps.get(0); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | } |
| | | ChangeListener changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | |
| | | |
| | | changeListener = new ChangeListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the panel. */ |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | add(delete, gbc); |
| | | delete.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | deleteEntry(); |
| | |
| | | add(saveChanges, gbc); |
| | | saveChanges.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | saveChanges(true); |
| | |
| | | |
| | | LDAPEntryChangedListener listener = new LDAPEntryChangedListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void entryChanged(LDAPEntryChangedEvent ev) |
| | | { |
| | | boolean enable = saveChanges.isVisible() && |
| | |
| | | cardLayout.show(mainPanel, NOTHING_SELECTED); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void entryRead(EntryReadEvent ev) |
| | | { |
| | | searchResult = ev.getSearchResult(); |
| | |
| | | * Displays a message informing that an error occurred reading the entry. |
| | | * @param ev the entry read error event. |
| | | */ |
| | | @Override |
| | | public void entryReadError(EntryReadErrorEvent ev) |
| | | { |
| | | searchResult = null; |
| | |
| | | displayedEntryPanel = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_EDIT_LDAP_ENTRY_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return saveChanges; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | final ServerDescriptor desc = ev.getNewDescriptor(); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | boolean isReadOnly = true; |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | TreeSelectionModel.SINGLE_TREE_SELECTION); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return title; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | return dns; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getBrowseButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.OK_CANCEL; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createMainPanel() |
| | | { |
| | |
| | | tree.getSelectionModel().addTreeSelectionListener( |
| | | new TreeSelectionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void valueChanged(TreeSelectionEvent ev) |
| | | { |
| | |
| | | } |
| | | }); |
| | | MouseListener mouseListener = new MouseAdapter() { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mousePressed(MouseEvent e) { |
| | | int selRow = tree.getRowForLocation(e.getX(), e.getY()); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * The panel displaying an LDIF view of an entry. |
| | | */ |
| | | /** The panel displaying an LDIF view of an entry. */ |
| | | public class LDIFViewEntryPanel extends ViewEntryPanel |
| | | { |
| | | /** Callback that sets the viewport's view position. */ |
| | |
| | | this.scroll = scroll; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return editableAttributes; |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(readOnlyScroll, gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void update(CustomSearchResult sr, boolean isReadOnly, TreePath path) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getDisplayedDN() |
| | | { |
| | |
| | | return dn; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected List<Object> getValues(String attrName) |
| | | { |
| | | throw new IllegalStateException("This method should not be called."); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry() throws OpenDsException |
| | | { |
| | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | /** |
| | | * The panel that appears when the user is asked to provide authentication. |
| | | */ |
| | | /** The panel that appears when the user is asked to provide authentication. */ |
| | | public class LoginPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 5051556513294844797L; |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public LoginPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_LOGIN_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return pwd; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | /** |
| | | * The panel on the left side of the main Control Center dialog. It contains |
| | | * all the actions on the pane divided in categories. |
| | | * |
| | | */ |
| | | public class MainActionsPane extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 7616418700758530191L; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public MainActionsPane() |
| | | { |
| | | super(); |
| | |
| | | actions.add(b); |
| | | b.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | // Constructs the panels using reflection. |
| | |
| | | createActionButtonListeners(actions); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return null; |
| | |
| | | { |
| | | ActionListener actionListener = new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | for (ActionButton button : actions) |
| | |
| | | |
| | | MouseAdapter mouseListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mousePressed(MouseEvent ev) |
| | | { |
| | | for (ActionButton button : actions) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseReleased(MouseEvent ev) |
| | | { |
| | | for (ActionButton button : actions) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseExited(MouseEvent ev) |
| | | { |
| | | for (ActionButton button : actions) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseEntered(MouseEvent ev) |
| | | { |
| | | for (ActionButton button : actions) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The menu bar that appears on the main panel. |
| | | * |
| | | */ |
| | | /** The menu bar that appears on the main panel. */ |
| | | public class MainMenuBar extends GenericMenuBar |
| | | { |
| | | private static final long serialVersionUID = 6441273044772077947L; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Method that can be overwritten to set specific menus. |
| | | * |
| | | */ |
| | | /** Method that can be overwritten to set specific menus. */ |
| | | protected void addMenus() |
| | | { |
| | | add(createFileMenuBar()); |
| | |
| | | * The method called when the user clicks on quick. It will check that there |
| | | * are not ongoing tasks. If there are tasks, it will ask the user for |
| | | * confirmation to quit. |
| | | * |
| | | */ |
| | | public void quitClicked() |
| | | { |
| | |
| | | INFO_CTRL_PANEL_CONNECT_TO_SERVER_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | connectToServerClicked(); |
| | |
| | | menuItem = Utilities.createMenuItem(INFO_CTRL_PANEL_EXIT_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | quitClicked(); |
| | |
| | | INFO_CTRL_PANEL_REFRESH_MENU.get()); |
| | | menuItem.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | refreshOptionsClicked(); |
| | |
| | | return menu; |
| | | } |
| | | |
| | | /** |
| | | * Specific method to be able to handle the Quit events sent from the COCOA |
| | | * menu of Mac OS. |
| | | * |
| | | */ |
| | | /** Specific method to be able to handle the Quit events sent from the COCOA menu of Mac OS. */ |
| | | private void setMacOSQuitHandler() |
| | | { |
| | | try |
| | |
| | | (Class[])null).newInstance((Object[])null); |
| | | InvocationHandler adapter = new InvocationHandler() |
| | | { |
| | | @Override |
| | | public Object invoke (Object proxy, Method method, Object[] args) |
| | | throws Throwable |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The method called when the user clicks on 'Refresh Options'. |
| | | * |
| | | */ |
| | | /** The method called when the user clicks on 'Refresh Options'. */ |
| | | protected void refreshOptionsClicked() |
| | | { |
| | | if (panel == null) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The method called when the user clicks on 'Connect to Server...'. |
| | | */ |
| | | /** The method called when the user clicks on 'Connect to Server...'. */ |
| | | protected void connectToServerClicked() |
| | | { |
| | | Set<String> runningTasks = new HashSet<>(); |
| | |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | /** |
| | | * Class displaying the contents of a matching rule. |
| | | * |
| | | */ |
| | | /** Class displaying the contents of a matching rule. */ |
| | | public class MatchingRulePanel extends SchemaElementPanel |
| | | { |
| | | private static final long serialVersionUID = 2440493955626646008L; |
| | |
| | | private JLabel syntax = Utilities.createDefaultLabel(); |
| | | private JList usedByAttributes = new JList(new DefaultListModel()); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public MatchingRulePanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_MATCHING_RULE_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return usedByAttributes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | MouseAdapter clickListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent ev) |
| | | { |
| | |
| | | |
| | | KeyAdapter keyListener = new KeyAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void keyTyped(KeyEvent ev) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import java.awt.event.ActionListener; |
| | | import java.util.Collection; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.Set; |
| | | |
| | | import javax.swing.Box; |
| | | import javax.swing.JButton; |
| | |
| | | private static final long serialVersionUID = 6462932163745559L; |
| | | |
| | | private LinkedHashSet<T> selectedAttributes = new LinkedHashSet<>(); |
| | | private LinkedHashSet<T> monitoringAttributes; |
| | | private Set<T> monitoringAttributes; |
| | | private boolean isCanceled = true; |
| | | |
| | | /** |
| | |
| | | return new MonitoringAttributesViewPanel<>(attributes); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | |
| | | /** |
| | | * Default constructor. |
| | | * @param attributes the attributes that will be proposed to the user. |
| | | * |
| | | */ |
| | | protected MonitoringAttributesViewPanel(LinkedHashSet<T> attributes) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | selectAll = Utilities.createButton(INFO_CTRL_PANEL_SELECT_ALL_BUTTON.get()); |
| | | selectAll.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | for (JCheckBox cb : checkboxes) |
| | |
| | | selectNone = Utilities.createButton(INFO_CTRL_PANEL_CLEAR_SELECTION_BUTTON.get()); |
| | | selectNone.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | for (JCheckBox cb : checkboxes) |
| | |
| | | new Dimension(checkBoxPanel.getPreferredSize().width + 15, preferredViewHeight)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_ATTRIBUTE_VIEW_OPTIONS_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return checkboxes[0]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // Check that at least one checkbox is selected. |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.OK_CANCEL; |
| | |
| | | */ |
| | | protected LocalizableMessage getMessage(T attribute) |
| | | { |
| | | LocalizableMessage m; |
| | | if (attribute instanceof MonitoringAttributes) |
| | | { |
| | | m = ((MonitoringAttributes)attribute).getMessage(); |
| | | return ((MonitoringAttributes)attribute).getMessage(); |
| | | } |
| | | else if (attribute instanceof LocalizableMessage) |
| | | { |
| | | m = (LocalizableMessage)attribute; |
| | | return (LocalizableMessage)attribute; |
| | | } |
| | | else |
| | | { |
| | | m = LocalizableMessage.raw(attribute.toString()); |
| | | return LocalizableMessage.raw(attribute.toString()); |
| | | } |
| | | return m; |
| | | } |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * A simple panel containing a message. |
| | | * |
| | | */ |
| | | /** A simple panel containing a message. */ |
| | | public class NoItemSelectedPanel extends JPanel |
| | | { |
| | | private JLabel l; |
| | | private LocalizableMessage msg; |
| | | private static final long serialVersionUID = -8288525745479095426L; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public NoItemSelectedPanel() |
| | | { |
| | | super(new GridBagLayout()); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | /** |
| | | * This is the class used to edit the object class of a given entry, it displays |
| | | * the structural objectclass of the entry and its auxiliary objectclasses. |
| | | * |
| | | */ |
| | | public class ObjectClassEditorPanel extends StatusGenericPanel |
| | | { |
| | |
| | | |
| | | private boolean valueChanged; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ObjectClassEditorPanel() |
| | | { |
| | | super(); |
| | |
| | | availableListModel, 0, availableListModel.getSize()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return structural; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | valueChanged = false; |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | String struct = (String) structural.getSelectedItem(); |
| | |
| | | Utilities.getParentDialog(this).setVisible(false); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_EDIT_OBJECTCLASS_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | final Schema schema = ev.getNewDescriptor().getSchema(); |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | String currentStruct = (String)structural.getSelectedItem(); |
| | |
| | | ColorAndFontConstants.defaultFont); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | setEnabledOK(false); |
| | |
| | | return valueChanged; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The dialog that is used to display progress in a task. |
| | | */ |
| | | /** The dialog that is used to display progress in a task. */ |
| | | public class ProgressDialog extends GenericDialog |
| | | { |
| | | private static final long serialVersionUID = -6462866257463062629L; |
| | |
| | | { |
| | | errorPrintStream.addListener(new PrintStreamListener() |
| | | { |
| | | @Override |
| | | public void newLine(final String msg) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | progressPanel.appendErrorLine(msg); |
| | |
| | | }); |
| | | outPrintStream.addListener(new PrintStreamListener() |
| | | { |
| | | @Override |
| | | public void newLine(final String msg) |
| | | { |
| | | /** {@inheritDoc} */ |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | progressPanel.appendOutputLine(msg); |
| | |
| | | progressPanel.appendHtml(text); |
| | | } |
| | | |
| | | /** |
| | | * Resets the contents of the 'Details' section of the dialog. |
| | | * |
| | | */ |
| | | /** Resets the contents of the 'Details' section of the dialog. */ |
| | | public void resetProgressLogs() |
| | | { |
| | | progressPanel.resetLogs(); |
| | |
| | | progressPanel.setSummary(text); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setEnabledClose(boolean enable) |
| | | { |
| | | progressPanel.closeButton.setEnabled(enable); |
| | |
| | | progressPanel.closeWhenOverClicked(); |
| | | } |
| | | |
| | | /** |
| | | * The panel contained in the progress dialog. |
| | | * |
| | | */ |
| | | /** The panel contained in the progress dialog. */ |
| | | static class ProgressPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -364496083928260306L; |
| | |
| | | |
| | | private boolean taskIsOver; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ProgressPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDisposeOnClose() |
| | | { |
| | | return true; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Resets the contents of the logs (Details) section. |
| | | * |
| | | */ |
| | | /** Resets the contents of the logs (Details) section. */ |
| | | public void resetLogs() |
| | | { |
| | | logs.setText(INIT_TEXT); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated |
| | | * here). |
| | | * |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | updateVisibility(lastShowDetails); |
| | | details.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | lastShowDetails = details.isSelected(); |
| | |
| | | closeWhenOver.setOpaque(false); |
| | | closeWhenOver.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | closeWhenOverClicked(); |
| | |
| | | buttonsPanel.add(closeButton, gbc); |
| | | closeButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | closeClicked(); |
| | |
| | | { |
| | | final Runnable repaint = new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | invalidate(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return details; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | Utilities.getParentDialog(this).setVisible(false); |
| | |
| | | * Checks if the 'Close when over' check box is selected and if it is the |
| | | * case, closes the dialog after waiting for 2 seconds (so that the user |
| | | * can see the result, or cancel the automatic closing of the dialog). |
| | | * |
| | | */ |
| | | private void closeWhenOverClicked() |
| | | { |
| | |
| | | { |
| | | Thread t = new Thread(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | try |
| | |
| | | Thread.sleep(2000); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (closeWhenOver.isSelected() && taskIsOver) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.guitools.controlpanel.util.ViewPositions; |
| | | |
| | | /** |
| | | * The panel that appears when the user wants to rebuild indexes. |
| | | */ |
| | | /** The panel that appears when the user wants to rebuild indexes. */ |
| | | public class RebuildIndexPanel extends StatusGenericPanel implements IndexModifiedListener |
| | | { |
| | | private static final long serialVersionUID = -4805445967165643375L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | /** |
| | | * The panel that displays the refresh options of the control panel. Basically |
| | | * it allows to set the refreshing period used by the control panel. |
| | | * |
| | | */ |
| | | public class RefreshOptionsPanel extends StatusGenericPanel |
| | | { |
| | |
| | | |
| | | private int MAX_VALUE = 5000; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public RefreshOptionsPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_REFRESH_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.OK_CANCEL; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return period; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | isCanceled = true; |
| | |
| | | return isCanceled; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * Panel that appears when the user wants to change the password of a user. |
| | | * |
| | | */ |
| | | /** Panel that appears when the user wants to change the password of a user. */ |
| | | public class ResetUserPasswordPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 8733172823605832626L; |
| | |
| | | private BasicNode node; |
| | | private BrowserController controller; |
| | | |
| | | /** |
| | | * Constructor of the panel. |
| | | * |
| | | */ |
| | | /** Constructor of the panel. */ |
| | | public ResetUserPasswordPanel() |
| | | { |
| | | super(); |
| | |
| | | packParentDialog(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | final ArrayList<LocalizableMessage> errors = new ArrayList<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_RESET_USER_PASSWORD_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.tools.RestoreDB; |
| | | |
| | | /** |
| | | * The panel that appears when the user wants to restore from a backup. |
| | | * |
| | | */ |
| | | /** The panel that appears when the user wants to restore from a backup. */ |
| | | public class RestorePanel extends BackupListPanel |
| | | implements BackupCreatedListener |
| | | { |
| | |
| | | private JLabel lBackupID; |
| | | private JTextField backupID; |
| | | |
| | | /** |
| | | * Constructor of the panel. |
| | | * |
| | | */ |
| | | /** Constructor of the panel. */ |
| | | public RestorePanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_RESTORE_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backupCreated(BackupCreatedEvent ev) |
| | | { |
| | | boolean refreshList = false; |
| | |
| | | // opened. |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | refreshList(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | | info.addBackupCreatedListener(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | final ServerDescriptor desc = ev.getNewDescriptor(); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | lBackupID.setVisible(!desc.isLocal()); |
| | |
| | | INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void verifyBackupClicked() |
| | | { |
| | | LinkedHashSet<LocalizableMessage> errors = new LinkedHashSet<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | listener = new ListSelectionListener() |
| | | { |
| | | @Override |
| | | public void valueChanged(ListSelectionEvent ev) |
| | | { |
| | | BackupDescriptor backup = getSelectedBackup(); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void checkOKButtonEnable() |
| | | { |
| | | listener.valueChanged(null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | setPrimaryValid(lPath); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | | setPrimaryValid(lPath); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.RESTORE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | if (verify) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | |
| | | return args; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("restore"); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.BackendMessages.*; |
| | | |
| | | /** |
| | | * The panel displaying the root monitor panel. |
| | | */ |
| | | /** The panel displaying the root monitor panel. */ |
| | | public class RootMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563746269830L; |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return openConnections; |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the panel. */ |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * The panel on the right of the 'Manage Schema' panel. |
| | | * |
| | | */ |
| | | /** The panel on the right of the 'Manage Schema' panel. */ |
| | | public class SchemaBrowserRightPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 5294502011852239497L; |
| | |
| | | |
| | | private SchemaElementPanel schemaElementPanel; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public SchemaBrowserRightPanel() |
| | | { |
| | | super(); |
| | |
| | | /** |
| | | * Displays a panel containing a message. |
| | | * @param msg the message. |
| | | * |
| | | */ |
| | | @Override |
| | | public void displayMessage(LocalizableMessage msg) |
| | | { |
| | | schemaElementPanel = null; |
| | |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, NOTHING_SELECTED); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | | super.setInfo(info); |
| | |
| | | * Adds a configuration element created listener. |
| | | * @param listener the listener. |
| | | */ |
| | | @Override |
| | | public void addConfigurationElementCreatedListener( |
| | | ConfigurationElementCreatedListener listener) |
| | | { |
| | |
| | | * Removes a configuration element created listener. |
| | | * @param listener the listener. |
| | | */ |
| | | @Override |
| | | public void removeConfigurationElementCreatedListener( |
| | | ConfigurationElementCreatedListener listener) |
| | | { |
| | |
| | | attributeSyntaxPanel.getTitle().toString()); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | add(mainPanel, gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_SCHEMA_BROWSER_RIGHT_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | /** |
| | | * This is a class where the user can choose from a list of available object |
| | | * classes one or more object classes. |
| | | * |
| | | */ |
| | | public class SelectObjectClassesPanel extends StatusGenericPanel |
| | | { |
| | |
| | | private Schema schema; |
| | | private boolean isCanceled = true; |
| | | |
| | | /** |
| | | * Default constructor of this panel. |
| | | */ |
| | | /** Default constructor of this panel. */ |
| | | public SelectObjectClassesPanel() |
| | | { |
| | | createLayout(); |
| | |
| | | |
| | | Comparator<ObjectClass> comparator = new Comparator<ObjectClass>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(ObjectClass oc1, ObjectClass oc2) |
| | | { |
| | | return oc1.getNameOrOID().toLowerCase().compareTo( |
| | |
| | | add(addRemove, gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return addRemove; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_SUPERIOR_OBJECTCLASSES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | isCanceled = true; |
| | |
| | | return isCanceled; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * The panel that displays a standard attribute definition. |
| | | * |
| | | */ |
| | | /** The panel that displays a standard attribute definition. */ |
| | | public class StandardAttributePanel extends SchemaElementPanel |
| | | { |
| | | private static final long serialVersionUID = -7922968631524763675L; |
| | |
| | | private JList requiredBy = new JList(new DefaultListModel()); |
| | | private JList optionalBy = new JList(new DefaultListModel()); |
| | | |
| | | /** |
| | | * Default constructor of the panel. |
| | | * |
| | | */ |
| | | /** Default constructor of the panel. */ |
| | | public StandardAttributePanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_STANDARD_ATTRIBUTE_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return requiredBy; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | protected void createLayout() |
| | | { |
| | | createBasicLayout(this, new GridBagConstraints()); |
| | |
| | | final JList list = lists[i]; |
| | | MouseAdapter clickListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent ev) |
| | | { |
| | | if (ev.getClickCount() == 1) |
| | |
| | | |
| | | KeyAdapter keyListener = new KeyAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void keyTyped(KeyEvent ev) |
| | | { |
| | | if (ev.getKeyChar() == KeyEvent.VK_SPACE || |
| | |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * The panel that displays a standard object class definition. |
| | | * |
| | | */ |
| | | /** The panel that displays a standard object class definition. */ |
| | | public class StandardObjectClassPanel extends SchemaElementPanel |
| | | { |
| | | private static final long serialVersionUID = 5561268287795223026L; |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_STANDARD_OBJECTCLASS_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return requiredAttributes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | protected void createLayout() |
| | | { |
| | | createBasicLayout(this, new GridBagConstraints()); |
| | |
| | | final JList list = lists[i]; |
| | | MouseAdapter clickListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent ev) |
| | | { |
| | |
| | | |
| | | KeyAdapter keyListener = new KeyAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void keyTyped(KeyEvent ev) |
| | | { |
| | |
| | | { |
| | | private static final long serialVersionUID = -9123358652232556732L; |
| | | |
| | | /** |
| | | * The string to be used as combo separator. |
| | | */ |
| | | /** The string to be used as combo separator. */ |
| | | public static final String COMBO_SEPARATOR = "----------"; |
| | | |
| | | /** |
| | | * The not applicable message. |
| | | */ |
| | | /** The not applicable message. */ |
| | | protected static final LocalizableMessage NOT_APPLICABLE = INFO_NOT_APPLICABLE_LABEL.get(); |
| | | |
| | | private static final LocalizableMessage AUTHENTICATE = INFO_AUTHENTICATE_BUTTON_LABEL.get(); |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Constructor. |
| | | */ |
| | | /** Constructor. */ |
| | | protected StatusGenericPanel() |
| | | { |
| | | super(new GridBagLayout()); |
| | |
| | | p.add(errorPane, gbc); |
| | | } |
| | | |
| | | /** |
| | | * Creates the error pane. |
| | | */ |
| | | /** Creates the error pane. */ |
| | | protected void createErrorPane() |
| | | { |
| | | errorPane = Utilities.makeHtmlPane("", ColorAndFontConstants.progressFont); |
| | |
| | | comp.setFont(ColorAndFontConstants.defaultFont); |
| | | } |
| | | |
| | | /** |
| | | * Packs the parent dialog. |
| | | */ |
| | | /** Packs the parent dialog. */ |
| | | protected void packParentDialog() |
| | | { |
| | | Window dlg = Utilities.getParentDialog(this); |
| | |
| | | errorPane, title, ColorAndFontConstants.errorTitleFont, mb.toMessage(), ColorAndFontConstants.defaultFont); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | * The panel displaying the general status of the server (started/stopped), |
| | | * basic configuration (base DNs, connection listeners) and that allows to start |
| | | * and stop the server. |
| | | * |
| | | */ |
| | | class StatusPanel extends StatusGenericPanel |
| | | { |
| | |
| | | private ConnectionHandlerTableModel connectionHandlerTableModel; |
| | | private JTable connectionHandlersTable; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public StatusPanel() |
| | | { |
| | | super(); |
| | |
| | | inScrollPanel.add(Box.createVerticalGlue(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | if (startButton.isVisible()) |
| | |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | |
| | | Utilities.updateTableSizes(connectionHandlersTable); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_STATUS_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(final ConfigurationChangeEvent ev) |
| | | { |
| | | if (SwingUtilities.isEventDispatchThread()) |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | updateContents(ev.getNewDescriptor()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | |
| | | stopButton.setOpaque(false); |
| | | stopButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | stopServer(); |
| | |
| | | statusPanel.add(startButton, gbc); |
| | | startButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | startServer(); |
| | |
| | | restartButton.setOpaque(false); |
| | | restartButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | restartServer(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * The panel displaying the system information monitoring panel. |
| | | */ |
| | | /** The panel displaying the system information monitoring panel. */ |
| | | public class SystemInformationMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563298069830L; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public SystemInformationMonitoringPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return monitoringLabels.get(0); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the panel. */ |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.backends.task.RecurringTask; |
| | | |
| | | /** |
| | | * The panel that allows the user to specify when a task will be launched. |
| | | * |
| | | */ |
| | | /** The panel that allows the user to specify when a task will be launched. */ |
| | | public class TaskToSchedulePanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 6855081932432566784L; |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | scheduleType.addItemListener(new ItemListener() |
| | | { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent ev) |
| | | { |
| | | Object element = scheduleType.getSelectedItem(); |
| | |
| | | add(Box.createVerticalGlue(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | | // Reset the schedule and the labels |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_TASK_TO_SCHEDULE_TITLE.get(taskName); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | schedule = null; |
| | |
| | | return schedule == null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return scheduleType; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | * It proposes the user to save the changes, do not save them or cancel the |
| | | * action that make the dialog appear (for instance when the user is editing |
| | | * an entry and clicks on another node, this dialog appears). |
| | | * |
| | | */ |
| | | public class UnsavedChangesDialog extends GenericDialog |
| | | { |
| | | /** |
| | | * The different input that the user can provide. |
| | | * |
| | | */ |
| | | /** The different input that the user can provide. */ |
| | | public enum Result |
| | | { |
| | | /** |
| | | * The user asks to save the changes. |
| | | */ |
| | | /** The user asks to save the changes. */ |
| | | SAVE, |
| | | /** |
| | | * The user asks to not to save the changes. |
| | | */ |
| | | /** The user asks to not to save the changes. */ |
| | | DO_NOT_SAVE, |
| | | /** |
| | | * The user asks to cancel the operation that made this dialog to appear. |
| | | */ |
| | | /** The user asks to cancel the operation that made this dialog to appear. */ |
| | | CANCEL |
| | | } |
| | | private static final long serialVersionUID = -4436794801035162388L; |
| | |
| | | pack(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVisible(boolean visible) |
| | | { |
| | | if (visible) |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** |
| | | * The panel to be displayed inside the dialog. |
| | | * |
| | | */ |
| | | /** The panel to be displayed inside the dialog. */ |
| | | private static class UnsavedChangesPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -1528939816762604059L; |
| | |
| | | |
| | | private Result result; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public UnsavedChangesPanel() |
| | | { |
| | | super(); |
| | |
| | | add(createButtonsPanel(), gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresBorder() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | |
| | | buttonsPanel.add(doNotSaveButton, gbc); |
| | | doNotSaveButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | result = Result.DO_NOT_SAVE; |
| | |
| | | buttonsPanel.add(cancelButton, gbc); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | result = Result.CANCEL; |
| | |
| | | buttonsPanel.add(saveButton, gbc); |
| | | saveButton.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | result = Result.SAVE; |
| | |
| | | return buttonsPanel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return doNotSaveButton; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_UNSAVED_CHANGES_DIALOG_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDisposeOnClose() |
| | | { |
| | | return true; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.guitools.controlpanel.util.ViewPositions; |
| | | |
| | | /** |
| | | * The panel that appears when the user wants to verify an index. |
| | | */ |
| | | /** The panel that appears when the user wants to verify an index. */ |
| | | public class VerifyIndexPanel extends StatusGenericPanel implements IndexModifiedListener |
| | | { |
| | | private static final long serialVersionUID = 5252070109221657041L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.tools.ConfigureWindowsService; |
| | | |
| | | /** |
| | | * The panel that displays the Windows Service panel configuration for the |
| | | * server. |
| | | * |
| | | */ |
| | | /** The panel that displays the Windows Service panel configuration for the server. */ |
| | | public class WindowsServicePanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 6415350296295459469L; |
| | |
| | | |
| | | private boolean isWindowsServiceEnabled; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public WindowsServicePanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_WINDOWS_SERVICE_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | |
| | | ActionListener listener = new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | updateWindowsService(); |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.CLOSE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | if (!isWindowsServiceEnabled) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | boolean previousValue = isWindowsServiceEnabled; |
| | |
| | | previousLocal = isLocal; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | lState.setText(isWindowsServiceEnabled ? |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // NO ok button |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The task in charge of updating the windows service configuration. |
| | | * |
| | | */ |
| | | /** The task in charge of updating the windows service configuration. */ |
| | | protected class WindowsServiceTask extends Task |
| | | { |
| | | Set<String> backendSet; |
| | |
| | | backendSet = new HashSet<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | if (enableService) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | if (enableService) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | ArrayList<String> args = new ArrayList<>(); |
| | |
| | | return args; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return getCommandLinePath("windows-service"); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * The panel displaying the work queue monitor panel. |
| | | */ |
| | | /** The panel displaying the work queue monitor panel. */ |
| | | public class WorkQueueMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563700069830L; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public WorkQueueMonitoringPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return monitoringLabels.get(0); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of the panel. |
| | | * |
| | | */ |
| | | /** Updates the contents of the panel. */ |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.border; |
| | |
| | | public AccordionElementBorder() { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Insets getBorderInsets(Component c) { |
| | | return insets; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isBorderOpaque() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void paintBorder(Component c, Graphics g, int x, int y, int width, |
| | | int height) { |
| | | g.setColor(ColorAndFontConstants.topAccordionBorderColor); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.border; |
| | |
| | | public SelectedCategoryBorder() { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Insets getBorderInsets(Component c) |
| | | { |
| | | return insets; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isBorderOpaque() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) |
| | | { |
| | | // render shadow on bottom |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | | |
| | |
| | | repaint(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateUI() { |
| | | super.updateUI(); |
| | |
| | | setBorder(buttonBorder); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void paintComponent(Graphics g) { |
| | | setBorder(hasFocus() ? focusBorder : buttonBorder); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | |
| | | ListDataListener listDataListener = new ListDataListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void intervalRemoved(ListDataEvent ev) |
| | | { |
| | | updateButtonEnabling(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void intervalAdded(ListDataEvent ev) |
| | | { |
| | | updateButtonEnabling(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void contentsChanged(ListDataEvent ev) |
| | | { |
| | | updateButtonEnabling(); |
| | |
| | | }; |
| | | MouseAdapter doubleClickListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent e) { |
| | | if (isEnabled() && e.getClickCount() == 2) |
| | | { |
| | |
| | | add.setOpaque(false); |
| | | add.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | addClicked(); |
| | |
| | | addAll.setOpaque(false); |
| | | addAll.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | selectedListModel.addAll(availableListModel.getData()); |
| | |
| | | remove.setOpaque(false); |
| | | remove.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | removeClicked(); |
| | |
| | | removeAll.setOpaque(false); |
| | | removeAll.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | availableListModel.addAll(selectedListModel.getData()); |
| | |
| | | ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
| | | ListSelectionListener listener = new ListSelectionListener() |
| | | { |
| | | @Override |
| | | public void valueChanged(ListSelectionEvent ev) |
| | | { |
| | | updateButtonEnabling(); |
| | |
| | | * Enables the state of the components in the panel. |
| | | * @param enable whether to enable the components in the panel or not. |
| | | */ |
| | | @Override |
| | | public void setEnabled(boolean enable) |
| | | { |
| | | super.setEnabled(enable); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | * A simple panel used in the LDAP entry viewers to display a binary value. |
| | | * It does not allow to edit the binary value. It is used for instance in the |
| | | * tables. |
| | | * |
| | | */ |
| | | public class BinaryCellPanel extends JPanel |
| | | { |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BinaryCellPanel() |
| | | { |
| | | super(new GridBagLayout()); |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Explicitly request the focus for the edit button of this panel. |
| | | * |
| | | */ |
| | | /** Explicitly request the focus for the edit button of this panel. */ |
| | | public void requestFocusForButton() |
| | | { |
| | | editButton.requestFocusInWindow(); |
| | |
| | | deleteButton.removeActionListener(listener); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, |
| | | int condition, boolean pressed) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | * A component that acts as a checkbox but uses some customized buttons to |
| | | * indicate the selected and unselected states. This component is used in the |
| | | * 'Import LDIF' and 'Export LDIF' panels to hide parts of the dialog. |
| | | * |
| | | */ |
| | | class CategoryButton extends JCheckBox |
| | | { |
| | |
| | | setBorder(isSelected() ? buttonSelectedBorder : buttonUnselectedBorder); |
| | | addChangeListener(new ChangeListener() |
| | | { |
| | | @Override |
| | | public void stateChanged(ChangeEvent e) |
| | | { |
| | | setBorder(isSelected() ? buttonSelectedBorder : buttonUnselectedBorder); |
| | |
| | | setFont(ColorAndFontConstants.categoryFont); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateUI() |
| | | { |
| | | super.updateUI(); |
| | |
| | | setBorder(isSelected() ? buttonSelectedBorder : buttonUnselectedBorder); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void paintComponent(Graphics g) { |
| | | setBackground(backgroundColor); |
| | | g.setColor(backgroundColor); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | * The panel representing a category. It contains a CategoryButton and a panel |
| | | * that is displayed when the CategoryButton is in a certain state. They |
| | | * are used on the left side of the main Control Panel. |
| | | * |
| | | */ |
| | | public class CategoryPanel extends JPanel { |
| | | private static final long serialVersionUID = 8941374689175404431L; |
| | |
| | | return expanded; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setForeground(Color foreground) |
| | | { |
| | | super.setForeground(foreground); |
| | |
| | | /** The custom listener used to display the child component. */ |
| | | private class CollapseListener implements ChangeListener |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void stateChanged(ChangeEvent event) { |
| | | setExpanded(expandButton.isSelected()); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | super(label.toString()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean processKeyBinding(KeyStroke ks, KeyEvent e, |
| | | int condition, boolean pressed) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | * browser, index browser or the LDAP entries browser). It renders in a |
| | | * different manner than the default tree (selection takes the whole width |
| | | * of the tree, in a similar manner as happens with trees in Mac OS). |
| | | * |
| | | */ |
| | | public class CustomTree extends JTree |
| | | { |
| | |
| | | private JPopupMenu popupMenu; |
| | | private final int MAX_ICON_HEIGHT = 18; |
| | | |
| | | /** |
| | | * Internal enumeration used to translate mouse events. |
| | | * |
| | | */ |
| | | /** Internal enumeration used to translate mouse events. */ |
| | | private enum NewEventType |
| | | { |
| | | MOUSE_PRESSED, MOUSE_CLICKED, MOUSE_RELEASED |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void paintComponent(Graphics g) |
| | | { |
| | | int[] selectedRows = getSelectionRows(); |
| | |
| | | MouseListener mouseListener = new MouseAdapter() |
| | | { |
| | | private boolean ignoreEvents; |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mousePressed(MouseEvent ev) |
| | | { |
| | | if (ignoreEvents) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseReleased(MouseEvent ev) |
| | | { |
| | | if (ignoreEvents) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent ev) |
| | | { |
| | | if (ignoreEvents) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addMouseListener(MouseListener mouseListener) |
| | | { |
| | | super.addMouseListener(mouseListener); |
| | |
| | | mouseListeners.add(mouseListener); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeMouseListener(MouseListener mouseListener) |
| | | { |
| | | super.removeMouseListener(mouseListener); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | | |
| | |
| | | |
| | | ListDataListener listDataListener = new ListDataListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void intervalRemoved(ListDataEvent ev) |
| | | { |
| | | listSelectionChanged(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void intervalAdded(ListDataEvent ev) |
| | | { |
| | | listSelectionChanged(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void contentsChanged(ListDataEvent ev) |
| | | { |
| | | listSelectionChanged(); |
| | |
| | | }; |
| | | MouseAdapter doubleClickListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseClicked(MouseEvent e) { |
| | | if (isEnabled() && e.getClickCount() == 2) |
| | | { |
| | |
| | | add1.setOpaque(false); |
| | | add1.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | addClicked(selectedListModel1); |
| | |
| | | addAll1.setOpaque(false); |
| | | addAll1.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | moveAll(availableListModel, selectedListModel1); |
| | |
| | | remove1.setOpaque(false); |
| | | remove1.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | remove1Clicked(); |
| | |
| | | removeAll1.setOpaque(false); |
| | | removeAll1.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | moveAll(selectedListModel1, availableListModel); |
| | |
| | | add2.setOpaque(false); |
| | | add2.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | addClicked(selectedListModel2); |
| | |
| | | addAll2.setOpaque(false); |
| | | addAll2.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | moveAll(availableListModel, selectedListModel2); |
| | |
| | | remove2.setOpaque(false); |
| | | remove2.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | remove2Clicked(); |
| | |
| | | removeAll2.setOpaque(false); |
| | | removeAll2.addActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | moveAll(selectedListModel2, availableListModel); |
| | |
| | | ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
| | | ListSelectionListener listener = new ListSelectionListener() |
| | | { |
| | | @Override |
| | | public void valueChanged(ListSelectionEvent ev) |
| | | { |
| | | listSelectionChanged(); |
| | |
| | | selectedScroll2.setPreferredSize(d); |
| | | } |
| | | |
| | | /** |
| | | * Enables the state of the components in the panel. |
| | | * @param enable whether to enable the components in the panel or not. |
| | | */ |
| | | @Override |
| | | public void setEnabled(boolean enable) |
| | | { |
| | | super.setEnabled(enable); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | /** |
| | | * A text field with an icon with 'X' shape on the right. When the user clicks |
| | | * on that icon, the contents of the text field are cleared. |
| | | * |
| | | */ |
| | | public class FilterTextField extends JTextField |
| | | { |
| | |
| | | private boolean mousePressed; |
| | | private boolean displayRefreshIcon; |
| | | |
| | | /** |
| | | * The time during which the refresh icon is displayed by default. |
| | | */ |
| | | /** The time during which the refresh icon is displayed by default. */ |
| | | public static long DEFAULT_REFRESH_ICON_TIME = 750; |
| | | |
| | | private LinkedHashSet<ActionListener> listeners = new LinkedHashSet<>(); |
| | |
| | | constructorBorderSet = true; |
| | | getDocument().addDocumentListener(new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent e) |
| | | { |
| | | insertUpdate(e); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent e) |
| | | { |
| | | boolean displayIcon = getText().length() > 0; |
| | |
| | | repaint(); |
| | | } |
| | | } |
| | | @Override |
| | | public void removeUpdate(DocumentEvent e) |
| | | { |
| | | insertUpdate(e); |
| | |
| | | |
| | | addMouseListener(new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mousePressed(MouseEvent ev) |
| | | { |
| | | boolean p = getClearIconRectangle().contains(ev.getPoint()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseReleased(MouseEvent ev) |
| | | { |
| | | if (mousePressed && getClearIconRectangle().contains(ev.getPoint())) |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * Adds an action listener to this text field. When the user clicks on the |
| | | * 'X' shaped icon the listeners are notified. |
| | | * @param listener the action listener. |
| | | */ |
| | | @Override |
| | | public void addActionListener(ActionListener listener) |
| | | { |
| | | listeners.add(listener); |
| | | } |
| | | |
| | | /** |
| | | * Removes an action listener to this text field. |
| | | * @param listener the action listener. |
| | | */ |
| | | @Override |
| | | public void removeActionListener(ActionListener listener) |
| | | { |
| | | listeners.remove(listener); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setBorder(Border border) |
| | | { |
| | | if (constructorBorderSet && border != null) |
| | |
| | | * Displays a refresh icon on the text field (this is used for instance in |
| | | * the browsers that use this text field to specify a filter: the refresh |
| | | * icon is displayed to show that the filter is being displayed). |
| | | * @param time the time (in miliseconds) that the icon will be displayed. |
| | | * |
| | | * @param time the time (in milliseconds) that the icon will be displayed. |
| | | */ |
| | | public void displayRefreshIcon(final long time) |
| | | { |
| | |
| | | repaint(); |
| | | Thread t = new Thread(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | try |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | displayRefreshIcon = false; |
| | |
| | | margin, icon.getIconWidth(), icon.getIconHeight()); |
| | | } |
| | | |
| | | /** |
| | | * The border of this filter text field. |
| | | * |
| | | */ |
| | | /** The border of this filter text field. */ |
| | | private class IconBorder implements Border |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Insets getBorderInsets(Component c) |
| | | { |
| | | ImageIcon icon = getClearIcon(); |
| | |
| | | return new Insets(0, 0, 0, rightInsets); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void paintBorder(Component c, Graphics g, int x, int y, |
| | | int width, int height) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isBorderOpaque() |
| | | { |
| | | return false; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | import javax.swing.JLabel; |
| | | import javax.swing.JPanel; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * A panel containing a label an a help icon. A customized tool tip is used, |
| | | * the tool tip is also displayed when the user clicks on the help icon. |
| | | * |
| | | */ |
| | | public class LabelWithHelpIcon extends JPanel |
| | | { |
| | | private static final long serialVersionUID = 4502977901538910797L; |
| | | /** |
| | | * The label with the text. |
| | | */ |
| | | /** The label with the text. */ |
| | | protected JLabel label = Utilities.createDefaultLabel(); |
| | | /** |
| | | * The label with the icon. |
| | | */ |
| | | /** The label with the icon. */ |
| | | protected JLabel iconLabel = new JLabel(icon); |
| | | private static final ImageIcon icon = |
| | | Utilities.createImageIcon("org/opends/quicksetup/images/help_small.gif"); |
| | | |
| | | |
| | | /** |
| | | * The left inset of the help icon. |
| | | */ |
| | | /** The left inset of the help icon. */ |
| | | protected final int INSET_WITH_ICON= 3; |
| | | |
| | | /** |
| | |
| | | return label.getText(); |
| | | } |
| | | |
| | | /** |
| | | * Sets the font to be used in this panel. |
| | | * @param font the font. |
| | | */ |
| | | @Override |
| | | public void setFont(Font font) |
| | | { |
| | | // This is call by the constructor of JPanel. |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Sets the foreground color for the text in this panel. |
| | | * @param color the foreground color for the text in this panel. |
| | | */ |
| | | @Override |
| | | public void setForeground(Color color) |
| | | { |
| | | super.setForeground(color); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getToolTipText(MouseEvent ev) |
| | | { |
| | | int x = ev.getPoint().x; |
| | | boolean display = x > label.getPreferredSize().width - 10; |
| | | |
| | | if (display) |
| | | { |
| | | return getHelpTooltip(); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | return display ? getHelpTooltip() : null; |
| | | } |
| | | |
| | | private void updateAccessibleContext() |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | | |
| | |
| | | this.maxSize = maxSize; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertString(DocumentFilter.FilterBypass fb, int offset, |
| | | String text, AttributeSet attr) |
| | | throws BadLocationException |
| | |
| | | updateCaretPosition(fb); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void replace(DocumentFilter.FilterBypass fb, int offset, |
| | | int length, String text, AttributeSet attr) |
| | | throws BadLocationException |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | * values of an entry. It displays the structural and auxiliary object classes. |
| | | * It does not allow to edit directly the object class value. It is used for |
| | | * instance in the entry editors (simplified and table views). |
| | | * |
| | | */ |
| | | public class ObjectClassCellPanel extends JPanel |
| | | { |
| | |
| | | private ImageIcon lockIcon = |
| | | Utilities.createImageIcon(IconPool.IMAGE_PATH+"/field-locked.png"); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ObjectClassCellPanel() |
| | | { |
| | | super(new GridBagLayout()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Explicitly request the focus for the edit button of this panel. |
| | | * |
| | | */ |
| | | /** Explicitly request the focus for the edit button of this panel. */ |
| | | public void requestFocusForButton() |
| | | { |
| | | editButton.requestFocusInWindow(); |
| | |
| | | editButton.setVisible(visible); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, |
| | | int condition, boolean pressed) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | | |
| | |
| | | change = Utilities.createButton(INFO_CTRL_PANEL_CHANGE_SCHEDULE.get()); |
| | | change.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | changeButtonClicked(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | import javax.swing.JPanel; |
| | | import javax.swing.text.JTextComponent; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * A panel containing a label an a help icon. A customized tool tip is used, |
| | | * the tool tip is also displayed when the user clicks on the help icon. |
| | | * The main difference with {@code LabelWithHelpIcon} is that this uses |
| | | * a {@code JEditorPane} as label. |
| | | * |
| | | */ |
| | | public class SelectableLabelWithHelpIcon extends JPanel |
| | | { |
| | | private static final long serialVersionUID = 4502977901098910797L; |
| | | /** |
| | | * The label with the text. |
| | | */ |
| | | /** The label with the text. */ |
| | | private JTextComponent label = Utilities.makeHtmlPane("", |
| | | ColorAndFontConstants.defaultFont); |
| | | /** |
| | | * The label with the icon. |
| | | */ |
| | | /** The label with the icon. */ |
| | | private JLabel iconLabel = new JLabel(icon); |
| | | private static final ImageIcon icon = |
| | | Utilities.createImageIcon("org/opends/quicksetup/images/help_small.gif"); |
| | | |
| | | /** |
| | | * The left inset of the help icon. |
| | | */ |
| | | /** The left inset of the help icon. */ |
| | | private final int INSET_WITH_ICON= 3; |
| | | |
| | | /** |
| | |
| | | return label.getText(); |
| | | } |
| | | |
| | | /** |
| | | * Sets the font to be used in this panel. |
| | | * @param font the font. |
| | | */ |
| | | @Override |
| | | public void setFont(Font font) |
| | | { |
| | | // This is called by the constructor of JPanel. |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Sets the foreground color for the text in this panel. |
| | | * @param color the foreground color for the text in this panel. |
| | | */ |
| | | @Override |
| | | public void setForeground(Color color) |
| | | { |
| | | super.setForeground(color); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getToolTipText(MouseEvent ev) |
| | | { |
| | | int x = ev.getPoint().x; |
| | | boolean display = x > label.getPreferredSize().width - 10; |
| | | |
| | | if (display) |
| | | { |
| | | return getHelpTooltip(); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | return display ? getHelpTooltip() : null; |
| | | } |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | | |
| | |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * A panel that can be used to select one (or several) object classes. |
| | | */ |
| | | /** A panel that can be used to select one (or several) object classes. */ |
| | | public class SuperiorObjectClassesEditor extends JPanel |
| | | { |
| | | private static final long serialVersionUID = 123123973933568L; |
| | |
| | | |
| | | private Schema schema; |
| | | |
| | | /** |
| | | * Default constructor for this panel. |
| | | */ |
| | | /** Default constructor for this panel. */ |
| | | public SuperiorObjectClassesEditor() |
| | | { |
| | | super(new CardLayout()); |
| | |
| | | updateWithSchema(schema); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of this panel. |
| | | */ |
| | | /** Creates the layout of this panel. */ |
| | | private void createLayout() |
| | | { |
| | | bSpecifyMultiple.setToolTipText( |
| | | INFO_CTRL_PANEL_SPECIFY_MULTIPLE_SUPERIORS_TOOLTIP.get().toString()); |
| | | bSpecifyMultiple.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | specifyMultipleClicked(); |
| | |
| | | INFO_CTRL_PANEL_UPDATE_MULTIPLE_SUPERIORS_TOOLTIP.get().toString()); |
| | | bUpdateMultiple.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | updateMultipleClicked(); |
| | |
| | | singleSuperior.setRenderer(renderer); |
| | | ItemListener itemListener = new ItemListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void itemStateChanged(ItemEvent ev) |
| | | { |
| | | notifyListeners(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | | |
| | |
| | | import javax.swing.text.DocumentFilter; |
| | | import javax.swing.text.JTextComponent; |
| | | |
| | | /** |
| | | * Document filter used to update properly a text component displaying a |
| | | * time. |
| | | */ |
| | | /** Document filter used to update properly a text component displaying a time. */ |
| | | public class TimeDocumentFilter extends DocumentFilter |
| | | { |
| | | private JTextComponent tf; |
| | |
| | | this.tf = tf; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertString(DocumentFilter.FilterBypass fb, int offset, |
| | | String text, AttributeSet attr) |
| | | throws BadLocationException |
| | |
| | | trimPosition(fb, text, offset, previousLength); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove(DocumentFilter.FilterBypass fb, int offset, |
| | | int length) |
| | | throws BadLocationException |
| | |
| | | updateCaretPosition(fb); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void replace(DocumentFilter.FilterBypass fb, int offset, |
| | | int length, String text, AttributeSet attr) |
| | | throws BadLocationException |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | import org.opends.guitools.controlpanel.ui.renderer.TreeCellRenderer; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * A basic panel containing a CustomTree. |
| | | * |
| | | */ |
| | | /** A basic panel containing a CustomTree. */ |
| | | public class TreePanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 5650902943430126109L; |
| | | private JTree tree; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public TreePanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | * |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | return tree; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // No ok button |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | | return GenericDialog.ButtonType.NO_BUTTON; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return tree; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import javax.swing.tree.DefaultMutableTreeNode; |
| | | |
| | | /** |
| | | * Abstract class with some common methods for all the nodes in the |
| | | * 'Manage Index' tree. |
| | | */ |
| | | /** Abstract class with some common methods for all the nodes in the 'Manage Index' tree. */ |
| | | public abstract class AbstractIndexTreeNode extends DefaultMutableTreeNode |
| | | { |
| | | private static final long serialVersionUID = 8055748310817873273L; |
| | |
| | | return name; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRoot() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isLeaf() |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | |
| | | |
| | | /** |
| | | * Class of the nodes that represent an attribute syntax in the 'Manage Schema' |
| | | * tree. |
| | | * |
| | | */ |
| | | /** Class of the nodes that represent an attribute syntax in the 'Manage Schema' tree. */ |
| | | public class AttributeSyntaxTreeNode extends SchemaElementTreeNode |
| | | { |
| | | private static final long serialVersionUID = 2439971368723239776L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | |
| | | |
| | | import org.opends.server.types.LDAPURL; |
| | | |
| | | /** |
| | | * Interface used in the LDAP entries browser code to deal with entries. |
| | | * |
| | | */ |
| | | /** Interface used in the LDAP entries browser code to deal with entries. */ |
| | | public interface BrowserNodeInfo { |
| | | |
| | | /** |
| | |
| | | * current server. An entry is declared 'remote' when the host/port of |
| | | * getURL() is different from the host/port of the DirContext associated to |
| | | * the browser controller. Returns <CODE>false</CODE> otherwise. |
| | | * |
| | | */ |
| | | boolean isRemote(); |
| | | |
| | |
| | | */ |
| | | String[] getObjectClassValues(); |
| | | |
| | | /** |
| | | * Error types |
| | | */ |
| | | /** Error types. */ |
| | | /** No error happened. */ |
| | | int ERROR_NONE = 0; |
| | | /** And error reading the entry occurred. */ |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | |
| | | * The tree node that is used to represent a category. It is used for instance |
| | | * in the browse index tree to separate categories (index type) from the actual |
| | | * index nodes. |
| | | * |
| | | */ |
| | | public class CategoryTreeNode extends DefaultMutableTreeNode |
| | | { |
| | |
| | | super(name); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRoot() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isLeaf() |
| | | { |
| | | return getChildCount() == 0; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import org.opends.server.types.ObjectClass; |
| | | |
| | | /** |
| | | * Class of the nodes that represent a configuration object class in the 'Manage |
| | | * Schema' tree. |
| | | * |
| | | */ |
| | | /** Class of the nodes that represent a configuration object class in the 'Manage Schema' tree. */ |
| | | public class ConfigurationObjectClassTreeNode extends SchemaElementTreeNode |
| | | { |
| | | private static final long serialVersionUID = 9121561141135641060L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import org.opends.server.types.ObjectClass; |
| | | |
| | | /** |
| | | * Class of the nodes that represent a custom object class in the 'Manage |
| | | * Schema' tree. |
| | | * |
| | | */ |
| | | /** Class of the nodes that represent a custom object class in the 'Manage Schema' tree. */ |
| | | public class CustomObjectClassTreeNode extends SchemaElementTreeNode |
| | | { |
| | | private static final long serialVersionUID = -3525236184507876077L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | |
| | | /** The component that contains the nodes. */ |
| | | private Component parent; |
| | | |
| | | /** |
| | | /* |
| | | * Transferable implementation |
| | | * ============================================ |
| | | */ |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDataFlavorSupported(DataFlavor df) { |
| | | return df.equals(INFO_FLAVOR); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getTransferData(DataFlavor df) |
| | | throws UnsupportedFlavorException, IOException { |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DataFlavor[] getTransferDataFlavors() { |
| | | return FLAVORS; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import javax.swing.tree.DefaultMutableTreeNode; |
| | | |
| | | /** |
| | | * Abstract class with some common methods for all the nodes in the |
| | | * 'General Information' tree. |
| | | * |
| | | */ |
| | | /** Abstract class with some common methods for all the nodes in the 'General Information' tree. */ |
| | | public class GeneralMonitoringTreeNode extends DefaultMutableTreeNode |
| | | { |
| | | private static final long serialVersionUID = 7896765876669863639L; |
| | |
| | | return identifier; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRoot() |
| | | { |
| | | return isRoot; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isLeaf() |
| | | { |
| | | return getChildCount() == 0; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | |
| | | /** |
| | | * A node representing a 'normal' index. It is used in the 'Manage Index' tree. |
| | | * |
| | | */ |
| | | /** A node representing a 'normal' index. It is used in the 'Manage Index' tree. */ |
| | | public class IndexTreeNode extends AbstractIndexTreeNode |
| | | { |
| | | private static final long serialVersionUID = -3527916032758373700L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | |
| | | /** |
| | | * Class of the nodes that represent a matching rule in the 'Manage Schema' |
| | | * tree. |
| | | * |
| | | */ |
| | | /** Class of the nodes that represent a matching rule in the 'Manage Schema' tree. */ |
| | | public class MatchingRuleTreeNode extends SchemaElementTreeNode |
| | | { |
| | | private static final long serialVersionUID = 75800988643731136L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | |
| | | /** |
| | | * The root node of the tree in the 'Manage Entries...' tree. It represents |
| | | * the root entry of the directory. |
| | | * |
| | | */ |
| | | public class RootNode extends SuffixNode { |
| | | |
| | | private static final long serialVersionUID = 9030738910898224866L; |
| | | |
| | | /** |
| | | * Constructor of the node. |
| | | * |
| | | */ |
| | | /** Constructor of the node. */ |
| | | public RootNode() { |
| | | super(""); |
| | | setLeaf(false); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import javax.swing.tree.DefaultMutableTreeNode; |
| | | |
| | | /** |
| | | * Abstract class with some common methods for all the nodes in the |
| | | * 'Manage Schema' tree. |
| | | * |
| | | */ |
| | | /** Abstract class with some common methods for all the nodes in the 'Manage Schema' tree. */ |
| | | public abstract class SchemaElementTreeNode extends DefaultMutableTreeNode |
| | | { |
| | | private static final long serialVersionUID = 5832209952457633471L; |
| | |
| | | return schemaElement; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRoot() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isLeaf() |
| | | { |
| | | return true; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | |
| | | import org.opends.server.types.ObjectClass; |
| | | |
| | | |
| | | /** |
| | | * Class of the nodes that represent a standard object class in the 'Manage |
| | | * Schema' tree. |
| | | * |
| | | */ |
| | | /** Class of the nodes that represent a standard object class in the 'Manage Schema' tree. */ |
| | | public class StandardObjectClassTreeNode extends SchemaElementTreeNode |
| | | { |
| | | private static final long serialVersionUID = 3266062905133766539L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | /** |
| | | * Represents a suffix in the tree in the 'Manage Entries...' tree. |
| | | * |
| | | */ |
| | | /** Represents a suffix in the tree in the 'Manage Entries...' tree. */ |
| | | public class SuffixNode extends BasicNode { |
| | | |
| | | private static final long serialVersionUID = -58392395417985255L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor; |
| | | |
| | | /** |
| | | * A node representing a VLV index. It is used in the 'Manage Index' tree. |
| | | * |
| | | */ |
| | | /** A node representing a VLV index. It is used in the 'Manage Index' tree. */ |
| | | public class VLVIndexTreeNode extends AbstractIndexTreeNode |
| | | { |
| | | private static final long serialVersionUID = -4067198828465569689L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Contains the panels and dialogs displayed in the Control Panel. |
| | | * |
| | | */ |
| | | /** Contains the panels and dialogs displayed in the Control Panel. */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * Class used to have components that provide a valid accessible name. |
| | | */ |
| | | /** Class used to have components that provide a valid accessible name. */ |
| | | public class AccessibleTableHeaderRenderer implements TableCellRenderer |
| | | { |
| | | private TableCellRenderer renderer; |
| | |
| | | this.renderer = renderer; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | import org.opends.guitools.controlpanel.ui.components.ObjectClassCellPanel; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * The cell editor used in the 'Attribute' View of the entries in the LDAP |
| | | * entry browser. |
| | | * |
| | | */ |
| | | /** The cell editor used in the 'Attribute' View of the entries in the LDAP entry browser. */ |
| | | public class AttributeCellEditor extends AbstractCellEditor |
| | | implements TableCellEditor |
| | | { |
| | |
| | | private String attrName; |
| | | |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public AttributeCellEditor() |
| | | { |
| | | textField = Utilities.createTextField(); |
| | | textField.getDocument().addDocumentListener(new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent ev) |
| | | { |
| | | if (!textField.hasFocus()) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) |
| | | { |
| | | changedUpdate(ev); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) |
| | | { |
| | | changedUpdate(ev); |
| | |
| | | passwordField = Utilities.createPasswordField(); |
| | | passwordField.getDocument().addDocumentListener(new DocumentListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void changedUpdate(DocumentEvent ev) |
| | | { |
| | | if (!passwordField.hasFocus()) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) |
| | | { |
| | | changedUpdate(ev); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) |
| | | { |
| | | changedUpdate(ev); |
| | |
| | | binaryPanel = new BinaryCellPanel(); |
| | | binaryPanel.addEditActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) |
| | | { |
| | | if (editBinaryDlg == null) |
| | |
| | | ocPanel = new ObjectClassCellPanel(); |
| | | ocPanel.addEditActionListener(new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | if (editOcDlg == null) |
| | |
| | | }); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellEditorComponent(JTable table, Object value, |
| | | boolean isSelected, int row, int column) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getCellEditorValue() |
| | | { |
| | | if (binaryValue != null) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | /** |
| | | * Renderer of the table that contains the list of backups (it is used in the |
| | | * tables of the verify backup and restore panels). |
| | | * |
| | | */ |
| | | public class BackupTableCellRenderer extends DefaultTableCellRenderer |
| | | { |
| | |
| | | private static final Border incrementalBorder = |
| | | BorderFactory.createEmptyBorder(4, 4, 4, 4); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public BackupTableCellRenderer() |
| | | { |
| | | setForeground(ColorAndFontConstants.tableForeground); |
| | |
| | | this.backupParentPath = backupParentPath; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | | import java.awt.Component; |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNTableModel; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * Class used to render the base DN table cells. |
| | | */ |
| | | /** Class used to render the base DN table cells. */ |
| | | public class BaseDNCellRenderer extends CustomCellRenderer |
| | | { |
| | | private static final long serialVersionUID = -256719167426289735L; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public BaseDNCellRenderer() |
| | | { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) { |
| | | String text = (String)value; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | |
| | | /** |
| | | * The renderer used to render the nodes in the LDAP entry browser. |
| | | * |
| | | */ |
| | | /** The renderer used to render the nodes in the LDAP entry browser. */ |
| | | public class BrowserCellRenderer extends TreeCellRenderer { |
| | | |
| | | private static final long serialVersionUID = 6756291700611741513L; |
| | |
| | | inspectedNode = node; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTreeCellRendererComponent( |
| | | JTree tree, |
| | | Object value, |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * Class used to render the tables. |
| | | */ |
| | | /** Class used to render the tables. */ |
| | | public class CustomCellRenderer extends LabelWithHelpIcon |
| | | implements TableCellRenderer |
| | | { |
| | | private static final long serialVersionUID = -8604332267021523835L; |
| | | /** |
| | | * The border of the first column. |
| | | */ |
| | | /** The border of the first column. */ |
| | | protected static final Border column0Border = |
| | | BorderFactory.createCompoundBorder( |
| | | BorderFactory.createMatteBorder(0, 1, 0, 0, |
| | | ColorAndFontConstants.gridColor), |
| | | BorderFactory.createEmptyBorder(4, 4, 4, 4)); |
| | | /** |
| | | * The default border. |
| | | */ |
| | | /** The default border. */ |
| | | public static final Border defaultBorder = |
| | | BorderFactory.createEmptyBorder(4, 4, 4, 4); |
| | | private static Border defaultFocusBorder; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public CustomCellRenderer() |
| | | { |
| | | super(LocalizableMessage.EMPTY, null); |
| | |
| | | setForeground(ColorAndFontConstants.treeForeground); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) { |
| | | if (value instanceof String) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | | import java.awt.BorderLayout; |
| | |
| | | * A renderer used in the Control Panel that deals with |
| | | * CategorizedComboBoxElement elements. It can be used to render JList and |
| | | * JComboBoxes. |
| | | * |
| | | */ |
| | | public class CustomListCellRenderer implements ListCellRenderer |
| | | { |
| | | private ListCellRenderer defaultRenderer; |
| | | |
| | | /** |
| | | * The separator used to render a non-selectable separator in the combo box. |
| | | */ |
| | | /** The separator used to render a non-selectable separator in the combo box. */ |
| | | protected Component separator; |
| | | |
| | | /** |
| | | * The default font. |
| | | */ |
| | | /** The default font. */ |
| | | protected Font defaultFont; |
| | | |
| | | /** |
| | | * The category font. |
| | | */ |
| | | /** The category font. */ |
| | | protected Font categoryFont; |
| | | |
| | | /** |
| | |
| | | ((JPanel)separator).setBorder(new EmptyBorder(5, 3, 5, 3)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | /** |
| | | * The renderer to be used to render AbstractIndexDescriptor objects in a list. |
| | | * It marks the indexes that require to be rebuilt with a '*' character. |
| | | * |
| | | */ |
| | | public class IndexCellRenderer extends CustomListCellRenderer |
| | | { |
| | |
| | | this.info = info; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | * The renderer to be used to render CategorizedComboBoxElement objects whose |
| | | * values are AbstraceIndexDescriptor objects. It can be used with combo |
| | | * boxes. |
| | | * |
| | | */ |
| | | public class IndexComboBoxCellRenderer extends CustomListCellRenderer |
| | | { |
| | |
| | | * @param desc the combo box element. |
| | | * @return the String value for a given CategorizedComboBoxElement. |
| | | */ |
| | | @Override |
| | | protected String getStringValue(CategorizedComboBoxElement desc) |
| | | { |
| | | String v; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | |
| | | super(combo); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | |
| | | import org.opends.server.types.CommonSchemaElements; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClassType; |
| | | |
| | | /** |
| | | * The cell renderer to be used to render schema elements in a combo box. |
| | | */ |
| | | /** The cell renderer to be used to render schema elements in a combo box. */ |
| | | public class SchemaElementComboBoxCellRenderer extends CustomListCellRenderer |
| | | { |
| | | /** |
| | |
| | | super(list); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | * A table cell renderer that updates the rendering of the cells when the user |
| | | * moves the mouse over the table. This is done to provide a visual hint that |
| | | * the table can be selected. |
| | | * |
| | | */ |
| | | public class SelectableTableCellRenderer extends CustomCellRenderer |
| | | { |
| | |
| | | { |
| | | MouseAdapter mouseListener = new MouseAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mousePressed(MouseEvent ev) |
| | | { |
| | |
| | | table.repaint(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseReleased(MouseEvent ev) |
| | | { |
| | | isBeingPressed = false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseExited(MouseEvent ev) |
| | | { |
| | |
| | | table.repaint(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseEntered(MouseEvent ev) |
| | | { |
| | |
| | | }; |
| | | MouseMotionAdapter mouseMotionAdapter = new MouseMotionAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseMoved(MouseEvent ev) |
| | | { |
| | |
| | | table.repaint(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void mouseDragged(MouseEvent ev) |
| | | { |
| | |
| | | table.addMouseMotionListener(mouseMotionAdapter); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | |
| | | /** |
| | | * Class used to render the task tables. |
| | | */ |
| | | /** Class used to render the task tables. */ |
| | | public class TaskCellRenderer extends DefaultTableCellRenderer |
| | | { |
| | | private static final long serialVersionUID = -84332267021523835L; |
| | | /** |
| | | * The border of the first column. |
| | | * TODO: modify CustomCellRenderer to make this public. |
| | | */ |
| | | /** The border of the first column. TODO: modify CustomCellRenderer to make this public. */ |
| | | protected static final Border column0Border = |
| | | BorderFactory.createCompoundBorder( |
| | | BorderFactory.createMatteBorder(0, 1, 0, 0, |
| | | ColorAndFontConstants.gridColor), |
| | | BorderFactory.createEmptyBorder(4, 4, 4, 4)); |
| | | /** |
| | | * The default border. |
| | | */ |
| | | /** The default border. */ |
| | | public static final Border defaultBorder = CustomCellRenderer.defaultBorder; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public TaskCellRenderer() |
| | | { |
| | | setFont(ColorAndFontConstants.tableFont); |
| | |
| | | setForeground(ColorAndFontConstants.treeForeground); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) { |
| | | super.getTableCellRendererComponent(table, value, isSelected, hasFocus, |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | /** |
| | | * An extension of the DefaultTreeCellRenderer that uses a customized border, |
| | | * foreground and background. |
| | | * |
| | | */ |
| | | public class TreeCellRenderer extends DefaultTreeCellRenderer |
| | | { |
| | | private static final long serialVersionUID = 4045260951231311206L; |
| | | |
| | | /** |
| | | * Background when the cell is not selected. |
| | | */ |
| | | /** Background when the cell is not selected. */ |
| | | public static final Color nonselectionBackground = |
| | | ColorAndFontConstants.background; |
| | | private static final Color nonselectionForeground = |
| | | ColorAndFontConstants.foreground; |
| | | |
| | | /** |
| | | * Background when the cell is selected. |
| | | */ |
| | | /** Background when the cell is selected. */ |
| | | public static final Color selectionBackground = |
| | | ColorAndFontConstants.mouseOverBackground; |
| | | |
| | |
| | | setFont(ColorAndFontConstants.treeFont); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getTreeCellRendererComponent(JTree tree, Object value, |
| | | boolean isSelected, boolean isExpanded, boolean isLeaf, int row, |
| | | boolean hasFocus) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | | |
| | | /** |
| | | * Class used to render elements of the class VLVSortOrder. |
| | | * |
| | | */ |
| | | /** Class used to render elements of the class VLVSortOrder. */ |
| | | public class VLVSortOrderRenderer implements ListCellRenderer |
| | | { |
| | | private ListCellRenderer defaultRenderer; |
| | |
| | | this.defaultRenderer = list.getCellRenderer(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, |
| | | int index, boolean isSelected, boolean cellHasFocus) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | super(new ByteArrayOutputStream(), true); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void println(String msg) |
| | | { |
| | |
| | | logger.info(LocalizableMessage.raw(msg)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void write(byte[] b, int off, int len) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | | import javax.swing.SwingUtilities; |
| | |
| | | } |
| | | |
| | | /** Performs the processing associated with the background task. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | try |
| | |
| | | final T returnValue = backgroundTask.processBackgroundTask(); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | backgroundTask.backgroundTaskCompleted(returnValue, null); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | backgroundTask.backgroundTaskCompleted(null, t); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | import org.opends.admin.ads.util.ApplicationTrustManager; |
| | | |
| | | /** |
| | | * An application trust manager that accepts all the certificates. |
| | | * |
| | | */ |
| | | /** An application trust manager that accepts all the certificates. */ |
| | | public class BlindApplicationTrustManager extends ApplicationTrustManager |
| | | { |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public BlindApplicationTrustManager() |
| | | { |
| | | super(null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | throws CertificateException |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | throws CertificateException |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[0]; |
| | | } |
| | | |
| | | /** |
| | | * Creates a copy of this ApplicationTrustManager. |
| | | * @return a copy of this ApplicationTrustManager. |
| | | */ |
| | | @Override |
| | | public BlindApplicationTrustManager createCopy() |
| | | { |
| | | return new BlindApplicationTrustManager(); |
| | |
| | | */ |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.io.File; |
| | | import java.net.InetAddress; |
| | | import java.util.ArrayList; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.meta.AdministrationConnectorCfgDefn; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | | import org.opends.guitools.controlpanel.task.OfflineUpdateException; |
| | | import org.forgerock.opendj.server.config.meta.AdministrationConnectorCfgDefn; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tools.tasks.TaskEntry; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryEnvironmentConfig; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | /** |
| | | * An abstract class providing some common interface for the class that read |
| | | * the configuration (and if the server is running, the monitoring information). |
| | |
| | | */ |
| | | public static String configFile; |
| | | |
| | | /** |
| | | * The error that occurred when setting the environment (null if no error |
| | | * occurred). |
| | | */ |
| | | /** The error that occurred when setting the environment (null if no error occurred). */ |
| | | protected static OpenDsException environmentSettingException; |
| | | static |
| | | { |
| | |
| | | logger.info(LocalizableMessage.raw("Environment initialized.")); |
| | | } |
| | | |
| | | /** |
| | | * The exceptions that occurred reading the configuration. |
| | | */ |
| | | /** The exceptions that occurred reading the configuration. */ |
| | | protected List<Exception> exceptions = Collections.emptyList(); |
| | | |
| | | /** |
| | | * Whether the configuration has already been read or not. |
| | | */ |
| | | /** Whether the configuration has already been read or not. */ |
| | | protected boolean configRead; |
| | | |
| | | /** |
| | | * The set of connection listeners. |
| | | */ |
| | | /** The set of connection listeners. */ |
| | | protected Set<ConnectionHandlerDescriptor> listeners = Collections.emptySet(); |
| | | |
| | | /** |
| | | * The administration connector. |
| | | */ |
| | | /** The administration connector. */ |
| | | protected ConnectionHandlerDescriptor adminConnector; |
| | | |
| | | /** |
| | | * The set of backend descriptors. |
| | | */ |
| | | /** The set of backend descriptors. */ |
| | | protected Set<BackendDescriptor> backends = Collections.emptySet(); |
| | | |
| | | /** |
| | | * The set of administrative users. |
| | | */ |
| | | /** The set of administrative users. */ |
| | | protected Set<DN> administrativeUsers = Collections.emptySet(); |
| | | |
| | | /** |
| | | * The replication serve port (-1 if the replication server port is not |
| | | * defined). |
| | | */ |
| | | /** The replication serve port (-1 if the replication server port is not defined). */ |
| | | protected int replicationPort = -1; |
| | | |
| | | /** |
| | | * The java version used to run the server. |
| | | */ |
| | | /** The java version used to run the server. */ |
| | | protected String javaVersion; |
| | | |
| | | /** |
| | | * The number of connections opened on the server. |
| | | */ |
| | | /** The number of connections opened on the server. */ |
| | | protected int numberConnections; |
| | | |
| | | /** |
| | | * Whether the schema checking is enabled or not. |
| | | */ |
| | | /** Whether the schema checking is enabled or not. */ |
| | | protected boolean isSchemaEnabled; |
| | | |
| | | /** |
| | | * The schema used by the server. |
| | | */ |
| | | /** The schema used by the server. */ |
| | | protected Schema schema; |
| | | |
| | | /** |
| | | * The task entries. |
| | | **/ |
| | | /** The task entries. */ |
| | | protected Set<TaskEntry> taskEntries = Collections.emptySet(); |
| | | |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | * A class that reads an entry on the background. This is used in the LDAP |
| | | * entries browser. When the entry is read it notifies to the EntryReadListener |
| | | * objects that have been registered. |
| | | * |
| | | */ |
| | | public class LDAPEntryReader extends BackgroundTask<CustomSearchResult> |
| | | { |
| | |
| | | this.notifyListeners = true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public CustomSearchResult processBackgroundTask() throws Throwable |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(CustomSearchResult sr, |
| | | Throwable throwable) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | */ |
| | | public class LowerCaseComparator implements Comparator<String> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(String s1, String s2) |
| | | { |
| | | if (s1 != null && s2 != null) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | import java.io.InputStreamReader; |
| | | import java.io.PrintStream; |
| | | |
| | | /** |
| | | * Class used to write the output and error of a given process in a printstream. |
| | | * |
| | | */ |
| | | /** Class used to write the output and error of a given process in a printstream. */ |
| | | public class ProcessReader |
| | | { |
| | | private BufferedReader reader; |
| | |
| | | |
| | | readerThread = new Thread(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | String line; |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * Starts reading the output (or error) of the process. |
| | | * |
| | | */ |
| | | /** Starts reading the output (or error) of the process. */ |
| | | public void startReading() |
| | | { |
| | | readerThread.start(); |
| | |
| | | /** |
| | | * Interrupts the reading of the output (or error) of the process. The method |
| | | * does not return until the reading is over. |
| | | * |
| | | */ |
| | | public void interrupt() |
| | | { |
| | |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * A static class that provides miscellaneous functions. |
| | | */ |
| | | /** A static class that provides miscellaneous functions. */ |
| | | public class Utilities |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * @param msg the message to be displayed. |
| | | * @return <CODE>true</CODE> if the user accepts the message and |
| | | * <CODE>false</CODE> otherwise. |
| | | * |
| | | */ |
| | | public static boolean displayConfirmationDialog(Component parentComponent, |
| | | LocalizableMessage title, LocalizableMessage msg) |
| | |
| | | * |
| | | * @param comp the component to be centered. |
| | | * @param ref the component to be used as reference. |
| | | * |
| | | */ |
| | | public static void centerGoldenMean(Window comp, Component ref) |
| | | { |
| | |
| | | * @param dn the DN as a String. |
| | | * @return a Name object representing the DN. |
| | | * @throws InvalidNameException if the provided DN value is not valid. |
| | | * |
| | | */ |
| | | public static Name getJNDIName(String dn) throws InvalidNameException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Initialize the configuration framework. |
| | | */ |
| | | /** Initialize the configuration framework. */ |
| | | public static void initializeConfigurationFramework() |
| | | { |
| | | if (!ConfigurationFramework.getInstance().isInitialized()) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | |
| | | /** |
| | | * A class used to be able to update the scroll position in different panels. |
| | | * It basically contains two lists of scrollbars and points. |
| | | * |
| | | */ |
| | | public class ViewPositions |
| | | { |
| | |
| | | points.add(p); |
| | | } |
| | | |
| | | /** |
| | | * Clears the contents of both lists. |
| | | * |
| | | */ |
| | | /** Clears the contents of both lists. */ |
| | | public void clear() |
| | | { |
| | | scrolls.clear(); |
| | |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.uninstaller; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | |
| | | initializeParser(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void launch() { |
| | | // Validate user provided data |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Initialize the contents of the argument parser. |
| | | */ |
| | | /** Initialize the contents of the argument parser. */ |
| | | protected void initializeParser() |
| | | { |
| | | argParser = new UninstallerArgumentParser(getClass().getName(), |
| | |
| | | : ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ArgumentParser getArgumentParser() { |
| | | return this.argParser; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void willLaunchGui() { |
| | | System.out.println(INFO_UNINSTALL_LAUNCHER_LAUNCHING_GUI.get()); |
| | | System.setProperty("org.opends.quicksetup.Application.class", |
| | | org.opends.guitools.uninstaller.Uninstaller.class.getName()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected CliApplication createCliApplication() { |
| | | return new Uninstaller(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getFrameTitle() { |
| | | return Utils.getCustomizedObject("INFO_FRAME_UNINSTALL_TITLE", |
| | | INFO_FRAME_UNINSTALL_TITLE.get(DynamicConstants.PRODUCT_NAME), |
| | | LocalizableMessage.class); |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether or not the launcher should print a usage |
| | | * statement based on the content of the arguments passed into |
| | | * the constructor. |
| | | * @return boolean where true indicates usage should be printed |
| | | */ |
| | | @Override |
| | | protected boolean shouldPrintUsage() { |
| | | return argParser.isUsageArgumentPresent() && |
| | | !argParser.usageOrVersionDisplayed(); |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether or not the launcher should print a usage |
| | | * statement based on the content of the arguments passed into |
| | | * the constructor. |
| | | * @return boolean where true indicates usage should be printed |
| | | */ |
| | | @Override |
| | | protected boolean isQuiet() { |
| | | return argParser.isQuiet(); |
| | | } |
| | |
| | | return !argParser.isInteractive(); |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether or not the launcher should print a version |
| | | * statement based on the content of the arguments passed into |
| | | * the constructor. |
| | | * @return boolean where true indicates version should be printed |
| | | */ |
| | | @Override |
| | | protected boolean shouldPrintVersion() { |
| | | return argParser.isVersionArgumentPresent() && |
| | | !argParser.usageOrVersionDisplayed(); |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the launcher will launch a command line versus |
| | | * a graphical application based on the contents of the arguments |
| | | * passed into the constructor. |
| | | * |
| | | * @return boolean where true indicates that a CLI application |
| | | * should be launched |
| | | */ |
| | | @Override |
| | | protected boolean isCli() { |
| | | return argParser.isCli(); |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.uninstaller; |
| | | |
| | |
| | | /** Installation finished with an error. */ |
| | | FINISHED_WITH_ERROR; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isLast() { |
| | | return this == FINISHED_SUCCESSFULLY || |
| | | this == FINISHED_WITH_ERROR || |
| | |
| | | this == FINISHED_WITH_ERROR_DELETING; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isError() { |
| | | return this.equals(FINISHED_WITH_ERROR); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.uninstaller.ui; |
| | |
| | | * This is the panel displayed when the user is uninstalling Open DS. It is |
| | | * basically a panel with the text informing of the consequences of uninstalling |
| | | * the server and asking for confirmation. |
| | | * |
| | | */ |
| | | public class ConfirmUninstallPanel extends QuickSetupStepPanel |
| | | { |
| | |
| | | * The constructor of this class. |
| | | * @param application Application this panel represents |
| | | * @param installStatus the object describing the current installation status. |
| | | * |
| | | */ |
| | | public ConfirmUninstallPanel(GuiApplication application, |
| | | CurrentInstallStatus installStatus) |
| | |
| | | super(application); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CONFIRM_UNINSTALL_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | |
| | | return isCanceled; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVisible(boolean visible) |
| | | { |
| | |
| | | return p; |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on cancel. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on cancel. */ |
| | | private void cancelClicked() |
| | | { |
| | | isCanceled = true; |
| | |
| | | * The class just reads what is written to the standard error, obtains an |
| | | * formatted representation of it and then notifies the |
| | | * ProgressUpdateListeners with the formatted messages. |
| | | * |
| | | */ |
| | | public class ErrorPrintStream extends ApplicationPrintStream { |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ErrorPrintStream() { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage formatString(String s) { |
| | | return getFormattedLogError(LocalizableMessage.raw(s)); |
| | |
| | | * The class just reads what is written to the standard output, obtains an |
| | | * formatted representation of it and then notifies the |
| | | * ProgressUpdateListeners with the formatted messages. |
| | | * |
| | | */ |
| | | public class OutputPrintStream extends ApplicationPrintStream |
| | | { |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public OutputPrintStream() { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage formatString(String s) { |
| | | return getFormattedLog(LocalizableMessage.raw(s)); |
| | |
| | | */ |
| | | protected abstract LocalizableMessage formatString(String string); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ApplicationPrintStream() |
| | | { |
| | | super(new ByteArrayOutputStream(), true); |
| | | isFirstLine = true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void println(String msg) |
| | | { |
| | |
| | | isFirstLine = false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void write(byte[] b, int off, int len) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Class used to add points periodically to the end of the logs. |
| | | */ |
| | | /** Class used to add points periodically to the end of the logs. */ |
| | | protected class PointAdder implements Runnable |
| | | { |
| | | private Thread t; |
| | | private boolean stopPointAdder; |
| | | private boolean pointAdderStopped; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public PointAdder() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Starts the PointAdder: points are added at the end of the logs |
| | | * periodically. |
| | | */ |
| | | /** Starts the PointAdder: points are added at the end of the logs periodically. */ |
| | | public void start() |
| | | { |
| | | LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); |
| | |
| | | t.start(); |
| | | } |
| | | |
| | | /** |
| | | * Stops the PointAdder: points are no longer added at the end of the logs |
| | | * periodically. |
| | | */ |
| | | /** Stops the PointAdder: points are no longer added at the end of the logs periodically. */ |
| | | public synchronized void stop() |
| | | { |
| | | stopPointAdder = true; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | |
| | | * @param e Exception cause |
| | | * @return ApplicationException with Type property being FILE_SYSTEM_ERROR |
| | | */ |
| | | public static ApplicationException createFileSystemException(LocalizableMessage msg, |
| | | Exception e) |
| | | public static ApplicationException createFileSystemException(LocalizableMessage msg, Exception e) |
| | | { |
| | | return new ApplicationException(ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | msg, e); |
| | | return new ApplicationException(ReturnCode.FILE_SYSTEM_ACCESS_ERROR, msg, e); |
| | | } |
| | | |
| | | /** |
| | |
| | | return type; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return getMessage(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | |
| | |
| | | return values.get(REVISION); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compareTo(BuildInformation bi) { |
| | | if (getMajorVersion().equals(bi.getMajorVersion())) { |
| | |
| | | return 1; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | |
| | | && compareTo((BuildInformation)o) == 0; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() { |
| | | int hc = 11; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | */ |
| | | public enum ButtonName |
| | | { |
| | | /** |
| | | * The Next button. |
| | | */ |
| | | /** The Next button. */ |
| | | NEXT, |
| | | /** |
| | | * The Previous button. |
| | | */ |
| | | /** The Previous button. */ |
| | | PREVIOUS, |
| | | /** |
| | | * The Quit button. |
| | | */ |
| | | /** The Quit button. */ |
| | | QUIT, |
| | | /** |
| | | * The Continue with install button. |
| | | */ |
| | | /** The Continue with install button. */ |
| | | CONTINUE_INSTALL, |
| | | /** |
| | | * The Close button. |
| | | */ |
| | | /** The Close button. */ |
| | | CLOSE, |
| | | /** |
| | | * The Finish button. |
| | | */ |
| | | /** The Finish button. */ |
| | | FINISH, |
| | | /** |
| | | * The Launch Status Panel button. |
| | | */ |
| | | /** The Launch Status Panel button. */ |
| | | LAUNCH_STATUS_PANEL, |
| | | /** |
| | | * Input panel button. This is used to identify generic buttons inside |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.wrapText; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | import com.forgerock.opendj.cli.ConsoleApplication; |
| | | import com.forgerock.opendj.cli.Menu; |
| | | import com.forgerock.opendj.cli.MenuBuilder; |
| | | import com.forgerock.opendj.cli.MenuResult; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | /** |
| | | * Supports user interactions for a command line driven application. |
| | | */ |
| | | /** Supports user interactions for a command line driven application. */ |
| | | public class CliUserInteraction extends ConsoleApplication |
| | | implements UserInteraction { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | isForceOnError = ud != null && ud.isForceOnError(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object confirm(LocalizableMessage summary, LocalizableMessage details, |
| | | LocalizableMessage title, MessageType type, LocalizableMessage[] options, |
| | | LocalizableMessage def) { |
| | | return confirm(summary, details, null, title, type, options, def, null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object confirm(LocalizableMessage summary, LocalizableMessage details, LocalizableMessage fineDetails, |
| | | LocalizableMessage title, MessageType type, LocalizableMessage[] options, |
| | | LocalizableMessage def, LocalizableMessage viewDetailsOption) { |
| | |
| | | return returnValue; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String createUnorderedList(List<?> list) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | if (list != null) { |
| | | for (Object o : list) { |
| | | sb.append(/*bullet=*/"* "); |
| | | sb.append("* "); |
| | | sb.append(o); |
| | | sb.append(Constants.LINE_SEPARATOR); |
| | | } |
| | |
| | | getErrorStream().println(text); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAdvancedMode() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isInteractive() { |
| | | return isInteractive; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMenuDrivenMode() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isQuiet() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isScriptFriendly() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isVerbose() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCLI() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isForceOnError() { |
| | | return isForceOnError; |
| | | } |
| | |
| | | import static org.forgerock.util.Utils.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | /** |
| | | * A class used to describe the java arguments for a given command-line. |
| | | */ |
| | | /** A class used to describe the java arguments for a given command-line. */ |
| | | public class JavaArguments |
| | | { |
| | | private int maxMemory = -1; |
| | |
| | | this.additionalArguments = additionalArguments; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | |
| | | public abstract ArgumentParser getArgumentParser(); |
| | | |
| | | /** |
| | | * Indicates whether or not the launcher should print a usage |
| | | * statement based on the content of the arguments passed into |
| | | * the constructor. |
| | | * Indicates whether the launcher should print a usage statement |
| | | * based on the content of the arguments passed into the constructor. |
| | | * @return boolean where true indicates usage should be printed |
| | | */ |
| | | protected boolean shouldPrintUsage() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether or not the launcher should print a usage |
| | | * statement based on the content of the arguments passed into |
| | | * the constructor. |
| | | * Indicates whether the launcher should print a usage statement |
| | | * based on the content of the arguments passed into the constructor. |
| | | * @return boolean where true indicates usage should be printed |
| | | */ |
| | | protected boolean isQuiet() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether or not the launcher should print a version |
| | | * statement based on the content of the arguments passed into |
| | | * the constructor. |
| | | * Indicates whether the launcher should print a version statement |
| | | * based on the content of the arguments passed into the constructor. |
| | | * @return boolean where true indicates version should be printed |
| | | */ |
| | | protected boolean shouldPrintVersion() { |
| | |
| | | { -1 }; |
| | | Thread t = new Thread(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | try |
| | |
| | | } |
| | | catch (InterruptedException ie) |
| | | { |
| | | /* An error occurred, so the return value will be -1. We got nothing to |
| | | do with this exception. */ |
| | | /* An error occurred, so the return value will be -1. We got nothing to do with this exception. */ |
| | | } |
| | | System.setErr(printStream); |
| | | return returnValue[0]; |
| | |
| | | return returnValue.getReturnCode(); |
| | | } |
| | | |
| | | /** |
| | | * Prints the version statement to standard output terminal. |
| | | */ |
| | | /** Prints the version statement to standard output terminal. */ |
| | | protected void printVersion() |
| | | { |
| | | System.out.print(PRINTABLE_VERSION_STRING); |
| | |
| | | /** Called if launching of the GUI failed. */ |
| | | protected abstract void guiLaunchFailed(); |
| | | |
| | | /** |
| | | * The main method which is called by the command lines. |
| | | */ |
| | | /** The main method which is called by the command lines. */ |
| | | public void launch() { |
| | | if (shouldPrintVersion()) { |
| | | ArgumentParser parser = getArgumentParser(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * Represents information about the license file. NOTE: the license file |
| | |
| | | public class LicenseFile |
| | | { |
| | | private static final String INSTALL_ROOT_SYSTEM_PROPERTY = "INSTALL_ROOT"; |
| | | |
| | | /** |
| | | * The license file name in Legal directory. |
| | | */ |
| | | /** The license file name in Legal directory. */ |
| | | private static final String LICENSE_FILE_NAME = "Forgerock_License.txt"; |
| | | |
| | | /** |
| | | * The Legal folder which contains license file. |
| | | */ |
| | | /** The Legal folder which contains license file. */ |
| | | private static final String LEGAL_FOLDER_NAME = "legal-notices"; |
| | | |
| | | /** |
| | | * The accepted license file name. |
| | | */ |
| | | /** The accepted license file name. */ |
| | | private static final String ACCEPTED_LICENSE_FILE_NAME = "licenseAccepted"; |
| | | |
| | | /** |
| | | * Get the directory in which legal files are stored. |
| | | */ |
| | | /** Get the directory in which legal files are stored. */ |
| | | private static String getInstallDirectory() { |
| | | String installDirName = System.getProperty(INSTALL_ROOT_SYSTEM_PROPERTY); |
| | | if (installDirName == null) |
| | |
| | | return installDirName; |
| | | } |
| | | |
| | | /** |
| | | * Get the directory in which approved legal files are stored. |
| | | */ |
| | | /** Get the directory in which approved legal files are stored. */ |
| | | private static String getInstanceLegalDirectory() |
| | | { |
| | | String instanceLegalDirName = Utils.getInstancePathFromInstallPath(getInstallDirectory()) |
| | |
| | | return instanceLegalDirName; |
| | | } |
| | | |
| | | /** |
| | | * The File object related to the license file. |
| | | */ |
| | | private static File licFile; |
| | | |
| | | /** |
| | | * The license file approval state. |
| | | */ |
| | | /** The File object related to the license file. */ |
| | | private static File licenceFile; |
| | | /** The license file approval state. */ |
| | | private static boolean approved; |
| | | |
| | | /** |
| | | * Returns the license file name. |
| | | */ |
| | | /** Returns the license file name. */ |
| | | private static String getName() |
| | | { |
| | | return getInstallDirectory() + File.separator + LEGAL_FOLDER_NAME + File.separator + LICENSE_FILE_NAME; |
| | | } |
| | | |
| | | /** |
| | | * Returns the license file object. |
| | | */ |
| | | /** Returns the license file object. */ |
| | | private static File getFile() |
| | | { |
| | | if (licFile == null) |
| | | if (licenceFile == null) |
| | | { |
| | | licFile = new File(getName()); |
| | | licenceFile = new File(getName()); |
| | | } |
| | | return licFile; |
| | | return licenceFile; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static String getText() |
| | | { |
| | | InputStream input; |
| | | try |
| | | { |
| | | input = new FileInputStream(getFile()); |
| | | } |
| | | catch (FileNotFoundException e) |
| | | { |
| | | // Should not happen |
| | | return ""; |
| | | } |
| | | |
| | | // Reads the inputstream content. |
| | | final StringBuilder sb = new StringBuilder(); |
| | | try |
| | | try (InputStream input = new FileInputStream(getFile()); |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(input));) |
| | | { |
| | | final BufferedReader br = new BufferedReader(new InputStreamReader(input)); |
| | | String read = br.readLine(); |
| | | |
| | | while (read != null) |
| | | final StringBuilder sb = new StringBuilder(); |
| | | String read; |
| | | while ((read = br.readLine()) != null) |
| | | { |
| | | sb.append(read); |
| | | sb.append(ServerConstants.EOL); |
| | | read = br.readLine(); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | // Should not happen |
| | | return ""; |
| | | } |
| | | StaticUtils.close(input); |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | import org.opends.quicksetup.event.ProgressUpdateEvent; |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | |
| | | /** |
| | | * Class used by Launcher to start a CLI application. |
| | | * |
| | | */ |
| | | /** Class used by Launcher to start a CLI application. */ |
| | | public class QuickSetupCli { |
| | | |
| | | /** Arguments passed in the command line. */ |
| | |
| | | if (!userData.isQuiet()) { |
| | | cliApp.addProgressUpdateListener( |
| | | new ProgressUpdateListener() { |
| | | @Override |
| | | public void progressUpdate(ProgressUpdateEvent ev) { |
| | | LocalizableMessage newLogs = ev.getNewLogs(); |
| | | if (newLogs != null) { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | | |
| | | /** |
| | | * This class defines enumeration of application return code. |
| | | */ |
| | | /** This class defines enumeration of application return code. */ |
| | | public class ReturnCode { |
| | | |
| | | /** |
| | | * Return code: Application successful. |
| | | */ |
| | | /** Return code: Application successful. */ |
| | | public static final ReturnCode SUCCESSFUL = new ReturnCode(0); |
| | | |
| | | /** |
| | | * Return code: User Cancelled operation. |
| | | */ |
| | | /** Return code: User Cancelled operation. */ |
| | | public static final ReturnCode CANCELED = new ReturnCode(0); |
| | | |
| | | /** |
| | | * Return code: User provided invalid data. |
| | | */ |
| | | /** Return code: User provided invalid data. */ |
| | | public static final ReturnCode USER_DATA_ERROR = new ReturnCode(2); |
| | | |
| | | /** |
| | | * Return code: Error accessing file system (reading/writing). |
| | | */ |
| | | /** Return code: Error accessing file system (reading/writing). */ |
| | | public static final ReturnCode FILE_SYSTEM_ACCESS_ERROR = new ReturnCode(3); |
| | | |
| | | /** |
| | | * Error during the configuration of the Directory Server. |
| | | */ |
| | | /** Error during the configuration of the Directory Server. */ |
| | | public static final ReturnCode CONFIGURATION_ERROR = new ReturnCode(5); |
| | | |
| | | /** |
| | | * Error during the import of data (base entry, from LDIF file or |
| | | * automatically generated data). |
| | | */ |
| | | |
| | | public static final ReturnCode IMPORT_ERROR = new ReturnCode(6); |
| | | |
| | | /** |
| | | * Error starting the Open DS server. |
| | | */ |
| | | /** Error starting the Open DS server. */ |
| | | public static final ReturnCode START_ERROR = new ReturnCode(7); |
| | | |
| | | /** |
| | | * Error stopping the Open DS server. |
| | | */ |
| | | /** Error stopping the Open DS server. */ |
| | | public static final ReturnCode STOP_ERROR = new ReturnCode(8); |
| | | |
| | | /** |
| | | * Error enabling the Windows service. |
| | | */ |
| | | /** Error enabling the Windows service. */ |
| | | public static final ReturnCode WINDOWS_SERVICE_ERROR = new ReturnCode(9); |
| | | |
| | | /** |
| | | * Application specific error. |
| | | */ |
| | | /** Application specific error. */ |
| | | public static final ReturnCode APPLICATION_ERROR = new ReturnCode(10); |
| | | |
| | | /** |
| | | * Error invoking an OpenDS tool. |
| | | */ |
| | | /** Error invoking an OpenDS tool. */ |
| | | public static final ReturnCode TOOL_ERROR = new ReturnCode(11); |
| | | |
| | | /** |
| | | * Return code: Bug. |
| | | */ |
| | | /** Return code: Bug. */ |
| | | public static final ReturnCode BUG = new ReturnCode(12); |
| | | |
| | | /** |
| | | * Return code: java version non-compatible. |
| | | */ |
| | | /** Return code: java version non-compatible. */ |
| | | public static final ReturnCode JAVA_VERSION_INCOMPATIBLE = new ReturnCode(13); |
| | | |
| | | /** |
| | | * Return code: user provided invalid input. |
| | | */ |
| | | /** Return code: user provided invalid input. */ |
| | | public static final ReturnCode USER_INPUT_ERROR = new ReturnCode(14); |
| | | |
| | | /** |
| | | * Return code: Print Version. |
| | | */ |
| | | /** Return code: Print Version. */ |
| | | public static final ReturnCode PRINT_VERSION = new ReturnCode(50); |
| | | |
| | | /** |
| | | * Return code for errors that are non-specified. |
| | | */ |
| | | /** Return code for errors that are non-specified. */ |
| | | public static final ReturnCode UNKNOWN = new ReturnCode(100); |
| | | |
| | | |
| | | private int code; |
| | | |
| | | /** |
| | | * Creates a new parametrized instance. |
| | | * Creates a new parameterized instance. |
| | | * |
| | | * @param code to return |
| | | */ |
| | |
| | | public int getReturnCode() { |
| | | return code; |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | |
| | |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | /** |
| | | * Class used to describe the Security Options specified by the user. |
| | | * |
| | | */ |
| | | /** Class used to describe the Security Options specified by the user. */ |
| | | public class SecurityOptions |
| | | { |
| | | private boolean enableSSL; |
| | |
| | | /** Alias of a self-signed certificate using elliptic curve. */ |
| | | public static final String SELF_SIGNED_EC_CERT_ALIAS = SELF_SIGNED_CERT_ALIAS + "-ec"; |
| | | |
| | | /** |
| | | * The different type of security options that we can have. |
| | | */ |
| | | /** The different type of security options that we can have. */ |
| | | public enum CertificateType |
| | | { |
| | | /** |
| | | * No certificate to be used (and so no SSL and no Start TLS). |
| | | */ |
| | | /** No certificate to be used (and so no SSL and no Start TLS). */ |
| | | NO_CERTIFICATE, |
| | | /** |
| | | * Use a newly created Self Signed Certificate. |
| | | */ |
| | | /** Use a newly created Self Signed Certificate. */ |
| | | SELF_SIGNED_CERTIFICATE, |
| | | /** |
| | | * Use an existing JKS key store. |
| | | */ |
| | | /** Use an existing JKS key store. */ |
| | | JKS, |
| | | /** |
| | | * Use an existing JCEKS key store. |
| | | */ |
| | | /** Use an existing JCEKS key store. */ |
| | | JCEKS, |
| | | /** |
| | | * Use an existing PKCS#11 key store. |
| | | */ |
| | | /** Use an existing PKCS#11 key store. */ |
| | | PKCS11, |
| | | /** |
| | | * Use an existing PKCS#12 key store. |
| | | */ |
| | | /** Use an existing PKCS#12 key store. */ |
| | | PKCS12 |
| | | } |
| | | |
| | |
| | | screen.display(args); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void update(Graphics g) |
| | | { |
| | | paint(g); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void paint(Graphics g) |
| | | { |
| | | g.drawImage(image, 0, 0, this); |
| | |
| | | final String[] fArgs = args; |
| | | Thread t = new Thread(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | mainOutsideEventThread(fArgs); |
| | |
| | | { |
| | | SwingUtilities.invokeAndWait(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | setVisible(true); |
| | |
| | | { |
| | | SwingUtilities.invokeAndWait(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | try |
| | |
| | | { |
| | | SwingUtilities.invokeAndWait(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | setVisible(false); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | |
| | |
| | | * @return String message key used to access a message catalog to |
| | | * retrieve this step's display name |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getDisplayMessage() { |
| | | return msg; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isProgressStep() { |
| | | return this == PROGRESS; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isFinishedStep() { |
| | | return this == FINISHED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isLicenseStep() { |
| | | return this == LICENSE; |
| | | } |
| | |
| | | |
| | | private int connectTimeout = CliConstants.DEFAULT_LDAP_CONNECT_TIMEOUT; |
| | | |
| | | /** |
| | | * The script name to be used to get and set the java arguments for the |
| | | * server runtime. |
| | | */ |
| | | /** The script name to be used to get and set the java arguments for the server runtime. */ |
| | | public final static String SERVER_SCRIPT_NAME = "start-ds"; |
| | | /** |
| | | * The script name to be used to get and set the java arguments for the |
| | | * (off-line) import. |
| | | */ |
| | | /** The script name to be used to get and set the java arguments for the (off-line) import. */ |
| | | public final static String IMPORT_SCRIPT_NAME = "import-ldif.offline"; |
| | | |
| | | /** |
| | | * Creates a user data object with default values. |
| | | */ |
| | | /** Creates a user data object with default values. */ |
| | | public UserData() { |
| | | interactive = true; |
| | | startServer = true; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | * be asked to accept it or not. |
| | | * It will be thrown by the class that is in charge of validating the user data |
| | | * (the Application class). |
| | | * |
| | | */ |
| | | public class UserDataCertificateException extends UserDataException |
| | | { |
| | |
| | | private X509Certificate[] chain; |
| | | private String authType; |
| | | private Type type; |
| | | /** |
| | | * The enumeration for the different types of the exception. |
| | | */ |
| | | /** The enumeration for the different types of the exception. */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * The certificate was not trusted. |
| | | */ |
| | | /** The certificate was not trusted. */ |
| | | NOT_TRUSTED, |
| | | /** |
| | | * The certificate's subject DN's value and the host name we tried to |
| | | * connect to do not match. |
| | | */ |
| | | /** The certificate's subject DN's value and the host name we tried to connect to do not match. */ |
| | | HOST_NAME_MISMATCH |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.event; |
| | |
| | | * |
| | | * The class is used generally by adding it as ActionListener of a 'Browse' |
| | | * button. |
| | | * |
| | | */ |
| | | public class BrowseActionListener implements ActionListener |
| | | { |
| | |
| | | |
| | | private BrowseType type; |
| | | |
| | | /** |
| | | * Enumeration used to specify which kind of file browser dialog must be |
| | | * displayed. |
| | | * |
| | | */ |
| | | /** Enumeration used to specify which kind of file browser dialog must be displayed. */ |
| | | public enum BrowseType |
| | | { |
| | | /** |
| | | * The Browser is used to retrieve a directory. |
| | | */ |
| | | /** The Browser is used to retrieve a directory. */ |
| | | LOCATION_DIRECTORY, |
| | | /** |
| | | * The Browser is used to retrieve an LDIF file. |
| | | */ |
| | | /** The Browser is used to retrieve an LDIF file. */ |
| | | OPEN_LDIF_FILE, |
| | | /** |
| | | * The Browser is used to retrieve a .zip file. |
| | | */ |
| | | /** The Browser is used to retrieve a .zip file. */ |
| | | OPEN_ZIP_FILE, |
| | | /** |
| | | * The Browser is used to retrieve a generic file. |
| | | */ |
| | | /** The Browser is used to retrieve a generic file. */ |
| | | GENERIC_FILE |
| | | } |
| | | |
| | |
| | | * dialog. |
| | | * |
| | | * @param e the ActionEvent we receive. |
| | | * |
| | | */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) |
| | | { |
| | | int returnVal; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.event; |
| | |
| | | * just create the object and then we add it as ComponentListener of the object. |
| | | * |
| | | * This is used basically by the QuickSetupDialog dialog. |
| | | * |
| | | */ |
| | | public class MinimumSizeComponentListener implements ComponentListener |
| | | { |
| | |
| | | * @param minWidth the minimum width for the component |
| | | * @param minHeight the minimum height for the component |
| | | */ |
| | | public MinimumSizeComponentListener(Component comp, int minWidth, |
| | | int minHeight) |
| | | public MinimumSizeComponentListener(Component comp, int minWidth, int minHeight) |
| | | { |
| | | this.comp = comp; |
| | | this.minWidth = minWidth + 2; |
| | | // It seems that we must add two points to the minWidth (the border of |
| | | // the frame) |
| | | // It seems that we must add two points to the minWidth (the border of the frame) |
| | | if (comp instanceof Window) |
| | | { |
| | | this.minWidth += 2; |
| | |
| | | |
| | | /** |
| | | * ComponentListener implementation. |
| | | * |
| | | * <p> |
| | | * When the method is called check the size and if it is below the minimum |
| | | * size specified in the constructor, resize it to the minimum size. |
| | | * |
| | | * @param ev the component event. |
| | | */ |
| | | @Override |
| | | public void componentResized(ComponentEvent ev) |
| | | { |
| | | int width = comp.getWidth(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ComponentListener implementation. |
| | | * |
| | | * Empty implementation. |
| | | * @param ev the component event. |
| | | */ |
| | | @Override |
| | | public void componentMoved(ComponentEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** |
| | | * ComponentListener implementation. |
| | | * |
| | | * Empty implementation. |
| | | * @param ev the component event. |
| | | */ |
| | | @Override |
| | | public void componentShown(ComponentEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** |
| | | * ComponentListener implementation. |
| | | * |
| | | * Empty implementation. |
| | | * @param ev the component event. |
| | | */ |
| | | @Override |
| | | public void componentHidden(ComponentEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer; |
| | | |
| | |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Standalone server. |
| | | */ |
| | | /** Standalone server. */ |
| | | STANDALONE, |
| | | /** |
| | | * Replicate Contents and this is the first server in topology.. |
| | | */ |
| | | /** Replicate Contents and this is the first server in topology.. */ |
| | | FIRST_IN_TOPOLOGY, |
| | | /** |
| | | * Replicate Contents of the new Suffix with existing server. |
| | | */ |
| | | /** Replicate Contents of the new Suffix with existing server. */ |
| | | IN_EXISTING_TOPOLOGY |
| | | } |
| | | |
| | |
| | | authenticationData.setPort(4444); |
| | | } |
| | | |
| | | /** |
| | | * Private constructor for the DataReplicationOptions object. |
| | | */ |
| | | /** Private constructor for the DataReplicationOptions object. */ |
| | | private DataReplicationOptions() |
| | | { |
| | | } |
| | |
| | | |
| | | /** Install not started. */ |
| | | NOT_STARTED, |
| | | |
| | | /** Configuring server. */ |
| | | CONFIGURING_SERVER(5), |
| | | |
| | | /** Creating base entry for the suffix. */ |
| | | CREATING_BASE_ENTRY(10), |
| | | |
| | | /** Importing the contents of an LDIF file into the suffix. */ |
| | | IMPORTING_LDIF(20), |
| | | |
| | | /** Importing generated data into the suffix. */ |
| | | IMPORTING_AUTOMATICALLY_GENERATED(20), |
| | | |
| | | /** Configuring replication. */ |
| | | CONFIGURING_REPLICATION(10), |
| | | |
| | | /** Starting Open DS server. */ |
| | | STARTING_SERVER(10), |
| | | |
| | | /** Stopping Open DS server. */ |
| | | STOPPING_SERVER(5), |
| | | |
| | | /** Initialize Replicated Suffixes. */ |
| | | INITIALIZE_REPLICATED_SUFFIXES(25), |
| | | |
| | | /** Configuring ADS. */ |
| | | CONFIGURING_ADS(5), |
| | | |
| | | /** Enabling Windows service. */ |
| | | ENABLING_WINDOWS_SERVICE, |
| | | |
| | | /** |
| | | * User is waiting for current task to finish |
| | | * so that the operation can be canceled. |
| | | */ |
| | | /** User is waiting for current task to finish so that the operation can be canceled. */ |
| | | WAITING_TO_CANCEL, |
| | | |
| | | /** Canceling install. */ |
| | | CANCELING, |
| | | |
| | | /** Installation finished successfully. */ |
| | | FINISHED_SUCCESSFULLY, |
| | | |
| | | /** User canceled installation. */ |
| | | FINISHED_CANCELED, |
| | | |
| | | /** Installation finished with an error. */ |
| | | FINISHED_WITH_ERROR; |
| | | |
| | | /** |
| | | * Contains the relative time that takes for the task to be |
| | | * accomplished. |
| | | * For instance if downloading takes twice the time of |
| | | * extracting, the value for downloading will be the double of the value for |
| | | * extracting. |
| | | * Contains the relative time that takes for the task to be accomplished. |
| | | * <p> |
| | | * For instance if downloading takes twice the time of extracting, |
| | | * the value for downloading will be the double of the value for extracting. |
| | | */ |
| | | private final int relativeDuration; |
| | | |
| | |
| | | try |
| | | { |
| | | File newConfig = fm.copy(installation.getBaseConfigurationFile(), |
| | | installation.getConfigurationDirectory(), /*overwrite=*/ true); |
| | | installation.getConfigurationDirectory(), true); |
| | | fm.rename(newConfig, installation.getCurrentConfigurationFile()); |
| | | } |
| | | catch (ApplicationException ae) |
| | |
| | | final QuickSetupDialog fDlg = dlg; |
| | | errPanel.addButtonActionListener(new ButtonActionListener() |
| | | { |
| | | /** |
| | | * ButtonActionListener implementation. It assumes that we are called in |
| | | * the event thread. |
| | | * |
| | | * @param ev |
| | | * the ButtonEvent we receive. |
| | | */ |
| | | @Override |
| | | public void buttonActionPerformed(ButtonEvent ev) |
| | | { |
| | | // assumes that we are called in the event thread. |
| | | // Simulate a close button event |
| | | fDlg.notifyButtonEvent(ButtonName.QUIT); |
| | | } |
| | |
| | | notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CREATING_ADS.get())); |
| | | } |
| | | localConn = createLocalConnection(); |
| | | // if (isRemoteServer) |
| | | // { |
| | | // /* Create an empty ADS suffix on the local server. */ |
| | | // ADSContext localAdsContext = new ADSContext(localCtx); |
| | | // localAdsContext.createAdministrationSuffix(null); |
| | | // } |
| | | if (!isRemoteServer) |
| | | { |
| | | /* Configure local server to have an ADS */ |
| | |
| | | * Tells whether we must create a suffix that we are not going to replicate |
| | | * with other servers or not. |
| | | * |
| | | * @return <CODE>true</CODE> if we must create a new suffix and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return {@code true} if we must create a new suffix and {@code false} otherwise. |
| | | */ |
| | | protected boolean createNotReplicatedSuffix() |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we must configure replication and |
| | | * <CODE>false</CODE> otherwise. |
| | | * Returns whether we must configure replication. |
| | | * |
| | | * @return <CODE>true</CODE> if we must configure replication and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return {@code true} if we must configure replication and {@code false} otherwise. |
| | | */ |
| | | protected boolean mustConfigureReplication() |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we must create the ADS and <CODE>false</CODE> |
| | | * otherwise. |
| | | * Returns whether we must create the ADS. |
| | | * |
| | | * @return <CODE>true</CODE> if we must create the ADS and <CODE>false</CODE> |
| | | * otherwise. |
| | | * @return {@code true} if we must create the ADS and {@code false} otherwise. |
| | | */ |
| | | protected boolean mustCreateAds() |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we must start the server and |
| | | * <CODE>false</CODE> otherwise. |
| | | * Returns whether we must start the server. |
| | | * |
| | | * @return <CODE>true</CODE> if we must start the server and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return {@code true} if we must start the server and {@code false} otherwise. |
| | | */ |
| | | protected boolean mustStart() |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the start server must be launched in verbose |
| | | * mode and <CODE>false</CODE> otherwise. The verbose flag is not enough |
| | | * because in the case where many entries have been imported, the startup |
| | | * phase can take long. |
| | | * Returns whether the start server must be launched in verbose mode. |
| | | * <p> |
| | | * The verbose flag is not enough because in the case where many entries have been imported, |
| | | * the startup phase can take long. |
| | | * |
| | | * @return <CODE>true</CODE> if the start server must be launched in verbose |
| | | * mode and <CODE>false</CODE> otherwise. |
| | | * @return {@code true} if the start server must be launched in verbose mode and {@code false} otherwise. |
| | | */ |
| | | protected boolean isStartVerbose() |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we must stop the server and <CODE>false</CODE> |
| | | * otherwise. The server might be stopped if the user asked not to start it at |
| | | * the end of the installation and it was started temporarily to update its |
| | | * configuration. |
| | | * Returns whether we must stop the server. |
| | | * <p> |
| | | * The server might be stopped if the user asked not to start it at the end |
| | | * of the installation and it was started temporarily to update its configuration. |
| | | * |
| | | * @return <CODE>true</CODE> if we must stop the server and <CODE>false</CODE> |
| | | * otherwise. |
| | | * @return {@code true} if we must stop the server and {@code false} otherwise. |
| | | */ |
| | | protected boolean mustStop() |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we must initialize suffixes and |
| | | * <CODE>false</CODE> otherwise. |
| | | * Returns whether we must initialize suffixes. |
| | | * |
| | | * @return <CODE>true</CODE> if we must initialize suffixes and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return {@code true} if we must initialize suffixes and {@code false} otherwise. |
| | | */ |
| | | protected boolean mustInitializeSuffixes() |
| | | { |
| | |
| | | return validBaseDn; |
| | | } |
| | | |
| | | /** |
| | | * Update the userData object according to the content of the runtime options |
| | | * panel. |
| | | */ |
| | | /** Update the userData object according to the content of the runtime options panel. */ |
| | | private void updateUserDataForRuntimeOptionsPanel(QuickSetup qs) |
| | | { |
| | | getUserData().setJavaArguments(UserData.SERVER_SCRIPT_NAME, |
| | |
| | | } |
| | | |
| | | /** Class used to be able to cancel long operations. */ |
| | | abstract class InvokeThread extends Thread implements Runnable |
| | | abstract class InvokeThread extends Thread |
| | | { |
| | | protected boolean isOver; |
| | | protected ApplicationException ae; |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the thread is over and <CODE>false</CODE> |
| | | * otherwise. |
| | | * Returns whether the thread is over. |
| | | * |
| | | * @return <CODE>true</CODE> if the thread is over and <CODE>false</CODE> |
| | | * otherwise. |
| | | * @return {@code true} if the thread is over and {@code false} otherwise. |
| | | */ |
| | | public boolean isOver() |
| | | { |
| | |
| | | return ae; |
| | | } |
| | | |
| | | /** Runnable implementation. */ |
| | | @Override |
| | | public abstract void run(); |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * This class is used to provide a data model for the Data Options panel of the |
| | | * installer. |
| | | */ |
| | | /** This class is used to provide a data model for the Data Options panel of the installer. */ |
| | | public class NewSuffixOptions |
| | | { |
| | | /** |
| | |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Create base entry. |
| | | */ |
| | | /** Create base entry. */ |
| | | CREATE_BASE_ENTRY, |
| | | /** |
| | | * Do not add any entry to the suffix. |
| | | */ |
| | | /** Do not add any entry to the suffix. */ |
| | | LEAVE_DATABASE_EMPTY, |
| | | /** |
| | | * Import data from an LDIF file. |
| | | */ |
| | | /** Import data from an LDIF file. */ |
| | | IMPORT_FROM_LDIF_FILE, |
| | | /** |
| | | * Generate data and import it to the suffix. |
| | | */ |
| | | /** Generate data and import it to the suffix. */ |
| | | IMPORT_AUTOMATICALLY_GENERATED_DATA |
| | | } |
| | | |
| | |
| | | addActionListeners(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | | Object value = null; |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void displayFieldInvalid(FieldName fieldName, boolean invalid) |
| | | { |
| | | JLabel label = getLabel(fieldName); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = new JPanel(new GridBagLayout()); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return INFO_DATA_REPLICATION_OPTIONS_PANEL_INSTRUCTIONS.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_DATA_REPLICATION_OPTIONS_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTextForIcon(UIFactory.IconType iconType) |
| | | { |
| | | if (iconType == UIFactory.IconType.WAIT && |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * Creates the components and populates the Maps with them. |
| | | */ |
| | | /** Creates the components and populates the Maps with them. */ |
| | | private void populateComponentMaps() |
| | | { |
| | | HashMap<FieldName, LabelFieldDescriptor> hm = new HashMap<>(); |
| | |
| | | checkEnablingState(); |
| | | } |
| | | |
| | | /** |
| | | * Adds all the required document listeners to the fields. |
| | | */ |
| | | /** Adds all the required document listeners to the fields. */ |
| | | private void addDocumentListeners() |
| | | { |
| | | FieldName[] fields = { |
| | |
| | | for (FieldName field : fields) { |
| | | JTextComponent tf = getField(field); |
| | | tf.getDocument().addDocumentListener(new DocumentListener() { |
| | | @Override |
| | | public void changedUpdate(DocumentEvent ev) { |
| | | if (!rbReplicated.isSelected()) { |
| | | rbReplicated.setSelected(true); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void insertUpdate(DocumentEvent ev) { |
| | | changedUpdate(ev); |
| | | } |
| | | |
| | | @Override |
| | | public void removeUpdate(DocumentEvent ev) { |
| | | changedUpdate(ev); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | /** Adds the required focus listeners to the fields. */ |
| | | private void addFocusListeners() |
| | | { |
| | | final FocusListener l = new FocusListener() |
| | | { |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | lastFocusComponent = rbStandalone; |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | /** Adds the required focus listeners to the fields. */ |
| | | private void addActionListeners() |
| | | { |
| | | final ActionListener l = new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | checkEnablingState(); |
| | |
| | | cbTopologyExists.addActionListener(l); |
| | | cbTopologyExists.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | if (cbTopologyExists.isSelected()) |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * Enables/disables the fields. |
| | | */ |
| | | /** Enables/disables the fields. */ |
| | | private void checkEnablingState() |
| | | { |
| | | boolean enableFields = rbReplicated.isSelected() && |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | |
| | | import org.opends.quicksetup.ui.QuickSetupStepPanel; |
| | | import org.opends.quicksetup.ui.UIFactory; |
| | | |
| | | /** |
| | | * This class is used to set the global administrator parameters. |
| | | */ |
| | | /** This class is used to set the global administrator parameters. */ |
| | | public class GlobalAdministratorPanel extends QuickSetupStepPanel |
| | | { |
| | | private static final long serialVersionUID = 4266485298770553875L; |
| | |
| | | addFocusListeners(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | | Object value = null; |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void displayFieldInvalid(FieldName fieldName, boolean invalid) |
| | | { |
| | | JLabel label = getLabel(fieldName); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = new JPanel(new GridBagLayout()); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return INFO_GLOBAL_ADMINISTRATOR_PANEL_INSTRUCTIONS.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_GLOBAL_ADMINISTRATOR_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Creates the components and populates the Maps with them. |
| | | */ |
| | | /** Creates the components and populates the Maps with them. */ |
| | | private void populateLabelAndFieldMaps() |
| | | { |
| | | HashMap<FieldName, LabelFieldDescriptor> hm = new HashMap<>(); |
| | |
| | | return hmFields.get(fieldName); |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | /** Adds the required focus listeners to the fields. */ |
| | | private void addFocusListeners() |
| | | { |
| | | final FocusListener l = new FocusListener() |
| | | { |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | | } |
| | | |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | |
| | | import org.opends.quicksetup.LicenseFile; |
| | | import org.opends.quicksetup.ButtonName; |
| | | |
| | | /** |
| | | * This panel is used to show a welcome message. |
| | | * |
| | | */ |
| | | /** This panel is used to show a welcome message. */ |
| | | public class InstallLicensePanel extends QuickSetupStepPanel |
| | | { |
| | | private static final long serialVersionUID = 6209217138897900860L; |
| | |
| | | super(app); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_LICENSE_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return null; |
| | |
| | | |
| | | private JCheckBox acceptCheck; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | // No input in this panel |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Adds the required action listeners to the fields. |
| | | */ |
| | | /** Adds the required action listeners to the fields. */ |
| | | private void addActionListeners() |
| | | { |
| | | final ActionListener l = new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) |
| | | { |
| | | // Enable or disable Next button as user clicks approval button |
| | |
| | | import java.util.Map; |
| | | import java.util.TreeSet; |
| | | |
| | | /** |
| | | * This is the panel that contains the Review Panel. |
| | | * |
| | | */ |
| | | /** This is the panel that contains the Review Panel. */ |
| | | public class InstallReviewPanel extends ReviewPanel { |
| | | |
| | | private static final long serialVersionUID = -7356174829193265699L; |
| | |
| | | populateLabelAndFieldsMap(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void beginDisplay(UserData userData) |
| | | { |
| | |
| | | return instructionsPanel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return INFO_REVIEW_PANEL_INSTRUCTIONS.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | |
| | | return equivalentCommandPane; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected JComponent getBottomComponent() |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | |
| | | import org.opends.quicksetup.ui.QuickSetupStepPanel; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | /** |
| | | * This panel is used to show a welcome message. |
| | | */ |
| | | /** This panel is used to show a welcome message. */ |
| | | public class InstallWelcomePanel extends QuickSetupStepPanel |
| | | { |
| | | private static final long serialVersionUID = 6209217138897900860L; |
| | |
| | | super(app); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_WELCOME_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | /* |
| | |
| | | LocalizableMessage.class); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | // No input in this panel |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | okClicked(); |
| | |
| | | buttonsPanel.add(cancelButton, gbc); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | cancelClicked(); |
| | |
| | | return buttonsPanel; |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on cancel. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on cancel. */ |
| | | private void cancelClicked() |
| | | { |
| | | isCanceled = true; |
| | | dispose(); |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on OK. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on OK. */ |
| | | private void okClicked() |
| | | { |
| | | BackgroundTask<ArrayList<LocalizableMessage>> worker = |
| | |
| | | toFront(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the widgets on the dialog with the contents of the securityOptions |
| | | * object. |
| | | * |
| | | */ |
| | | /** Updates the widgets on the dialog with the contents of the securityOptions object. */ |
| | | private void updateContents() |
| | | { |
| | | if (javaArguments.getInitialMemory() > 0) |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | UIFactory.setTextStyle(comp, |
| | |
| | | super(application); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | | Object value = null; |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void displayFieldInvalid(FieldName fieldName, boolean invalid) |
| | | { |
| | | if (fieldName == FieldName.REMOTE_REPLICATION_PORT) |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(ServerDescriptor desc1, ServerDescriptor desc2) |
| | | { |
| | | return desc1.getHostPort(true).toString().compareTo(desc2.getHostPort(true).toString()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = new JPanel(new GridBagLayout()); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return INFO_REMOTE_REPLICATION_PORT_INSTRUCTIONS.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_REMOTE_REPLICATION_PORT_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void beginDisplay(UserData data) |
| | | { |
| | | TreeSet<ServerDescriptor> array = orderServers( |
| | |
| | | // Adds the required focus listeners to the fields. |
| | | final FocusListener l = new FocusListener() |
| | | { |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | | } |
| | | |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | |
| | | import org.opends.quicksetup.ui.UIFactory; |
| | | import org.opends.quicksetup.util.HtmlProgressMessageFormatter; |
| | | |
| | | /** |
| | | * The panel where the user specifies the runtime settings. |
| | | * |
| | | */ |
| | | /** The panel where the user specifies the runtime settings. */ |
| | | public class RuntimeOptionsPanel extends QuickSetupStepPanel |
| | | { |
| | | private static final long serialVersionUID = -8303034619200476754L; |
| | |
| | | addFocusListeners(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = new JPanel(new GridBagLayout()); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return INFO_JAVA_RUNTIME_OPTIONS_PANEL_INSTRUCTIONS.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_JAVA_RUNTIME_OPTIONS_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void beginDisplay(UserData uData) |
| | | { |
| | |
| | | updateWarningMessage(uData); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | /** Adds the required focus listeners to the fields. */ |
| | | private void addFocusListeners() |
| | | { |
| | | FocusListener l = new FocusListener() |
| | | { |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | | } |
| | | |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | INFO_JAVA_RUNTIME_CHANGE_SERVER_TOOLTIP.get()); |
| | | bServer.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | changeServerClicked(); |
| | |
| | | INFO_JAVA_RUNTIME_CHANGE_IMPORT_TOOLTIP.get()); |
| | | bImport.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | changeImportClicked(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | | import java.awt.Component; |
| | |
| | | |
| | | ActionListener l = new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | updateEnablingState(); |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | okClicked(); |
| | |
| | | buttonsPanel.add(cancelButton, gbc); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | cancelClicked(); |
| | |
| | | return buttonsPanel; |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on cancel. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on cancel. */ |
| | | private void cancelClicked() |
| | | { |
| | | isCanceled = true; |
| | | dispose(); |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on OK. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on OK. */ |
| | | private void okClicked() |
| | | { |
| | | BackgroundTask<ArrayList<LocalizableMessage>> worker = |
| | |
| | | toFront(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the widgets on the dialog with the contents of the securityOptions |
| | | * object. |
| | | * |
| | | */ |
| | | /** Updates the widgets on the dialog with the contents of the securityOptions object. */ |
| | | private void updateContents() |
| | | { |
| | | cbEnableSSL.setSelected(securityOptions.getEnableSSL()); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | UIFactory.setTextStyle(comp, |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | |
| | | addWindowListener(new WindowAdapter() |
| | | { |
| | | @Override |
| | | public void windowClosing(WindowEvent e) |
| | | { |
| | | cancelClicked(); |
| | |
| | | INFO_SELECT_ALIAS_OK_BUTTON_TOOLTIP.get()); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | okClicked(); |
| | |
| | | p2.add(cancelButton, gbc); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | cancelClicked(); |
| | |
| | | return p; |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on cancel. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on cancel. */ |
| | | private void cancelClicked() |
| | | { |
| | | isCanceled = true; |
| | | dispose(); |
| | | } |
| | | |
| | | /** |
| | | * Method called when user clicks on OK. |
| | | * |
| | | */ |
| | | /** Method called when user clicks on OK. */ |
| | | private void okClicked() |
| | | { |
| | | isCanceled = false; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | |
| | | /** |
| | | * This is the panel that contains the Server Settings: the port, the Directory |
| | | * Manager DN, etc. |
| | | * |
| | | */ |
| | | public class ServerSettingsPanel extends QuickSetupStepPanel |
| | | { |
| | |
| | | addFocusListeners(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | | Object value = null; |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void displayFieldInvalid(FieldName fieldName, boolean invalid) |
| | | { |
| | | JLabel label = getLabel(fieldName); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = new JPanel(new GridBagLayout()); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return INFO_SERVER_SETTINGS_PANEL_INSTRUCTIONS.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_SERVER_SETTINGS_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Creates the components and populates the Maps with them. |
| | | */ |
| | | /** Creates the components and populates the Maps with them. */ |
| | | private void populateLabelAndFieldMaps() |
| | | { |
| | | HashMap<FieldName, LabelFieldDescriptor> hm = new HashMap<>(); |
| | |
| | | |
| | | secureAccessButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | getConfigureSecureAccessDialog().display(securityOptions); |
| | |
| | | return hmFields.get(fieldName); |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | /** Adds the required focus listeners to the fields. */ |
| | | private void addFocusListeners() |
| | | { |
| | | final FocusListener l = new FocusListener() |
| | | { |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | | } |
| | | |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | |
| | | * This class contains the buttons in the bottom of the Install/Uninstall |
| | | * dialog. There is only one of this instances for the QuickSetupDialog. |
| | | * The layout is updated calling setCurrentStep method. |
| | | * |
| | | */ |
| | | public class ButtonsPanel extends QuickSetupPanel |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Do the layout of the panel. |
| | | * |
| | | */ |
| | | /** Do the layout of the panel. */ |
| | | private void layoutButtons() |
| | | { |
| | | setLayout(new GridBagLayout()); |
| | |
| | | |
| | | ActionListener actionListener = new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | ButtonEvent be = new ButtonEvent(ev.getSource(), fButtonName); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | * There is only one instance of this class for a given QuickSetupDialog (and |
| | | * there are only 1 instance of each of the panels that are contained in its |
| | | * CardLayout). |
| | | * |
| | | */ |
| | | public class CurrentStepPanel extends QuickSetupPanel |
| | | { |
| | |
| | | // taske a while to initialize. |
| | | cl.show(this, LOADING_PANEL); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | getPanel(step).beginDisplay(userData); |
| | | SwingUtilities.invokeLater(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | cl.show(CurrentStepPanel.this, step.toString()); |
| | | getPanel(step).endDisplay(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | import javax.swing.text.html.FormView; |
| | | import javax.swing.text.html.HTMLEditorKit; |
| | | |
| | | /** |
| | | * Class used to be able to detect events in the button inside an HTML pane. |
| | | */ |
| | | /** Class used to be able to detect events in the button inside an HTML pane. */ |
| | | public class CustomHTMLEditorKit extends HTMLEditorKit |
| | | { |
| | | private HashSet<ActionListener> listeners = new HashSet<>(); |
| | | private static final long serialVersionUID = 298103926252426388L; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public CustomHTMLEditorKit() |
| | | { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ViewFactory getViewFactory() |
| | | { |
| | | return new MyHTMLFactory(); |
| | |
| | | listeners.remove(l); |
| | | } |
| | | |
| | | /** |
| | | * Class used to be able to detect events in the button inside an HTML pane. |
| | | */ |
| | | /** Class used to be able to detect events in the button inside an HTML pane. */ |
| | | class MyHTMLFactory extends HTMLFactory |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public View create(Element elem) |
| | | { |
| | | View v = super.create(elem); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Class used to be able to detect events in the button inside an HTML pane. |
| | | */ |
| | | /** Class used to be able to detect events in the button inside an HTML pane. */ |
| | | class MyFormView extends FormView |
| | | { |
| | | /** |
| | |
| | | super(elem); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | if (ev != null && ev.getWhen() != lastActionWhen) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createComponent() |
| | | { |
| | | Component comp = super.createComponent(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | | |
| | | /** |
| | | * This is an enumeration used to identify the different fields that we have |
| | | * in the Installation wizard. |
| | | * |
| | | * <p> |
| | | * Note that each field is not necessarily associated |
| | | * with a single Swing component (for instance we have two text fields for |
| | | * the server location). This enumeration is used to retrieve information from |
| | | * the panels without having any knowledge of the actual graphical layout. |
| | | * |
| | | */ |
| | | public enum FieldName |
| | | { |
| | | /** The value associated with this is a String. */ |
| | | ADMIN_CONNECTOR_PORT, |
| | | |
| | | /** The value associated with this is a data options.Type. */ |
| | | DATA_OPTIONS, |
| | | |
| | | /** The value associated with this is a String. **/ |
| | | /** The value associated with this is a String. */ |
| | | BACKEND_TYPE, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | DIRECTORY_BASE_DN, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | DIRECTORY_MANAGER_DN, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | DIRECTORY_MANAGER_PWD, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | DIRECTORY_MANAGER_PWD_CONFIRM, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | ENABLE_WINDOWS_SERVICE, |
| | | |
| | | /** The value associated with this is a Set of String. */ |
| | | EXTERNAL_DB_DIRECTORIES, |
| | | |
| | | /** The value associated with this is a Set of String. */ |
| | | EXTERNAL_LOG_FILES, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | GLOBAL_ADMINISTRATOR_PWD, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | GLOBAL_ADMINISTRATOR_PWD_CONFIRM, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | GLOBAL_ADMINISTRATOR_UID, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | HOST_NAME, |
| | | |
| | | /** The value associated with this is a JavaArguments object. */ |
| | | IMPORT_JAVA_ARGUMENTS, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | LDIF_PATH, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | NUMBER_ENTRIES, |
| | | |
| | | /** The value associated with this is a Map<String, String>. */ |
| | | REMOTE_REPLICATION_PORT, |
| | | |
| | | /** The value associated with this is a Map<String, Boolean>. */ |
| | | REMOTE_REPLICATION_SECURE, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | REMOTE_SERVER_DN, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | REMOTE_SERVER_HOST, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | REMOTE_SERVER_PORT, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | REMOTE_SERVER_PWD, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REMOVE_BACKUPS, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REMOVE_CONFIGURATION_AND_SCHEMA, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REMOVE_DATABASES, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REMOVE_LDIFS, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REMOVE_LIBRARIES_AND_TOOLS, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REMOVE_LOGS, |
| | | |
| | | /** The value associated with this is a DataReplicationOptions.Type. */ |
| | | REPLICATION_OPTIONS, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | REPLICATION_PORT, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | REPLICATION_SECURE, |
| | | |
| | | /** The value associated with this is a SecurityOptions object. */ |
| | | SECURITY_OPTIONS, |
| | | |
| | | /** The value associated with this is a JavaArguments object. */ |
| | | SERVER_JAVA_ARGUMENTS, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | SERVER_LOCATION, |
| | | |
| | | /** The value associated with this is a String. */ |
| | | SERVER_PORT, |
| | | |
| | | /** The value associated with this is a Boolean. */ |
| | | SERVER_START_INSTALLER, |
| | | |
| | | /** The value associated with this is a Set of SuffixDescriptor. */ |
| | | SUFFIXES_TO_REPLICATE, |
| | | |
| | | /** The value associated with this is a Map with String keys and BackendTypeUIAdapter values. */ |
| | | SUFFIXES_TO_REPLICATE_BACKEND_TYPE, |
| | | |
| | | /** The value associated with this is a SuffixesToReplicateOptions.Type. */ |
| | | SUFFIXES_TO_REPLICATE_OPTIONS |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | /** |
| | | * This panel is used to show the application is finished. |
| | | */ |
| | | /** This panel is used to show the application is finished. */ |
| | | public class FinishedPanel extends ProgressPanel |
| | | { |
| | | private static final long serialVersionUID = 8129325068133356170L; |
| | |
| | | super(application); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_FINISHED_PANEL_TITLE.get(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | | |
| | | import java.awt.AlphaComposite; |
| | |
| | | * This class is the panel that is displayed in the QuickSetupDialog. It |
| | | * contains 3 panels that are passed in the constructor: the steps panel, |
| | | * the buttons panel and the current step panel (the main panel of the three). |
| | | * |
| | | * <p> |
| | | * The only remarkable thing of this class is that is responsible for |
| | | * implementing the background. The three subpanels are transparent and |
| | | * this class sets a background (with the Open DS logo) and uses some basic |
| | | * this class sets a background (with the OpenDJ logo) and uses some basic |
| | | * transparency effects. |
| | | * |
| | | */ |
| | | public class FramePanel extends JPanel |
| | | { |
| | | private static final long serialVersionUID = 7733658951410876078L; |
| | | |
| | | private Icon backgroundIcon; |
| | | |
| | | private Component stepsPanel; |
| | | |
| | | private Component buttonsPanel; |
| | | |
| | | private int buttonsPanelVerticalInsets; |
| | | |
| | | private int stepsPanelHorizontalInsets; |
| | | |
| | | /** |
| | | * The constructor of the FramePanel. |
| | | * @param stepsPanel the steps panel that on the top-left side of the |
| | |
| | | * {@inheritDoc} |
| | | * |
| | | * This method has been overwritten to be able to have a transparency effect |
| | | * with the OpenDS logo background. |
| | | * with the OpenDJ logo background. |
| | | */ |
| | | @Override |
| | | protected void paintComponent(Graphics g) |
| | | { |
| | | // paint background |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | /** |
| | | * This enum contains the different type of labels that can be associated with |
| | | * this LabelFieldDescriptor. |
| | | * |
| | | */ |
| | | public enum LabelType |
| | | { |
| | | /** |
| | | * Primary label. |
| | | */ |
| | | /** Primary label. */ |
| | | PRIMARY, |
| | | /** |
| | | * Secondary label. |
| | | */ |
| | | /** Secondary label. */ |
| | | SECONDARY |
| | | } |
| | | |
| | | /** |
| | | * This enum contains the different type of fields that can be associated with |
| | | * this LabelFieldDescriptor. |
| | | * |
| | | */ |
| | | public enum FieldType |
| | | { |
| | | /** |
| | | * Editable text field. |
| | | */ |
| | | /** Editable text field. */ |
| | | TEXTFIELD, |
| | | /** |
| | | * Password field. |
| | | */ |
| | | /** Password field. */ |
| | | PASSWORD, |
| | | /** |
| | | * Read only field. |
| | | */ |
| | | /** Read only field. */ |
| | | READ_ONLY |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | import org.opends.quicksetup.util.HtmlProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.ProgressMessageFormatter; |
| | | |
| | | /** |
| | | * This panel is used to show the progress of the start/stop/restart operations. |
| | | * |
| | | */ |
| | | /** This panel is used to show the progress of the start/stop/restart operations. */ |
| | | public class ProgressDialog extends JDialog |
| | | { |
| | | private static final long serialVersionUID = 8635080171100378470L; |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** |
| | | * Prepares size for this dialog. |
| | | * |
| | | */ |
| | | /** Prepares size for this dialog. */ |
| | | @Override |
| | | public void pack() |
| | | { |
| | | /* |
| | | * TODO: find a way to calculate this dynamically. |
| | | */ |
| | | /* TODO: find a way to calculate this dynamically. */ |
| | | setPreferredSize(new Dimension(500, 300)); |
| | | addComponentListener(new MinimumSizeComponentListener(this, 500, 300)); |
| | | super.pack(); |
| | |
| | | return formatter; |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the dialog panel. |
| | | * |
| | | */ |
| | | /** Creates the layout of the dialog panel. */ |
| | | private void createLayout() |
| | | { |
| | | /* Create title panel */ |
| | |
| | | UIFactory.CURRENT_STEP_PANEL_BACKGROUND); |
| | | detailsTextArea.addHyperlinkListener(new HyperlinkListener() |
| | | { |
| | | @Override |
| | | public void hyperlinkUpdate(HyperlinkEvent e) |
| | | { |
| | | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) |
| | |
| | | buttonsPanel.add(closeButton, gbc); |
| | | closeButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | dispose(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | /** |
| | | * This panel is used to show the progress of the application. |
| | | * |
| | | */ |
| | | /** This panel is used to show the progress of the application. */ |
| | | public class ProgressPanel extends QuickSetupStepPanel |
| | | { |
| | | private static final long serialVersionUID = 8129425068163357170L; |
| | |
| | | super(application); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = new JPanel(new GridBagLayout()); |
| | |
| | | CustomHTMLEditorKit htmlEditor = new CustomHTMLEditorKit(); |
| | | htmlEditor.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | // Assume is the authentication button. |
| | |
| | | UIFactory.CURRENT_STEP_PANEL_BACKGROUND); |
| | | detailsTextArea.addHyperlinkListener(new HyperlinkListener() |
| | | { |
| | | @Override |
| | | public void hyperlinkUpdate(HyperlinkEvent e) |
| | | { |
| | | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getInstructions() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getTitle() |
| | | { |
| | | return INFO_PROGRESS_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void displayProgress(ProgressDescriptor descriptor) |
| | | { |
| | | ProgressStep status = descriptor.getProgressStep(); |
| | |
| | | INFO_CANCEL_BUTTON_LABEL.get(), |
| | | INFO_CANCEL_BUTTON_TOOLTIP.get()); |
| | | btnCancel.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | GuiApplication app = getApplication(); |
| | | QuickSetup qs = getQuickSetup(); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | /** Adds the required focus listeners to the fields. */ |
| | | private void addFocusListeners() |
| | | { |
| | | final FocusListener l = new FocusListener() |
| | | { |
| | | @Override |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | | } |
| | | |
| | | @Override |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | |
| | | setCurrentStep(application.getFirstWizardStep()); |
| | | } |
| | | |
| | | /** |
| | | * This method displays the setup dialog. |
| | | * This method must be called from the event thread. |
| | | */ |
| | | /** This method displays the setup dialog. This method must be called from the event thread. */ |
| | | public void display() |
| | | { |
| | | getDialog().packAndShow(); |
| | |
| | | * @param ev |
| | | * the ButtonEvent we receive. |
| | | */ |
| | | @Override |
| | | public void buttonActionPerformed(ButtonEvent ev) |
| | | { |
| | | switch (ev.getButtonName()) |
| | |
| | | * the ProgressUpdateEvent we receive. |
| | | * @see #runDisplayUpdater() |
| | | */ |
| | | @Override |
| | | public void progressUpdate(ProgressUpdateEvent ev) |
| | | { |
| | | synchronized (this) |
| | |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (application.isFinished() && !getCurrentStep().isFinishedStep()) |
| | |
| | | { |
| | | BackgroundTask<?> worker = new BackgroundTask<Object>() |
| | | { |
| | | @Override |
| | | public Object processBackgroundTask() throws UserDataException |
| | | { |
| | | try |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void backgroundTaskCompleted(Object returnValue, Throwable throwable) |
| | | { |
| | | getDialog().workerFinished(); |
| | |
| | | { |
| | | BackgroundTask<Object> worker = new BackgroundTask<Object>() |
| | | { |
| | | @Override |
| | | public Object processBackgroundTask() throws UserDataException |
| | | { |
| | | try |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void backgroundTaskCompleted(Object returnValue, Throwable throwable) |
| | | { |
| | | getDialog().getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
| | |
| | | new Thread(application, "Application Thread").start(); |
| | | Thread t = new Thread(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | runDisplayUpdater(); |
| | |
| | | return new ProgressDescriptor(status, ratio, newProgressLabel, LocalizableMessage.raw(progressDetails.toString())); |
| | | } |
| | | |
| | | /** |
| | | * This is a class used when the user clicks on next and that extends |
| | | * BackgroundTask. |
| | | */ |
| | | /** This is a class used when the user clicks on next and that extends BackgroundTask. */ |
| | | private class NextClickedBackgroundTask extends BackgroundTask<Object> |
| | | { |
| | | private WizardStep cStep; |
| | |
| | | this.cStep = cStep; |
| | | } |
| | | |
| | | @Override |
| | | public Object processBackgroundTask() throws UserDataException |
| | | { |
| | | try |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void backgroundTaskCompleted(Object returnValue, Throwable throwable) |
| | | { |
| | | getDialog().workerFinished(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | * |
| | | * If we are installing Open DS and the server has already been installed it |
| | | * will display an error message. In the other cases it will display a wizard. |
| | | * |
| | | */ |
| | | public class QuickSetupDialog |
| | | { |
| | |
| | | frame = new JFrame(String.valueOf(application.getFrameTitle())); |
| | | frame.getContentPane().add(getFramePanel()); |
| | | frame.addWindowListener(new WindowAdapter() { |
| | | @Override |
| | | public void windowClosing(WindowEvent e) { |
| | | application.windowClosing(QuickSetupDialog.this, e); |
| | | } |
| | |
| | | Utilities.setFrameIcon(frame); |
| | | } |
| | | |
| | | /** |
| | | * Packs and displays this dialog. |
| | | * |
| | | */ |
| | | /** Packs and displays this dialog. */ |
| | | public void packAndShow() |
| | | { |
| | | frame.pack(); |
| | |
| | | * |
| | | * This method can be called from the event thread or outside the event |
| | | * thread. |
| | | * |
| | | */ |
| | | public void workerStarted() |
| | | { |
| | | Runnable r = new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | displayWorkingProgressImage(true); |
| | |
| | | * |
| | | * This method can be called from the event thread or outside the event |
| | | * thread. |
| | | * |
| | | */ |
| | | public void workerFinished() |
| | | { |
| | | Runnable r = new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | displayWorkingProgressImage(false); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | * This class is a panel that contains an error message and a quit button. |
| | | * It is used for instance when we try to install Open DS but it is already |
| | | * installed. |
| | | * |
| | | */ |
| | | public class QuickSetupErrorPanel extends QuickSetupPanel |
| | | { |
| | |
| | | |
| | | ActionListener quitListener = new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | ButtonEvent be = new ButtonEvent(ev.getSource(), fQuitButtonName); |
| | |
| | | |
| | | ActionListener continueListener = new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | ButtonEvent be = new ButtonEvent(ev.getSource(), fContinueButtonName); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | |
| | | import org.opends.quicksetup.UserData; |
| | | |
| | | /** |
| | | * This class is an abstract class that provides some commodity methods. |
| | | * |
| | | */ |
| | | /** This class is an abstract class that provides some commodity methods. */ |
| | | abstract class QuickSetupPanel extends JPanel |
| | | { |
| | | private static final long serialVersionUID = 2096518919339628055L; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | |
| | | * the CardLayout of CurrentStepPanel. All the panels that appear on the |
| | | * top-right side of the dialog extend this class: WelcomePane, ReviewPanel, |
| | | * etc. |
| | | * |
| | | */ |
| | | public abstract class QuickSetupStepPanel extends QuickSetupPanel |
| | | implements HyperlinkListener |
| | |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Called just after the panel is shown: used to set focus properly. |
| | | */ |
| | | /** Called just after the panel is shown: used to set focus properly. */ |
| | | public void endDisplay() |
| | | { |
| | | } |
| | |
| | | * |
| | | * @param e the HyperlinkEvent. |
| | | */ |
| | | @Override |
| | | public void hyperlinkUpdate(HyperlinkEvent e) |
| | | { |
| | | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) |
| | |
| | | String url = e.getURL().toString(); |
| | | if (!isURLWorkerRunning(url)) |
| | | { |
| | | /* |
| | | * Only launch the worker if there is not already a worker trying to |
| | | * display this URL. |
| | | */ |
| | | /* Only launch the worker if there is not already a worker trying to display this URL. */ |
| | | URLWorker worker = new URLWorker(this, url); |
| | | startWorker(worker); |
| | | } |
| | |
| | | l.buttonActionPerformed(ev); |
| | | } |
| | | } |
| | | /** |
| | | * Creates the layout of the panel. |
| | | * |
| | | */ |
| | | /** Creates the layout of the panel. */ |
| | | protected void createLayout() |
| | | { |
| | | setLayout(new GridBagLayout()); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | |
| | | */ |
| | | protected abstract JPanel createFieldsPanel(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected Component createInputPanel() |
| | | { |
| | | JPanel panel = UIFactory.makeJPanel(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.ui; |
| | | |
| | |
| | | |
| | | /** Specifies the horizontal insets between buttons. */ |
| | | public static final int HORIZONTAL_INSET_BETWEEN_BUTTONS = 5; |
| | | |
| | | /** Specifies the top inset for the steps. */ |
| | | public static final int TOP_INSET_STEP = 15; |
| | | |
| | | /** Specifies the left inset for the steps. */ |
| | | public static final int LEFT_INSET_STEP = 5; |
| | | |
| | | /** Specifies the extra left inset for the sub-steps. */ |
| | | public static final int LEFT_INSET_SUBSTEP = 20; |
| | | |
| | | /** Specifies the top inset for the instructions sub panel. */ |
| | | public static final int TOP_INSET_INSTRUCTIONS_SUBPANEL = 5; |
| | | |
| | | /** Specifies the top inset for input subpanel. */ |
| | | public static final int TOP_INSET_INPUT_SUBPANEL = 10; |
| | | |
| | | /** Specifies the top inset for a primary field. */ |
| | | public static final int TOP_INSET_PRIMARY_FIELD = 10; |
| | | |
| | | /** Specifies the top inset for a secondary field. */ |
| | | public static final int TOP_INSET_SECONDARY_FIELD = 5; |
| | | |
| | | /** Specifies the top inset for a radio button. */ |
| | | public static final int TOP_INSET_RADIOBUTTON = 0; |
| | | |
| | | /** Specifies the top inset for a radio button subordinate panel. */ |
| | | public static final int TOP_INSET_RADIO_SUBORDINATE = 0; |
| | | |
| | | /** Specifies the top inset for the progress bar. */ |
| | | public static final int TOP_INSET_PROGRESS_BAR = 5; |
| | | |
| | | /** Specifies the top inset for the progress text area. */ |
| | | public static final int TOP_INSET_PROGRESS_TEXTAREA = 4; |
| | | |
| | | /** Specifies the top inset for the background image. */ |
| | | public static final int TOP_INSET_BACKGROUND = 70; |
| | | |
| | | /** Specifies the top inset for the error message. */ |
| | | public static final int TOP_INSET_ERROR_MESSAGE = 10; |
| | | |
| | | /** Specifies the top inset for the browse button. */ |
| | | public static final int TOP_INSET_BROWSE = 5; |
| | | |
| | | /** Specifies the right inset for background image. */ |
| | | public static final int RIGHT_INSET_BACKGROUND = 20; |
| | | |
| | | /** Specifies the left inset for the primary field. */ |
| | | public static final int LEFT_INSET_PRIMARY_FIELD = 10; |
| | | |
| | | /** Specifies the left inset for the browse button. */ |
| | | public static final int LEFT_INSET_BROWSE = 10; |
| | | |
| | | /** Specifies the left inset for radio subordinate panel. */ |
| | | public static final int LEFT_INSET_RADIO_SUBORDINATE = 35; |
| | | |
| | | /** Specifies the left inset for the secondary field. */ |
| | | public static final int LEFT_INSET_SECONDARY_FIELD = 5; |
| | | |
| | | /** Specifies the left inset for the background image. */ |
| | | public static final int LEFT_INSET_BACKGROUND = 20; |
| | | |
| | | /** Specifies the left inset for the copy url button. */ |
| | | public static final int LEFT_INSET_COPY_BUTTON = 10; |
| | | |
| | | /** Specifies the left inset for a subordinate subpanel. */ |
| | | public static final int LEFT_INSET_SUBPANEL_SUBORDINATE = 30; |
| | | |
| | | /** Specifies the left inset for the progress bar. */ |
| | | public static final int BOTTOM_INSET_PROGRESS_BAR = 10; |
| | | |
| | | /** Specifies the bottom inset for the background image. */ |
| | | public static final int BOTTOM_INSET_BACKGROUND = 30; |
| | | |
| | | /** Specifies the top inset for a secondary field. */ |
| | | public static final int BOTTOM_INSET_SECONDARY_FIELD = 5; |
| | | |
| | | /** Specifies the number of columns of a text field for a path. */ |
| | | public static final int PATH_FIELD_SIZE = 20; |
| | | |
| | | /** Specifies the number of columns of a text field for a relative path. */ |
| | | public static final int RELATIVE_PATH_FIELD_SIZE = 10; |
| | | |
| | | /** Specifies the number of columns of a text field for a host name. */ |
| | | public static final int HOST_FIELD_SIZE = 20; |
| | | |
| | | /** Specifies the number of columns of a text field for a UID. */ |
| | | public static final int UID_FIELD_SIZE = 15; |
| | | |
| | | /** Specifies the number of columns of a text field for a port. */ |
| | | public static final int PORT_FIELD_SIZE = 5; |
| | | |
| | | /** Specifies the number of columns of a text field for a dn. */ |
| | | public static final int DN_FIELD_SIZE = 20; |
| | | |
| | | /** Specifies the number of columns of a text field for a password. */ |
| | | public static final int PASSWORD_FIELD_SIZE = 15; |
| | | |
| | | /** |
| | | * Specifies the number of columns of a text field for the number of entries. |
| | | */ |
| | | /** Specifies the number of columns of a text field for the number of entries. */ |
| | | public static final int NUMBER_ENTRIES_FIELD_SIZE = 7; |
| | | |
| | | /** Specifies the number of points for the width of the progress bar. */ |
| | | public static final int PROGRESS_BAR_SIZE = 220; |
| | | |
| | | /** |
| | | * Specifies the number of extra points that we add to the minimum size of the |
| | | * dialog. |
| | | */ |
| | | /** Specifies the number of extra points that we add to the minimum size of the dialog. */ |
| | | public static final int EXTRA_DIALOG_HEIGHT = 75; |
| | | |
| | | private static final Insets BUTTONS_PANEL_INSETS = new Insets(5, 0, 5, 10); |
| | | |
| | | private static final Insets STEPS_PANEL_INSETS = new Insets(15, 10, 5, 10); |
| | | |
| | | private static final Insets CURRENT_STEP_PANEL_INSETS = new Insets(15, 15, 15, 15); |
| | | |
| | | private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0); |
| | | |
| | | /** Specifies the default background color. */ |
| | | public static final Color DEFAULT_BACKGROUND = getColor(INFO_DEFAULT_BACKGROUND_COLOR.get()); |
| | | |
| | | /** Specifies the current step background color. */ |
| | | public static final Color CURRENT_STEP_PANEL_BACKGROUND = getColor(INFO_CURRENT_STEP_PANEL_BACKGROUND_COLOR.get()); |
| | | |
| | | /** Specifies the default label color. */ |
| | | public static final Color DEFAULT_LABEL_COLOR = getColor(INFO_DEFAULT_LABEL_COLOR.get()); |
| | | |
| | | /** Specifies the valid field color. */ |
| | | public static final Color FIELD_VALID_COLOR = getColor(INFO_FIELD_VALID_COLOR.get()); |
| | | |
| | | /** Specifies the invalid field color. */ |
| | | public static final Color FIELD_INVALID_COLOR = getColor(INFO_FIELD_INVALID_COLOR.get()); |
| | | |
| | | /** Specifies the read only text color. */ |
| | | public static final Color READ_ONLY_COLOR = getColor(INFO_READ_ONLY_COLOR.get()); |
| | | |
| | | /** Specifies the check box text color. */ |
| | | public static final Color CHECKBOX_COLOR = getColor(INFO_CHECKBOX_COLOR.get()); |
| | | |
| | | /** Specifies the progress text color. */ |
| | | public static final Color PROGRESS_COLOR = getColor(INFO_PROGRESS_COLOR.get()); |
| | | |
| | | /** Specifies the instructions text color. */ |
| | | public static final Color INSTRUCTIONS_COLOR = getColor(INFO_INSTRUCTIONS_COLOR.get()); |
| | | |
| | | /** Specifies the text field text color. */ |
| | | public static final Color TEXTFIELD_COLOR = getColor(INFO_TEXTFIELD_COLOR.get()); |
| | | |
| | | /** Specifies the password field text color. */ |
| | | public static final Color PASSWORDFIELD_COLOR = getColor(INFO_PASSWORDFIELD_COLOR.get()); |
| | | |
| | | /** Specifies the in-line help text color. */ |
| | | public static final Color INLINE_HELP_COLOR = getColor(INFO_INLINE_HELP_COLOR.get()); |
| | | |
| | | /** Specifies the panel border color. */ |
| | | public static final Color PANEL_BORDER_COLOR = getColor(INFO_PANEL_BORDER_COLOR.get()); |
| | | |
| | | /** Specifies the current step panel border. */ |
| | | public static final Border CURRENT_STEP_PANEL_BORDER = |
| | | BorderFactory.createMatteBorder(0, 2, 2, 0, PANEL_BORDER_COLOR); |
| | | |
| | | /** Specifies the text area border. */ |
| | | public static final Border TEXT_AREA_BORDER = |
| | | BorderFactory.createMatteBorder(1, 1, 1, 1, getColor(INFO_TEXT_AREA_BORDER_COLOR.get())); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Specifies the font for the step which is not the current one in the steps |
| | | * panel. |
| | | */ |
| | | /** Specifies the font for the step which is not the current one in the steps panel. */ |
| | | public static final Font NOT_CURRENT_STEP_FONT = DEFAULT_FONT.deriveFont(14f); |
| | | |
| | | /** |
| | | * Specifies the font for the step which is the current one in the steps |
| | | * panel. |
| | | */ |
| | | /** Specifies the font for the step which is the current one in the steps panel. */ |
| | | public static final Font CURRENT_STEP_FONT = DEFAULT_FONT.deriveFont(14f).deriveFont(Font.BOLD); |
| | | |
| | | /** Specifies the font for the title of the current panel. */ |
| | | public static final Font TITLE_FONT = DEFAULT_FONT.deriveFont(14f).deriveFont(Font.BOLD); |
| | | |
| | | /** Specifies the font for the instructions of the current panel. */ |
| | | public static final Font INSTRUCTIONS_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the instructions of the current panel. */ |
| | | public static final Font INSTRUCTIONS_MONOSPACE_FONT = Font.decode("Monospaced-PLAIN-14"); |
| | | |
| | | /** Specifies the font for the primary valid field. */ |
| | | public static final Font PRIMARY_FIELD_VALID_FONT = DEFAULT_FONT.deriveFont(Font.BOLD); |
| | | |
| | | /** Specifies the font for the secondary valid field. */ |
| | | public static final Font SECONDARY_FIELD_VALID_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the primary invalid field. */ |
| | | public static final Font PRIMARY_FIELD_INVALID_FONT = DEFAULT_FONT.deriveFont(Font.BOLD | Font.ITALIC); |
| | | |
| | | /** Specifies the font for the secondary invalid field. */ |
| | | public static final Font SECONDARY_FIELD_INVALID_FONT = DEFAULT_FONT.deriveFont(Font.ITALIC); |
| | | |
| | | /** Specifies the font for the secondary status field. */ |
| | | public static final Font SECONDARY_STATUS_FONT = DEFAULT_FONT.deriveFont(Font.ITALIC); |
| | | |
| | | /** Specifies the font for read only text. */ |
| | | public static final Font READ_ONLY_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the check box text. */ |
| | | public static final Font CHECKBOX_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the progress text. */ |
| | | public static final Font PROGRESS_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the text field text. */ |
| | | public static final Font TEXTFIELD_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the password field text. */ |
| | | public static final Font PASSWORD_FIELD_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the points '....' in the progress panel. */ |
| | | public static final Font PROGRESS_POINTS_FONT = DEFAULT_FONT.deriveFont(Font.BOLD); |
| | | |
| | | /** Specifies the font for the done text 'Done' in the progress panel. */ |
| | | public static final Font PROGRESS_DONE_FONT = PROGRESS_POINTS_FONT; |
| | | |
| | | /** Specifies the font for the log messages in the progress panel. */ |
| | | public static final Font PROGRESS_LOG_FONT = Font.decode("Monospaced-PLAIN-12"); |
| | | |
| | | /** Specifies the font for the error log messages in the progress panel. */ |
| | | public static final Font PROGRESS_LOG_ERROR_FONT = Font.decode("Monospaced-PLAIN-12"); |
| | | |
| | | /** Specifies the font for the error messages in the progress panel. */ |
| | | public static final Font PROGRESS_ERROR_FONT = DEFAULT_FONT.deriveFont(Font.BOLD); |
| | | |
| | | /** Specifies the font for the warning messages in the progress panel. */ |
| | | public static final Font PROGRESS_WARNING_FONT = DEFAULT_FONT.deriveFont(Font.BOLD); |
| | | |
| | | /** Specifies the font for the stack trace in the progress panel. */ |
| | | public static final Font STACK_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the text in the WebBrowserErrorDialog. */ |
| | | public static final Font ERROR_DIALOG_FONT = DEFAULT_FONT; |
| | | |
| | | /** Specifies the font for the text in the in-line help. */ |
| | | public static final Font INLINE_HELP_FONT = DEFAULT_FONT.deriveFont((float) (DEFAULT_FONT.getSize() - 2)); |
| | | |
| | | private static final String SPAN_CLOSE = "</span>"; |
| | | |
| | | private static final String DIV_CLOSE = "</div>"; |
| | | |
| | | private static final String DIV_OPEN_ERROR_BACKGROUND = |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * A class used to be able to select the contents of the text field when it gets |
| | | * the focus. |
| | | */ |
| | | /** A class used to be able to select the contents of the text field when it gets the focus. */ |
| | | class TextFieldFocusListener implements FocusListener |
| | | { |
| | | private final JTextField tf; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | * to copy it to the system clipboard. This way (even if not ideal) the user |
| | | * can view the contents of the URL we display by pasting manually the URL |
| | | * in his/her browser. |
| | | * |
| | | */ |
| | | public class WebBrowserErrorDialog extends JDialog |
| | | { |
| | |
| | | getContentPane().add(createPanel()); |
| | | } |
| | | |
| | | /** |
| | | * Packs and displays this dialog. |
| | | * |
| | | */ |
| | | /** Packs and displays this dialog. */ |
| | | public void packAndShow() |
| | | { |
| | | pack(); |
| | |
| | | INFO_ERROR_BROWSER_COPY_BUTTON_TOOLTIP.get()); |
| | | copyButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | StringSelection s = new StringSelection(url); |
| | |
| | | p2.add(closeButton, gbc); |
| | | closeButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | dispose(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.util; |
| | | |
| | |
| | | this.backgroundTask = backgroundTask; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs the processing associated with the background task. |
| | | */ |
| | | /** Performs the processing associated with the background task. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | try |
| | |
| | | final T returnValue = backgroundTask.processBackgroundTask(); |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | backgroundTask.backgroundTaskCompleted(returnValue, null); |
| | |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | backgroundTask.backgroundTaskCompleted(null, t); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.util; |
| | | |
| | |
| | | this.description = description; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean accept(File f) |
| | | { |
| | | boolean accept = false; |
| | |
| | | return accept; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getDescription() |
| | | { |
| | | return description; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | /** |
| | | * This class is used to read an input stream and process ouput. |
| | | */ |
| | | /** This class is used to read an input stream and process ouput. */ |
| | | public abstract class OutputReader { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | */ |
| | | public OutputReader(final BufferedReader reader) { |
| | | Thread t = new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | String line; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.util; |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | import org.opends.quicksetup.Constants; |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | /** |
| | | * This is an implementation of the ProgressMessageFormatter class that |
| | | * provides format in plain text. |
| | | */ |
| | | public class PlainTextProgressMessageFormatter |
| | | implements ProgressMessageFormatter |
| | | public class PlainTextProgressMessageFormatter implements ProgressMessageFormatter |
| | | { |
| | | private LocalizableMessage doneText; |
| | | private LocalizableMessage errorText; |
| | | |
| | | /** |
| | | * The space in plain text. |
| | | */ |
| | | /** The space in plain text. */ |
| | | private static String SPACE = " "; |
| | | |
| | | /** |
| | | * Returns the text representation of the text without providing any style. |
| | | * @param text the source text from which we want to get the text |
| | | * representation |
| | | * @return the text representation for the given text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedText(LocalizableMessage text) |
| | | { |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of the text that is the summary of |
| | | * the installation process (the one that goes in the UI next to the progress |
| | | * bar). |
| | | * @param text the source text from which we want to get the formatted |
| | | * representation |
| | | * @return the text representation of the summary for the given text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedSummary(LocalizableMessage text) |
| | | { |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of an error for a given text. |
| | | * @param text the source text from which we want to get the plain text |
| | | * representation |
| | | * @param applyMargin specifies whether we apply a margin or not to the |
| | | * resulting formatted text. |
| | | * @return the plain text representation of an error for the given text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedError(LocalizableMessage text, boolean applyMargin) |
| | | { |
| | | LocalizableMessage result; |
| | | if (applyMargin) |
| | | { |
| | | result = new LocalizableMessageBuilder().append(Constants.LINE_SEPARATOR) |
| | | .append(text).toMessage(); |
| | | } else |
| | | { |
| | | result = text; |
| | | return new LocalizableMessageBuilder().append(Constants.LINE_SEPARATOR).append(text).toMessage(); |
| | | } |
| | | return result; |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of a warning for a given text. |
| | | * @param text the source text from which we want to get the plain text |
| | | * representation |
| | | * @param applyMargin specifies whether we apply a margin or not to the |
| | | * resulting formatted text. |
| | | * @return the plain text representation of a warning for the given text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedWarning(LocalizableMessage text, boolean applyMargin) |
| | | { |
| | | LocalizableMessage result; |
| | | if (applyMargin) |
| | | { |
| | | result = new LocalizableMessageBuilder(Constants.LINE_SEPARATOR) |
| | | .append(text).toMessage(); |
| | | } else |
| | | { |
| | | result = text; |
| | | return new LocalizableMessageBuilder(Constants.LINE_SEPARATOR).append(text).toMessage(); |
| | | } |
| | | return result; |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of a success message for a given |
| | | * text. |
| | | * @param text the source text from which we want to get the plain text |
| | | * representation |
| | | * @return the plain text representation of a success message for the given |
| | | * text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedSuccess(LocalizableMessage text) |
| | | { |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of a log error message for a given |
| | | * text. |
| | | * @param text the source text from which we want to get the plain text |
| | | * representation |
| | | * @return the plain text representation of a log error message for the given |
| | | * text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedLogError(LocalizableMessage text) |
| | | { |
| | | return text; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the plain text representation of a log message for a given text. |
| | | * @param text the source text from which we want to get the plain text |
| | | * representation |
| | | * @return the plain text representation of a log message for the given text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedLog(LocalizableMessage text) |
| | | { |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of the 'Done' text string. |
| | | * @return the plain text representation of the 'Done' text string. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedDone() |
| | | { |
| | | if (doneText == null) |
| | |
| | | return doneText; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of the 'Error' text string. |
| | | * @return the plain text representation of the 'Error' text string. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedError() |
| | | { |
| | | if (errorText == null) |
| | |
| | | return errorText; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of the argument text to which we add |
| | | * points. For instance if we pass as argument 'Configuring Server' the |
| | | * return value will be 'Configuring Server .....'. |
| | | * @param text the String to which add points. |
| | | * @return the plain text representation of the '.....' text string. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedWithPoints(LocalizableMessage text) |
| | | { |
| | | return new LocalizableMessageBuilder(text).append(SPACE) |
| | | .append(INFO_PROGRESS_POINTS.get()).append(SPACE).toMessage(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the formatted representation of a point. |
| | | * @return the formatted representation of the '.' text string. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedPoint() |
| | | { |
| | | return LocalizableMessage.raw("."); |
| | | } |
| | | |
| | | /** |
| | | * Returns the formatted representation of a space. |
| | | * @return the formatted representation of the ' ' text string. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getSpace() |
| | | { |
| | | return LocalizableMessage.raw(SPACE); |
| | | } |
| | | |
| | | /** |
| | | * Returns the formatted representation of a progress message for a given |
| | | * text. |
| | | * @param text the source text from which we want to get the formatted |
| | | * representation |
| | | * @return the formatted representation of a progress message for the given |
| | | * text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedProgress(LocalizableMessage text) |
| | | { |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | | * Returns the plain text representation of an error message for a given |
| | | * throwable. |
| | | * This method applies a margin if the applyMargin parameter is |
| | | * <CODE>true</CODE>. |
| | | * @param t the exception. |
| | | * @param applyMargin specifies whether we apply a margin or not to the |
| | | * resulting plain text. |
| | | * @return the plain text representation of an error message for the given |
| | | * exception. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getFormattedError(Throwable t, boolean applyMargin) |
| | | { |
| | | String msg = t.getMessage(); |
| | |
| | | return LocalizableMessage.raw(result); |
| | | } |
| | | |
| | | /** |
| | | * Returns the line break in plain text. |
| | | * @return the line break in plain text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getLineBreak() |
| | | { |
| | | return LocalizableMessage.raw(Constants.LINE_SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * Returns the tab in plain text. |
| | | * @return the tab in plain text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getTab() |
| | | { |
| | | return LocalizableMessage.raw(" "); |
| | | } |
| | | |
| | | /** |
| | | * Returns the task separator in plain text. |
| | | * @return the task separator in plain text. |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getTaskSeparator() |
| | | { |
| | | return LocalizableMessage.raw( |
| | |
| | | Constants.LINE_SEPARATOR+Constants.LINE_SEPARATOR); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getFormattedAfterUrlClick(String url, LocalizableMessage lastText) |
| | | { |
| | | throw new IllegalStateException( |
| | | "PlainTextProgressMessageFormatter.getFormattedAfterUrlClick must not "+ |
| | | "be called"); |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.util; |
| | | |
| | |
| | | import static org.opends.admin.ads.util.ConnectionUtils.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | /** |
| | | * Class used to manipulate an OpenDS server. |
| | | */ |
| | | /** Class used to manipulate an OpenDS server. */ |
| | | public class ServerController { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | new BufferedReader( |
| | | new InputStreamReader(process.getInputStream())); |
| | | |
| | | /* Create these objects to resend the stop process output to the |
| | | * details area. |
| | | */ |
| | | /* Create these objects to resend the stop process output to the details area. */ |
| | | new StopReader(err, true); |
| | | new StopReader(out, false); |
| | | |
| | |
| | | } else if (returnValue != 0) { |
| | | if (stopTries <= 0) |
| | | { |
| | | /* |
| | | * The return code is not the one expected, assume the server |
| | | * could not be stopped. |
| | | */ |
| | | /* The return code is not the one expected, assume the server could not be stopped. */ |
| | | throw new ApplicationException( |
| | | ReturnCode.STOP_ERROR, |
| | | INFO_ERROR_STOPPING_SERVER_CODE.get(returnValue), |
| | |
| | | * |
| | | * When a new log message is found notifies the ProgressUpdateListeners |
| | | * of it. If an error occurs it also notifies the listeners. |
| | | * |
| | | */ |
| | | private class StartReader |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | import java.io.IOException; |
| | | import java.io.PrintStream; |
| | | |
| | | /** |
| | | * Tool for suppressing and unsuppressing output to standard |
| | | * output streams. |
| | | */ |
| | | /** Tool for suppressing and unsuppressing output to standard output streams. */ |
| | | public class StandardOutputSuppressor { |
| | | |
| | | private static Token token; |
| | |
| | | return token != null; |
| | | } |
| | | |
| | | /** |
| | | * PrintWriter for suppressing stream. |
| | | */ |
| | | /** PrintWriter for suppressing stream. */ |
| | | private static class NullOutputStream extends OutputStream { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void write(int b) throws IOException { |
| | | // do nothing; |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | /** |
| | | * Class used to get the KeyStore that the graphical utilities use. |
| | | * |
| | | */ |
| | | /** Class used to get the KeyStore that the graphical utilities use. */ |
| | | public class UIKeyStore extends KeyStore |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | private static KeyStore keyStore; |
| | | |
| | | /** |
| | | * This should never be called. |
| | | */ |
| | | /** This should never be called. */ |
| | | private UIKeyStore() |
| | | { |
| | | super(null, null, null); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.util; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | * |
| | | * When is finished (successfully or unsuccessfully) it notifies the |
| | | * QuickSetupStepPanel passed in the constructor. |
| | | * |
| | | */ |
| | | public class URLWorker extends BackgroundTask<Object> |
| | | { |
| | |
| | | this.url = url; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object processBackgroundTask() throws WebBrowserException |
| | | { |
| | | try |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Object returnValue, |
| | | Throwable throwable) |
| | | { |