📄 advancedoptions.java
字号:
getLogMethod();
tabbedPane.addTab(CBIntText.get("Log Method"), new ImageIcon(dirImage + "log_method.gif"), logMethodPanel, CBIntText.get("Set the method of logging you want, for example, to a file."));
}
/**
* Gets the log method from the property file and sets the appropriate radio button.
*/
private void getLogMethod()
{
String logHandlers = (JXplorer.getProperty("handlers")); // java logging standard property
if (logHandlers.indexOf("ConsoleHandler") > 0 && logHandlers.indexOf("FileHandler") > 0)
logMethodCombo.setSelectedItem(logMethodVal[3]);
else if (logHandlers.indexOf("FileHandler") > 0)
logMethodCombo.setSelectedItem(logMethodVal[2]);
else if (logHandlers.indexOf("ConsoleHandler") > 0)
logMethodCombo.setSelectedItem(logMethodVal[1]);
else
logMethodCombo.setSelectedItem(logMethodVal[0]);
}
/**
* Sets up the log level radio buttons.
*/
private void logLevel()
{
CBPanel logLevelPanel = new CBPanel();
logLevelPanel.addln(new JLabel(CBIntText.get("Select a New Log Level: ")));
logLevelPanel.addln(new JLabel(" "));
logLevelCombo = new JComboBox(logLevelVal);
logLevelCombo.setToolTipText(CBIntText.get("Set the logging level in JXplorer."));
logLevelPanel.addln(logLevelCombo);
logLevelPanel.addln(new JLabel(" "));
getLogLevel();
tabbedPane.addTab(CBIntText.get("Log Level"),
new ImageIcon(dirImage + "log_level.gif"), logLevelPanel,
CBIntText.get("Set the level of logging you want, for example, errors only."));
}
/**
* Gets the log level from the property file and sets the appropriate combo box item.
*/
private void getLogLevel()
{
// Get the log level from the property file...
Level logLevel;
try
{
logLevel = Level.parse(JXplorer.getProperty(".level"));
}
catch (Exception e) // IllegalArgumentException, or possibly a null pointer exception
{
logLevel = Level.WARNING; // default
}
if (logLevel.equals(Level.SEVERE))
logLevelCombo.setSelectedItem(logLevelVal[0]); // Errors Only option.
else if (logLevel.equals(Level.WARNING))
logLevelCombo.setSelectedItem(logLevelVal[1]); // Basic option.
else if (logLevel.equals(Level.INFO))
logLevelCombo.setSelectedItem(logLevelVal[2]); // Tree Operations option.
else if (logLevel.equals(Level.FINE))
logLevelCombo.setSelectedItem(logLevelVal[3]); // Extensive option.
else if (logLevel.equals(Level.FINEST))
logLevelCombo.setSelectedItem(logLevelVal[4]); // All option.
else if (logLevel.equals(Level.ALL))
logLevelCombo.setSelectedItem(logLevelVal[5]); // All + BER Trace option.
else
logLevelCombo.setSelectedItem(logLevelVal[1]);// Default option.
}
/**
* Sets up the LDAP Levels tab. Adds the text fields & labels to the panel.
*/
private void ldapLevels()
{
ldapLimit = new JTextField();
ldapTimeout = new JTextField();
getLdapLevels();
CBPanel ldapLevelsPanel = new CBPanel();
ldapLevelsPanel.addln(new JLabel(CBIntText.get("Set LDAP Options: ")));
ldapLevelsPanel.addln(new JLabel(" ")); //TE: white space.
ldapLevelsPanel.add(new JLabel(CBIntText.get("LDAP Limit: ")));
ldapLevelsPanel.add(ldapLimit);
ldapLevelsPanel.newLine();
ldapLevelsPanel.addln(new JLabel(" ")); //TE: white space.
ldapLevelsPanel.add(new JLabel(CBIntText.get("LDAP Timeout: ")));
ldapLevelsPanel.add(ldapTimeout);
tabbedPane.addTab(CBIntText.get("Search Limits"),
new ImageIcon(dirImage + "find.gif"), ldapLevelsPanel,
CBIntText.get("Set the search levels, that is, the number of entries returned from a search and the timeout."));
}
/**
* Gets the ldap limit and timeout values from the property file and sets the text fields with these values.
*/
private void getLdapLevels()
{
// Gets the values from the property file...
String limit = JXplorer.getProperty("option.ldap.limit");
String timeout = JXplorer.getProperty("option.ldap.timeout");
ldapLimit.setText(limit);
ldapLimit.setToolTipText(CBIntText.get("Enter the new limit level."));
ldapTimeout.setText(timeout);
ldapTimeout.setToolTipText(CBIntText.get("Enter the new timeout level."));
}
/**
* Sets up the URL tab with a combo box.
*/
private void urlTab()
{
String[] url = new String[]{CBIntText.get("JXplorer"), CBIntText.get("Launch")};
CBPanel urlPanel = new CBPanel();
urlCombo = new JComboBox(url);
getURLHandling();
urlPanel.addln(new JLabel(CBIntText.get("Select URL handling: ")));
urlPanel.addln(new JLabel(" "));
urlPanel.addln(urlCombo);
urlPanel.addln(new JLabel(" "));
urlPanel.addln(new JLabel(CBIntText.get("Note: Launch is for Windows only.")));
tabbedPane.addTab(CBIntText.get("URL"), new ImageIcon(dirImage + "url.gif"), urlPanel, CBIntText.get("Select how you would like the URLs handled in JXplorer."));
}
/**
* Gets the url handling type (either JXplorer or Launch -
* if something else, it defaults to JXplorer)
* from the property file and sets the url combo box.
*/
private void getURLHandling()
{
// Gets the value from the property file...
String urlHandling = JXplorer.getProperty("option.url.handling");
int index = 0;
if (urlHandling != null)
if (urlHandling.equalsIgnoreCase("Launch"))
index = 1;
urlCombo.setSelectedIndex(index);
}
/**
* Sets up the Password option tab.
*/
private void pwdTab()
{
String[] cache = new String[] {CBIntText.get("Yes"),CBIntText.get("No")};
CBPanel urlPanel = new CBPanel();
cachePwdCombo = new JComboBox(cache);
getPasswordCachingOption();
urlPanel.addln(new JLabel(CBIntText.get("Cache passwords: ")));
urlPanel.addln(new JLabel(" "));
urlPanel.addln(cachePwdCombo);
urlPanel.addln(new JLabel(" "));
urlPanel.addln(new JLabel(CBIntText.get(" ")));
tabbedPane.addTab(CBIntText.get("Cache Passwords"), new ImageIcon(dirImage + "cachePwds.gif"), urlPanel, CBIntText.get("Select Yes if you want passwords cached in JXplorer."));
}
/**
* Gets the password caching option from the property
* file and sets the cachePwd combo box.
*/
private void getPasswordCachingOption()
{
// Gets the value from the property file...
String pwdCaching = JXplorer.getProperty("jxplorer.cache.passwords");
int index = 0;
if(pwdCaching!=null)
if(pwdCaching.equalsIgnoreCase("false"))
index = 1;
cachePwdCombo.setSelectedIndex(index);
}
/**
* Calls the appropriate save methods then exits.
*/
private void apply()
{
checkLookAndFeel();
checkLogMethod();
checkLogLevel();
checkLdapLevels();
checkUrlHandling();
checkCachePwds();
quit();
}
/**
* Checks if the L&F has been changed. If so updates
* the property file and sets the L&F as requested.
*/
private void checkLookAndFeel()
{
// Used for exception info...
JRadioButton rb = null; //TE: used for exception info.
String currentLF = JXplorer.getProperty("gui.lookandfeel");
try
{
if ((lookAndFeel[WINDOWS].isSelected()) == true)
{
// Don't change it unless we have to...
if(currentLF.equalsIgnoreCase(WINDOWS_LF))
return;
rb = setNewLookAndFeel(WINDOWS_LF, WINDOWS);
}
else if ((lookAndFeel[JAVA].isSelected()) == true)
{
// Don't change it unless we have to...
if(currentLF.equalsIgnoreCase(JAVA_LF))
return;
rb = setNewLookAndFeel(JAVA_LF, JAVA);
}
else if ((lookAndFeel[MOTIF].isSelected()) == true)
{
// Don't change it unless we have to...
if(currentLF.equalsIgnoreCase(MOTIF_LF))
return;
rb = setNewLookAndFeel(MOTIF_LF, MOTIF);
}
else if ((lookAndFeel[MAC].isSelected()) == true)
{
// Don't change it unless we have to...
if(currentLF.equalsIgnoreCase(MAC_LF))
return;
rb = setNewLookAndFeel(MAC_LF, MAC);
}
}
catch (UnsupportedLookAndFeelException exc) // It can throw an exception if you try to set windows on a non-windows box.
{
rb.setEnabled(false);
log.warning("Unsupported LookAndFeel: " + rb.getText());
}
catch (Exception exc) // Shouldn't happen, but this is a pretty bizarre operation so just in case...
{
rb.setEnabled(false);
exc.printStackTrace();
log.warning("Could not load LookAndFeel: " + rb.getText());
exc.printStackTrace();
}
// Sets the cursor to an hour-glass...
getOwner().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
updateLookAndFeel();
if (mainMenu.getConnection != null)
SwingUtilities.updateComponentTreeUI(mainMenu.getConnection);
// Sets the cursor back to normal...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -