Revised requested changes besides 2 (please change by yourself)
This commit is contained in:
parent
c078c33d8b
commit
bafadca4cb
@ -121,14 +121,12 @@ public class Config {
|
|||||||
public void setLocalDB(File localDB) { this.localDB = localDB; }
|
public void setLocalDB(File localDB) { this.localDB = localDB; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return the current time (milliseconds) that is waited between Syncs
|
* @return the current time (milliseconds) that is waited between Syncs
|
||||||
* @since Envoy v0.1-alpha
|
* @since Envoy v0.1-alpha
|
||||||
*/
|
*/
|
||||||
public int getSyncTimeout() { return syncTimeout; }
|
public int getSyncTimeout() { return syncTimeout; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param syncTimeout sets the time (milliseconds) during which Sync waits
|
* @param syncTimeout sets the time (milliseconds) during which Sync waits
|
||||||
* @since Envoy v0.1-alpha
|
* @since Envoy v0.1-alpha
|
||||||
*/
|
*/
|
||||||
|
@ -89,6 +89,12 @@ public class Settings {
|
|||||||
Color.black, Color.black));
|
Color.black, Color.black));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* updates prefs when save button is clicked
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public void save() throws IOException{
|
public void save() throws IOException{
|
||||||
prefs.put("username", getUsername());
|
prefs.put("username", getUsername());
|
||||||
prefs.put("email", getEmail());
|
prefs.put("email", getEmail());
|
||||||
@ -102,13 +108,29 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds new theme to the theme map and sets current theme to the new theme.
|
||||||
|
*
|
||||||
|
* @param theme
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public void addNewThemeToMap(Theme theme) {
|
public void addNewThemeToMap(Theme theme) {
|
||||||
settings.getThemes().put(theme.getThemeName(), theme);
|
settings.getThemes().put(theme.getThemeName(), theme);
|
||||||
currentTheme = theme.getThemeName();
|
currentTheme = theme.getThemeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link currentTheme}
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public String getCurrentTheme() { return currentTheme; }
|
public String getCurrentTheme() { return currentTheme; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the currentTheme
|
||||||
|
*
|
||||||
|
* @param themeName
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public void setCurrentTheme(String themeName) { currentTheme = themeName; }
|
public void setCurrentTheme(String themeName) { currentTheme = themeName; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,7 +173,17 @@ public class Settings {
|
|||||||
*/
|
*/
|
||||||
public void setEnterToSend(boolean enterToSend) { this.enterToSend = enterToSend; }
|
public void setEnterToSend(boolean enterToSend) { this.enterToSend = enterToSend; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link themes} map
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Map<String, Theme> getThemes() { return themes; }
|
public Map<String, Theme> getThemes() { return themes; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets {@link themes}
|
||||||
|
*
|
||||||
|
* @param themes
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public void setThemes(Map<String, Theme> themes) { this.themes = themes; }
|
public void setThemes(Map<String, Theme> themes) { this.themes = themes; }
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package envoy.client.ui;
|
package envoy.client.ui;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.ComponentOrientation;
|
import java.awt.ComponentOrientation;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
@ -136,6 +135,7 @@ public class ChatWindow extends JFrame {
|
|||||||
&& ((Settings.getInstance().isEnterToSend() && e.getModifiersEx() == 0)
|
&& ((Settings.getInstance().isEnterToSend() && e.getModifiersEx() == 0)
|
||||||
|| (e.getModifiersEx() == KeyEvent.CTRL_DOWN_MASK))) {
|
|| (e.getModifiersEx() == KeyEvent.CTRL_DOWN_MASK))) {
|
||||||
postMessage(messageList);
|
postMessage(messageList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Checks for changed Message
|
// Checks for changed Message
|
||||||
@ -244,6 +244,7 @@ public class ChatWindow extends JFrame {
|
|||||||
|
|
||||||
contentPane.revalidate();
|
contentPane.revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to immediately reload the ChatWindow when settings were changed.
|
* Used to immediately reload the ChatWindow when settings were changed.
|
||||||
@ -282,19 +283,22 @@ public class ChatWindow extends JFrame {
|
|||||||
userList.setSelectionBackground(theme.getSelectionColor());
|
userList.setSelectionBackground(theme.getSelectionColor());
|
||||||
userList.setForeground(theme.getUserNameColor());
|
userList.setForeground(theme.getUserNameColor());
|
||||||
userList.setBackground(theme.getCellColor());
|
userList.setBackground(theme.getCellColor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postMessage(JList<Message> messageList) {
|
private void postMessage(JList<Message> messageList) {
|
||||||
if (!client.hasRecipient()) {
|
if (!client.hasRecipient()) {
|
||||||
JOptionPane.showMessageDialog(this, "Please select a recipient!", "Cannot send message", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(this,
|
||||||
|
"Please select a recipient!",
|
||||||
|
"Cannot send message",
|
||||||
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!messageEnterTextArea.getText().isEmpty()) try {
|
if (!messageEnterTextArea.getText().isEmpty()) try {
|
||||||
|
|
||||||
// Create and send message object
|
// Create and send message object
|
||||||
final Message message = localDB.createMessage(messageEnterTextArea.getText(), currentChat.getRecipient());
|
final Message message = localDB.createMessage(messageEnterTextArea.getText(),
|
||||||
|
currentChat.getRecipient().getID());
|
||||||
currentChat.appendMessage(message);
|
currentChat.appendMessage(message);
|
||||||
messageList.setModel(currentChat.getModel());
|
messageList.setModel(currentChat.getModel());
|
||||||
|
|
||||||
@ -344,7 +348,8 @@ public class ChatWindow extends JFrame {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
||||||
// Synchronize
|
// Synchronize
|
||||||
localDB.applySync(client.sendSync(client.getSender().getID(), localDB.fillSync(client.getSender().getID())));
|
localDB.applySync(
|
||||||
|
client.sendSync(client.getSender().getID(), localDB.fillSync(client.getSender().getID())));
|
||||||
|
|
||||||
// Process unread messages
|
// Process unread messages
|
||||||
localDB.addUnreadMessagesToLocalDB();
|
localDB.addUnreadMessagesToLocalDB();
|
||||||
@ -354,7 +359,8 @@ public class ChatWindow extends JFrame {
|
|||||||
readCurrentChat();
|
readCurrentChat();
|
||||||
|
|
||||||
// Update UI
|
// Update UI
|
||||||
SwingUtilities.invokeLater(() -> { updateUserStates(); contentPane.revalidate(); contentPane.repaint(); });
|
SwingUtilities
|
||||||
|
.invokeLater(() -> { updateUserStates(); contentPane.revalidate(); contentPane.repaint(); });
|
||||||
}).start();
|
}).start();
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
@ -371,3 +377,4 @@ public class ChatWindow extends JFrame {
|
|||||||
*/
|
*/
|
||||||
private void readCurrentChat() { if (currentChat != null) { localDB.setMessagesToRead(currentChat); } }
|
private void readCurrentChat() { if (currentChat != null) { localDB.setMessagesToRead(currentChat); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import java.awt.Insets;
|
|||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
import java.awt.event.ItemListener;
|
import java.awt.event.ItemListener;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
@ -24,6 +25,7 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
|
|
||||||
|
import envoy.client.LocalDB;
|
||||||
import envoy.client.Settings;
|
import envoy.client.Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,6 +66,8 @@ public class SettingsScreen extends JDialog {
|
|||||||
private boolean colorChanged = false;
|
private boolean colorChanged = false;
|
||||||
private Theme temporaryTheme;
|
private Theme temporaryTheme;
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(LocalDB.class.getSimpleName());
|
||||||
|
|
||||||
private static SettingsScreen settingsScreen;
|
private static SettingsScreen settingsScreen;
|
||||||
|
|
||||||
// TODO: Add a JPanel with all the Information necessary:
|
// TODO: Add a JPanel with all the Information necessary:
|
||||||
@ -89,8 +93,7 @@ public class SettingsScreen extends JDialog {
|
|||||||
* @since Envoy v0.1-alpha
|
* @since Envoy v0.1-alpha
|
||||||
*/
|
*/
|
||||||
private SettingsScreen() {
|
private SettingsScreen() {
|
||||||
|
logger.info(Settings.getInstance().getCurrentTheme());
|
||||||
System.out.println(Settings.getInstance().getCurrentTheme());
|
|
||||||
|
|
||||||
setBounds(10, 10, 450, 650);
|
setBounds(10, 10, 450, 650);
|
||||||
getContentPane().setLayout(new BorderLayout());
|
getContentPane().setLayout(new BorderLayout());
|
||||||
@ -98,7 +101,8 @@ public class SettingsScreen extends JDialog {
|
|||||||
|
|
||||||
createNewThemeButton.setEnabled(false);
|
createNewThemeButton.setEnabled(false);
|
||||||
|
|
||||||
temporaryTheme = new Theme("temporaryTheme", Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
|
temporaryTheme = new Theme("temporaryTheme",
|
||||||
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
|
||||||
|
|
||||||
// Content pane
|
// Content pane
|
||||||
GridBagLayout gbl_contentPanel = new GridBagLayout();
|
GridBagLayout gbl_contentPanel = new GridBagLayout();
|
||||||
@ -147,13 +151,10 @@ public class SettingsScreen extends JDialog {
|
|||||||
gbc_optionsList.insets = new Insets(space, space, space, space);
|
gbc_optionsList.insets = new Insets(space, space, space, space);
|
||||||
|
|
||||||
optionsListModel.addElement("Color Themes");
|
optionsListModel.addElement("Color Themes");
|
||||||
|
|
||||||
options.setModel(optionsListModel);
|
options.setModel(optionsListModel);
|
||||||
|
|
||||||
contentPanel.add(options, gbc_optionsList);
|
contentPanel.add(options, gbc_optionsList);
|
||||||
|
|
||||||
// Theme content
|
// Theme content
|
||||||
|
|
||||||
gbc_themeContent = new GridBagConstraints();
|
gbc_themeContent = new GridBagConstraints();
|
||||||
gbc_themeContent.fill = GridBagConstraints.BOTH;
|
gbc_themeContent.fill = GridBagConstraints.BOTH;
|
||||||
gbc_themeContent.gridx = 1;
|
gbc_themeContent.gridx = 1;
|
||||||
@ -206,7 +207,13 @@ public class SettingsScreen extends JDialog {
|
|||||||
theme.getBackgroundColor(),
|
theme.getBackgroundColor(),
|
||||||
"Background",
|
"Background",
|
||||||
1);
|
1);
|
||||||
buildCustomizeElement(new JPanel(), new JButton(), new JTextPane(), theme, theme.getCellColor(), "Cells", 2);
|
buildCustomizeElement(new JPanel(),
|
||||||
|
new JButton(),
|
||||||
|
new JTextPane(),
|
||||||
|
theme,
|
||||||
|
theme.getCellColor(),
|
||||||
|
"Cells",
|
||||||
|
2);
|
||||||
buildCustomizeElement(new JPanel(),
|
buildCustomizeElement(new JPanel(),
|
||||||
new JButton(),
|
new JButton(),
|
||||||
new JTextPane(),
|
new JTextPane(),
|
||||||
@ -221,11 +228,41 @@ public class SettingsScreen extends JDialog {
|
|||||||
theme.getInteractableBackgroundColor(),
|
theme.getInteractableBackgroundColor(),
|
||||||
"Interactable Background",
|
"Interactable Background",
|
||||||
4);
|
4);
|
||||||
buildCustomizeElement(new JPanel(), new JButton(), new JTextPane(), theme, theme.getMessageColorChat(), "Messages Chat", 5);
|
buildCustomizeElement(new JPanel(),
|
||||||
buildCustomizeElement(new JPanel(), new JButton(), new JTextPane(), theme, theme.getDateColorChat(), "Date Chat", 6);
|
new JButton(),
|
||||||
buildCustomizeElement(new JPanel(), new JButton(), new JTextPane(), theme, theme.getSelectionColor(), "Selection", 7);
|
new JTextPane(),
|
||||||
buildCustomizeElement(new JPanel(), new JButton(), new JTextPane(), theme, theme.getTypingMessageColor(), "Typing Message", 8);
|
theme,
|
||||||
buildCustomizeElement(new JPanel(), new JButton(), new JTextPane(), theme, theme.getUserNameColor(), "User Names", 9);
|
theme.getMessageColorChat(),
|
||||||
|
"Messages Chat",
|
||||||
|
5);
|
||||||
|
buildCustomizeElement(new JPanel(),
|
||||||
|
new JButton(),
|
||||||
|
new JTextPane(),
|
||||||
|
theme,
|
||||||
|
theme.getDateColorChat(),
|
||||||
|
"Date Chat",
|
||||||
|
6);
|
||||||
|
buildCustomizeElement(new JPanel(),
|
||||||
|
new JButton(),
|
||||||
|
new JTextPane(),
|
||||||
|
theme,
|
||||||
|
theme.getSelectionColor(),
|
||||||
|
"Selection",
|
||||||
|
7);
|
||||||
|
buildCustomizeElement(new JPanel(),
|
||||||
|
new JButton(),
|
||||||
|
new JTextPane(),
|
||||||
|
theme,
|
||||||
|
theme.getTypingMessageColor(),
|
||||||
|
"Typing Message",
|
||||||
|
8);
|
||||||
|
buildCustomizeElement(new JPanel(),
|
||||||
|
new JButton(),
|
||||||
|
new JTextPane(),
|
||||||
|
theme,
|
||||||
|
theme.getUserNameColor(),
|
||||||
|
"User Names",
|
||||||
|
9);
|
||||||
|
|
||||||
GridBagConstraints gbc_colorsPanel = new GridBagConstraints();
|
GridBagConstraints gbc_colorsPanel = new GridBagConstraints();
|
||||||
gbc_colorsPanel.fill = GridBagConstraints.HORIZONTAL;
|
gbc_colorsPanel.fill = GridBagConstraints.HORIZONTAL;
|
||||||
@ -246,14 +283,16 @@ public class SettingsScreen extends JDialog {
|
|||||||
String s = JOptionPane.showInputDialog("Enter a name for the new theme");
|
String s = JOptionPane.showInputDialog("Enter a name for the new theme");
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
Settings.getInstance()
|
Settings.getInstance()
|
||||||
.addNewThemeToMap(new Theme(s, temporaryTheme.getBackgroundColor(), temporaryTheme.getCellColor(),
|
.addNewThemeToMap(new Theme(s, temporaryTheme.getBackgroundColor(),
|
||||||
temporaryTheme.getInteractableForegroundColor(), temporaryTheme.getInteractableBackgroundColor(),
|
temporaryTheme.getCellColor(), temporaryTheme.getInteractableForegroundColor(),
|
||||||
temporaryTheme.getMessageColorChat(), temporaryTheme.getDateColorChat(), temporaryTheme.getSelectionColor(),
|
temporaryTheme.getInteractableBackgroundColor(), temporaryTheme.getMessageColorChat(),
|
||||||
|
temporaryTheme.getDateColorChat(), temporaryTheme.getSelectionColor(),
|
||||||
temporaryTheme.getTypingMessageColor(), temporaryTheme.getUserNameColor()));
|
temporaryTheme.getTypingMessageColor(), temporaryTheme.getUserNameColor()));
|
||||||
themeArray = Arrays.copyOf(themeArray, themeArray.length + 1);
|
themeArray = Arrays.copyOf(themeArray, themeArray.length + 1);
|
||||||
themeArray[themeArray.length - 1] = Settings.getInstance().getThemes().get(s).getThemeName();
|
themeArray[themeArray.length - 1] = Settings.getInstance().getThemes().get(s).getThemeName();
|
||||||
|
|
||||||
temporaryTheme = new Theme("temporaryTheme", Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
|
temporaryTheme = new Theme("temporaryTheme",
|
||||||
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
|
||||||
|
|
||||||
createNewThemeButton.setEnabled(false);
|
createNewThemeButton.setEnabled(false);
|
||||||
themes.addItem(themeArray[themeArray.length - 1]);
|
themes.addItem(themeArray[themeArray.length - 1]);
|
||||||
@ -264,7 +303,7 @@ public class SettingsScreen extends JDialog {
|
|||||||
// TODO: Create new Theme
|
// TODO: Create new Theme
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("New theme couldn't be created! " + e);
|
logger.info("New theme couldn't be created! " + e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -326,7 +365,7 @@ public class SettingsScreen extends JDialog {
|
|||||||
revalidate();
|
revalidate();
|
||||||
repaint();
|
repaint();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Something went wrong when changing the setting");
|
logger.info("Something went wrong when changing the setting");
|
||||||
settingsScreen.dispose();
|
settingsScreen.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -373,12 +412,21 @@ public class SettingsScreen extends JDialog {
|
|||||||
temporaryTheme = new Theme("temporaryTheme",
|
temporaryTheme = new Theme("temporaryTheme",
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getBackgroundColor(),
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getBackgroundColor(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getCellColor(),
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getCellColor(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getInteractableForegroundColor(),
|
Settings.getInstance()
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getInteractableBackgroundColor(),
|
.getThemes()
|
||||||
|
.get(Settings.getInstance().getCurrentTheme())
|
||||||
|
.getInteractableForegroundColor(),
|
||||||
|
Settings.getInstance()
|
||||||
|
.getThemes()
|
||||||
|
.get(Settings.getInstance().getCurrentTheme())
|
||||||
|
.getInteractableBackgroundColor(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getMessageColorChat(),
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getMessageColorChat(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getDateColorChat(),
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getDateColorChat(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getSelectionColor(),
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getSelectionColor(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getTypingMessageColor(),
|
Settings.getInstance()
|
||||||
|
.getThemes()
|
||||||
|
.get(Settings.getInstance().getCurrentTheme())
|
||||||
|
.getTypingMessageColor(),
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getUserNameColor());
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getUserNameColor());
|
||||||
|
|
||||||
colorsPanel.removeAll();
|
colorsPanel.removeAll();
|
||||||
@ -465,7 +513,8 @@ public class SettingsScreen extends JDialog {
|
|||||||
|
|
||||||
private void setContent(JPanel content, GridBagConstraints layout) { contentPanel.add(content, layout); }
|
private void setContent(JPanel content, GridBagConstraints layout) { contentPanel.add(content, layout); }
|
||||||
|
|
||||||
private void buildCustomizeElement(JPanel panel, JButton button, JTextPane textPane, Theme theme, Color color, String name, int yIndex) {
|
private void buildCustomizeElement(JPanel panel, JButton button, JTextPane textPane, Theme theme, Color color,
|
||||||
|
String name, int yIndex) {
|
||||||
textPane.setFont(new Font("Arial", Font.PLAIN, 14));
|
textPane.setFont(new Font("Arial", Font.PLAIN, 14));
|
||||||
textPane.setBackground(theme.getBackgroundColor());
|
textPane.setBackground(theme.getBackgroundColor());
|
||||||
textPane.setForeground(theme.getUserNameColor());
|
textPane.setForeground(theme.getUserNameColor());
|
||||||
@ -497,7 +546,7 @@ public class SettingsScreen extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("An error occured while opening Color Chooser: " + e);
|
logger.info("An error occured while opening Color Chooser: " + e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,6 @@ import java.awt.Color;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Project: <strong>envoy-client</strong><br>
|
* Project: <strong>envoy-client</strong><br>
|
||||||
* File: <strong>Theme.java</strong><br>
|
* File: <strong>Theme.java</strong><br>
|
||||||
* Created: <strong>23 Nov 2019</strong><br>
|
* Created: <strong>23 Nov 2019</strong><br>
|
||||||
@ -50,26 +49,70 @@ public class Theme implements Serializable {
|
|||||||
other.typingMessageColor, other.userNameColor);
|
other.typingMessageColor, other.userNameColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the theme
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public String getThemeName() { return themeName; }
|
public String getThemeName() { return themeName; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return interactableForegroundColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getInteractableForegroundColor() { return interactableForegroundColor; }
|
public Color getInteractableForegroundColor() { return interactableForegroundColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return messageColorChat
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getMessageColorChat() { return messageColorChat; }
|
public Color getMessageColorChat() { return messageColorChat; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return dateColorChat
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getDateColorChat() { return dateColorChat; }
|
public Color getDateColorChat() { return dateColorChat; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return selectionColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getSelectionColor() { return selectionColor; }
|
public Color getSelectionColor() { return selectionColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return typingMessageColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getTypingMessageColor() { return typingMessageColor; }
|
public Color getTypingMessageColor() { return typingMessageColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return backgroundColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getBackgroundColor() { return backgroundColor; }
|
public Color getBackgroundColor() { return backgroundColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return cellColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getCellColor() { return cellColor; }
|
public Color getCellColor() { return cellColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return interactableBackgroundColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getInteractableBackgroundColor() { return interactableBackgroundColor; }
|
public Color getInteractableBackgroundColor() { return interactableBackgroundColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return userNameColor
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color getUserNameColor() { return userNameColor; }
|
public Color getUserNameColor() { return userNameColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a color array containing all colors of this theme
|
||||||
|
* @since Envoy v0.2-alpha
|
||||||
|
*/
|
||||||
public Color[] getAllColors() {
|
public Color[] getAllColors() {
|
||||||
Color[] c = new Color[9];
|
Color[] c = new Color[9];
|
||||||
c[0] = backgroundColor;
|
c[0] = backgroundColor;
|
||||||
@ -85,6 +128,24 @@ public class Theme implements Serializable {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the a specific {@link Color} in this theme to a new {@link Color}
|
||||||
|
*
|
||||||
|
* @param index - index of the color </br>
|
||||||
|
* 0 = backgroundColor </br>
|
||||||
|
* 1 = cellColor </br>
|
||||||
|
* 2 = interactableForegroundColor </br>
|
||||||
|
* 3 = interactableBackgroundColor </br>
|
||||||
|
* 4 = messageColorChat </br>
|
||||||
|
* 5 = dateColorChat </br>
|
||||||
|
* 6 = selectionColor </br>
|
||||||
|
* 7 = typingMessageColor </br>
|
||||||
|
* 8 = userNameColor </br>
|
||||||
|
* </br>
|
||||||
|
*
|
||||||
|
* @param newColor - new {@link Color} to be set
|
||||||
|
* @since Envoy 0.2-alpha
|
||||||
|
*/
|
||||||
public void setColor(int index, Color newColor) {
|
public void setColor(int index, Color newColor) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -114,7 +175,6 @@ public class Theme implements Serializable {
|
|||||||
case 8:
|
case 8:
|
||||||
this.userNameColor = newColor;
|
this.userNameColor = newColor;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ public class UserListRenderer extends JLabel implements ListCellRenderer<User> {
|
|||||||
|
|
||||||
// Getting the UserNameColor of the current theme
|
// Getting the UserNameColor of the current theme
|
||||||
String textColor = null;
|
String textColor = null;
|
||||||
|
|
||||||
textColor = toHex(
|
textColor = toHex(
|
||||||
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getUserNameColor());
|
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getUserNameColor());
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
Reference in New Issue
Block a user