* <code>Dialog#setVisible(boolean)</code>.
*/
@Override
public void setVisible(boolean visible) {
GUIPreferences gs = GUIPreferences.getInstance();
IClientPreferences cs = PreferenceManager.getClientPreferences();
minimapEnabled.setSelected(gs.getMinimapEnabled());
autoEndFiring.setSelected(gs.getAutoEndFiring());
autoDeclareSearchlight.setSelected(gs.getAutoDeclareSearchlight());
nagForMASC.setSelected(gs.getNagForMASC());
nagForPSR.setSelected(gs.getNagForPSR());
nagForNoAction.setSelected(gs.getNagForNoAction());
animateMove.setSelected(gs.getShowMoveStep());
showWrecks.setSelected(gs.getShowWrecks());
soundMute.setSelected(gs.getSoundMute());
showMapHexPopup.setSelected(gs.getShowMapHexPopup());
tooltipDelay.setText(Integer.toString(gs.getTooltipDelay()));
// Select the correct char set (give a nice default to start).
unitStartChar.setSelectedIndex(0);
for (int loop = 0; loop < unitStartChar.getItemCount(); loop++) {
if (((String) unitStartChar.getItemAt(loop)).charAt(0) == PreferenceManager
.getClientPreferences().getUnitStartChar()) {
unitStartChar.setSelectedIndex(loop);
break;
}
}
maxPathfinderTime.setText(Integer.toString(cs.getMaxPathfinderTime()));
rightDragScroll.setSelected(gs.getRightDragScroll());
ctlScroll.setSelected(gs.getCtlScroll());
clickEdgeScroll.setSelected(gs.getClickEdgeScroll());
alwaysRightClickScroll.setSelected(gs.getAlwaysRightClickScroll());
autoEdgeScroll.setSelected(gs.getAutoEdgeScroll());
scrollSensitivity.setText(Integer.toString(gs.getScrollSensitivity()));
keepGameLog.setSelected(cs.keepGameLog());
gameLogFilename.setEnabled(keepGameLog.isSelected());
gameLogFilename.setText(cs.getGameLogFilename());
// gameLogMaxSize.setEnabled(keepGameLog.isSelected());
// gameLogMaxSize.setText( Integer.toString(cs.getGameLogMaxSize()) );
stampFilenames.setSelected(cs.stampFilenames());
stampFormat.setEnabled(stampFilenames.isSelected());
stampFormat.setText(cs.getStampFormat());
defaultAutoejectDisabled.setSelected(cs.defaultAutoejectDisabled());
useAverageSkills.setSelected(cs.useAverageSkills());
showUnitId.setSelected(cs.getShowUnitId());
int index = 0;
if (cs.getLocaleString().startsWith("de")) {
index = 1;
}
if (cs.getLocaleString().startsWith("ru")) {
index = 2;
}
displayLocale.setSelectedIndex(index);
chatloungeTabs.setSelected(gs.getChatLoungeTabs());
showMapsheets.setSelected(gs.getShowMapsheets());
File dir = new File("data" + File.separator + "images" + File.separator
+ "hexes" + File.separator);
tileSets = dir.listFiles(new FilenameFilter() {
public boolean accept(File direc, String name) {
if (name.endsWith(".tileset")) {
return true;
}
return false;
}
});
tileSetChoice.removeAllItems();
for (int i = 0; i < tileSets.length; i++) {
String name = tileSets[i].getName();
tileSetChoice.addItem(name.substring(0, name.length() - 8));
if (name.equals(cs.getMapTileset())) {
tileSetChoice.setSelectedIndex(i);
}
}
getFocus.setSelected(gs.getFocus());