本文整理汇总了Java中chatty.util.settings.Settings类的典型用法代码示例。如果您正苦于以下问题:Java Settings类的具体用法?Java Settings怎么用?Java Settings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Settings类属于chatty.util.settings包,在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TwitchConnection
import chatty.util.settings.Settings; //导入依赖的package包/类
public TwitchConnection(final ConnectionListener listener, Settings settings,
String label) {
irc = new IrcConnection(label);
this.listener = listener;
this.settings = settings;
this.twitchCommands = new TwitchCommands(this);
spamProtection = new SpamProtection();
spamProtection.setLinesPerSeconds(settings.getString("spamProtection"));
users.setCapitalizedNames(settings.getBoolean("capitalizedNames"));
users.addListener(new UserManager.UserManagerListener() {
@Override
public void userUpdated(User user) {
if (user.isOnline()) {
listener.onUserUpdated(user);
}
}
});
}
示例2: ChatLog
import chatty.util.settings.Settings; //导入依赖的package包/类
public ChatLog(Settings settings) {
this.settings = settings;
Path path = getPath();
if (path == null) {
log = null;
} else {
String logSplit = settings.getString("logSplit");
boolean logSubdirectories = settings.getBoolean("logSubdirectories");
boolean lockFiles = settings.getBoolean("logLockFiles");
this.log = new LogManager(path, logSplit, logSubdirectories, lockFiles);
}
compactForChannels = new HashMap<>();
try {
String timestamp = settings.getString("logTimestamp");
if (!timestamp.equals("off")) {
sdf = new SimpleDateFormat(timestamp+" ");
}
} catch (IllegalArgumentException ex) {
sdf = null;
}
}
示例3: copyMessage
import chatty.util.settings.Settings; //导入依赖的package包/类
public static void copyMessage(Settings settings, User user, String message,
boolean highlighted) {
if (!settings.getBoolean("cmEnabled")) {
return;
}
if (settings.getBoolean("cmHighlightedOnly") && !highlighted) {
return;
}
String channel = settings.getString("cmChannel");
if (!channel.trim().isEmpty() && !channel.equalsIgnoreCase(user.getChannel())) {
return;
}
String text = settings.getString("cmTemplate");
text = text.replaceFirst("\\{user\\}", user.getDisplayNick());
text = text.replaceFirst("\\{message\\}", message);
MiscUtil.copyToClipboard(text);
}
示例4: ChatLog
import chatty.util.settings.Settings; //导入依赖的package包/类
public ChatLog(Settings settings) {
this.settings = settings;
Path path = getPath();
if (path == null) {
log = null;
} else {
this.log = new LogManager(path);
}
compactForChannels = new HashMap<>();
try {
String timestamp = settings.getString("logTimestamp");
if (!timestamp.equals("off")) {
sdf = new SimpleDateFormat(timestamp+" ");
}
} catch (IllegalArgumentException ex) {
sdf = null;
}
}
示例5: CustomNames
import chatty.util.settings.Settings; //导入依赖的package包/类
public CustomNames(Settings settings) {
this.settings = settings;
settings.addSettingChangeListener(new SettingChangeListener() {
@Override
public void settingChanged(String setting, int type, Object value) {
if (setting.equals(SETTING_NAME)) {
informListenersAllChanged();
}
}
});
}
示例6: aboutToSaveSettings
import chatty.util.settings.Settings; //导入依赖的package包/类
@Override
public void aboutToSaveSettings(Settings settings) {
Collection<String> openChans;
if (SwingUtilities.isEventDispatchThread()) {
openChans = g.getOpenChannels();
} else {
openChans = c.getOpenChannels();
}
settings.setString("previousChannel", Helper.buildStreamsString(openChans));
EmoticonSizeCache.saveToFile();
}
示例7: loadFavoritesFromSettings
import chatty.util.settings.Settings; //导入依赖的package包/类
/**
* Loads the favorites from the settings.
*
* @param settings The Settings object
*/
public void loadFavoritesFromSettings(Settings settings) {
List<List> entriesToLoad = settings.getList("favoriteEmotes");
favoritesNotFound.clear();
favorites.clear();
for (List item : entriesToLoad) {
Favorite f = listToFavorite(item);
if (f != null) {
favoritesNotFound.put(f.code, f);
}
}
loadedFavoritesFromSettings = true;
}
示例8: saveFavoritesToSettings
import chatty.util.settings.Settings; //导入依赖的package包/类
/**
* Saves the favorites to the settings, discarding any favorites that
* haven't been found several times already.
*
* @param settings The Settings object
*/
public void saveFavoritesToSettings(Settings settings) {
if (!loadedFavoritesFromSettings) {
LOGGER.warning("Not saving favorite emotes, because they don't seem to have been loaded in the first place.");
return;
}
List<List> entriesToSave = new ArrayList<>();
for (Favorite f : favorites.keySet()) {
entriesToSave.add(favoriteToList(f));
}
settings.putList("favoriteEmotes", entriesToSave);
}
示例9: loadFromSettings
import chatty.util.settings.Settings; //导入依赖的package包/类
/**
* Removes all current hotkeys and loads the data from the settings.
*
* @param settings
*/
public synchronized void loadFromSettings(Settings settings) {
this.settings = settings;
List<List> loadFrom = settings.getList(SETTING_NAME);
hotkeys.clear();
for (List l : loadFrom) {
Hotkey entry = listToHotkey(l);
if (entry != null) {
hotkeys.add(entry);
}
}
updateHotkeys();
checkGlobalHotkeyWarning();
}
示例10: BotNameManager
import chatty.util.settings.Settings; //导入依赖的package包/类
public BotNameManager(Settings settings) {
if (settings != null) {
for (Object name : settings.getList("botNames")) {
addBotName(null, (String)name);
}
}
}
示例11: NotificationManager
import chatty.util.settings.Settings; //导入依赖的package包/类
public NotificationManager(MainGui main,
Settings settings) {
this.settings = settings;
this.main = main;
loadFromSettings();
settings.addSettingChangeListener((s, t, v) -> {
if (s.equals(SETTING_NAME)) {
loadFromSettings();
}
});
}
示例12: aboutToSaveSettings
import chatty.util.settings.Settings; //导入依赖的package包/类
@Override
public void aboutToSaveSettings(Settings settings) {
if (SwingUtilities.isEventDispatchThread()) {
System.out.println("Saving GUI settings.");
client.settings.setLong("favoritesSorting", favoritesDialog.getSorting());
emoticons.saveFavoritesToSettings(settings);
client.settings.setString("statusHistorySorting", adminDialog.getStatusHistorySorting());
}
}
示例13: UsercolorManager
import chatty.util.settings.Settings; //导入依赖的package包/类
public UsercolorManager(Settings settings) {
this.settings = settings;
loadFromSettings();
// TEST
// data = new ArrayList<>();
// for (int i=0;i<10000;i++) {
// data.add(new UsercolorItem("user"+i, Color.BLACK));
// }
}
示例14: NotificationEditor
import chatty.util.settings.Settings; //导入依赖的package包/类
public NotificationEditor(JDialog owner, Settings settings) {
super(SORTING_MODE_MANUAL, false);
editor = new MyItemEditor(owner, settings);
setModel(new MyTableModel());
setItemEditor(editor);
setRendererForColumn(0, new MyRenderer());
setRendererForColumn(1, new MyRenderer());
setRendererForColumn(2, new MyRenderer());
}
示例15: setUpClass
import chatty.util.settings.Settings; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() {
highlighter = new Highlighter();
Settings settings = new Settings("");
settings.addBoolean("abSaveOnChange", false);
ab = new Addressbook(null, null, settings);
user.setAddressbook(ab);
user2.setAddressbook(ab);
ab.add("testUser", "testCat");
}