added newline at EOF for any file not having one at its end
This commit is contained in:
		@@ -61,12 +61,10 @@ public class Chat implements Serializable {
 | 
			
		||||
	public void read(WriteProxy writeProxy) throws IOException {
 | 
			
		||||
		for (int i = model.size() - 1; i >= 0; --i) {
 | 
			
		||||
			final Message m = model.get(i);
 | 
			
		||||
			if (m.getSenderId() == recipient.getId()) {
 | 
			
		||||
				if (m.getStatus() == MessageStatus.READ) break;
 | 
			
		||||
				else {
 | 
			
		||||
					m.setStatus(MessageStatus.READ);
 | 
			
		||||
					writeProxy.writeMessageStatusChangeEvent(new MessageStatusChangeEvent(m));
 | 
			
		||||
				}
 | 
			
		||||
			if (m.getSenderId() == recipient.getId()) if (m.getStatus() == MessageStatus.READ) break;
 | 
			
		||||
			else {
 | 
			
		||||
				m.setStatus(MessageStatus.READ);
 | 
			
		||||
				writeProxy.writeMessageStatusChangeEvent(new MessageStatusChangeEvent(m));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -89,4 +87,4 @@ public class Chat implements Serializable {
 | 
			
		||||
	 * @since Envoy v0.1-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public User getRecipient() { return recipient; }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -100,4 +100,4 @@ public class PersistentLocalDb extends LocalDb {
 | 
			
		||||
			idGenerator = SerializationUtils.read(idGeneratorFile, IdGenerator.class);
 | 
			
		||||
		} catch (ClassNotFoundException | IOException e) {}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -190,4 +190,4 @@ public class Settings {
 | 
			
		||||
	 * @since Envoy v0.3-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public Theme getTheme(String themeName) { return themes.get(themeName); }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -85,4 +85,4 @@ public class Receiver extends Thread {
 | 
			
		||||
	 * Removes all object processors registered at this {@link Receiver}.
 | 
			
		||||
	 */
 | 
			
		||||
	public void removeAllProcessors() { processors.clear(); }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -74,4 +74,4 @@ public class ContactsSearchRenderer implements ComponentListCellRenderer<User> {
 | 
			
		||||
 | 
			
		||||
		return panel;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -60,4 +60,4 @@ public class PrimaryButton extends JButton {
 | 
			
		||||
	 * @since Envoy 0.2-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public void setArcSize(int arcSize) { this.arcSize = arcSize; }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ import envoy.client.data.SettingsItem;
 | 
			
		||||
 * Project: <strong>envoy-client</strong><br>
 | 
			
		||||
 * File: <strong>PrimaryToggleSwitch.java</strong><br>
 | 
			
		||||
 * Created: <strong>21 Dec 2019</strong><br>
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author Maximilian Käfer
 | 
			
		||||
 * @author Kai S. K. Engelbart
 | 
			
		||||
 * @since Envoy v0.3-alpha
 | 
			
		||||
@@ -28,7 +28,7 @@ public class PrimaryToggleSwitch extends JButton {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initializes a {@link PrimaryToggleSwitch}.
 | 
			
		||||
	 * 
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param settingsItem the {@link SettingsItem} that is controlled by this
 | 
			
		||||
	 *                     {@link PrimaryToggleSwitch}
 | 
			
		||||
	 * @since Envoy v0.3-alpha
 | 
			
		||||
@@ -54,4 +54,4 @@ public class PrimaryToggleSwitch extends JButton {
 | 
			
		||||
		g.setColor(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getInteractableBackgroundColor());
 | 
			
		||||
		g.fillRoundRect(state ? 25 : 0, 0, 25, 25, 25, 25);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -127,11 +127,9 @@ public class Startup {
 | 
			
		||||
			// Save all users to the local database and flush cache
 | 
			
		||||
			localDb.setUsers(client.getUsers());
 | 
			
		||||
			writeProxy.flushCache();
 | 
			
		||||
		} else {
 | 
			
		||||
 | 
			
		||||
		} else 
 | 
			
		||||
			// Set all contacts to offline mode
 | 
			
		||||
			localDb.getUsers().values().stream().filter(u -> u != localDb.getUser()).forEach(u -> u.setStatus(UserStatus.OFFLINE));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Display ChatWindow and StatusTrayIcon
 | 
			
		||||
		EventQueue.invokeLater(() -> {
 | 
			
		||||
@@ -173,4 +171,4 @@ public class Startup {
 | 
			
		||||
			}
 | 
			
		||||
		}));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -94,4 +94,4 @@ public class StatusTrayIcon {
 | 
			
		||||
			throw new EnvoyException("Could not attach Envoy tray icon to system tray.", e);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -59,4 +59,4 @@ public class UserListRenderer extends JLabel implements ListCellRenderer<User> {
 | 
			
		||||
		}
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -90,4 +90,4 @@ public class GeneralSettingsPanel extends SettingsPanel {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ActionListener getOkButtonAction() { return evt -> {}; }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -42,10 +42,12 @@ public class NewThemeScreen extends JDialog {
 | 
			
		||||
	 * Creates a window, where you can choose a name for a new {@link Theme}. <br>
 | 
			
		||||
	 * There are two versions of this Window. The first one is responsible for
 | 
			
		||||
	 * choosing the name, the second one appears, if the name already exists.
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param parent the dialog is launched with its location relative to this {@link SettingsScreen}
 | 
			
		||||
	 * @param newThemeAction is executed when a new theme name is entered
 | 
			
		||||
	 * @param modifyThemeAction is executed when an existing theme name is entered and confirmed
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param parent            the dialog is launched with its location relative to
 | 
			
		||||
	 *                          this {@link SettingsScreen}
 | 
			
		||||
	 * @param newThemeAction    is executed when a new theme name is entered
 | 
			
		||||
	 * @param modifyThemeAction is executed when an existing theme name is entered
 | 
			
		||||
	 *                          and confirmed
 | 
			
		||||
	 * @since Envoy v0.3-alpha
 | 
			
		||||
	 */
 | 
			
		||||
	public NewThemeScreen(SettingsScreen parent, Consumer<String> newThemeAction, Consumer<String> modifyThemeAction) {
 | 
			
		||||
@@ -223,4 +225,4 @@ public class NewThemeScreen extends JDialog {
 | 
			
		||||
 | 
			
		||||
		overwrite.addActionListener((evt) -> { modifyThemeAction.accept(nameEnterTextArea.getText()); dispose(); });
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -189,4 +189,4 @@ public class SettingsScreen extends JDialog {
 | 
			
		||||
		options.setForeground(theme.getUserNameColor());
 | 
			
		||||
		options.setBackground(theme.getCellColor());
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,6 @@ package envoy.client.ui.settings;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ItemEvent;
 | 
			
		||||
import java.awt.event.ItemListener;
 | 
			
		||||
import java.util.logging.Level;
 | 
			
		||||
import java.util.logging.Logger;
 | 
			
		||||
 | 
			
		||||
@@ -100,17 +98,13 @@ public class ThemeCustomizationPanel extends SettingsPanel {
 | 
			
		||||
		colorsPanel.setBackground(theme.getCellColor());
 | 
			
		||||
 | 
			
		||||
		// Apply theme upon selection
 | 
			
		||||
		themes.addItemListener(new ItemListener() {
 | 
			
		||||
		themes.addItemListener(e -> {
 | 
			
		||||
			String selectedValue = (String) themes.getSelectedItem();
 | 
			
		||||
			logger.log(Level.FINEST, "Selected theme: " + selectedValue);
 | 
			
		||||
 | 
			
		||||
			@Override
 | 
			
		||||
			public void itemStateChanged(ItemEvent e) {
 | 
			
		||||
				String selectedValue = (String) themes.getSelectedItem();
 | 
			
		||||
				logger.log(Level.FINEST, "Selected theme: " + selectedValue);
 | 
			
		||||
 | 
			
		||||
				final Theme currentTheme = Settings.getInstance().getTheme(selectedValue);
 | 
			
		||||
				Settings.getInstance().setCurrentTheme(selectedValue);
 | 
			
		||||
				EventBus.getInstance().dispatch(new ThemeChangeEvent(currentTheme));
 | 
			
		||||
			}
 | 
			
		||||
			final Theme currentTheme = Settings.getInstance().getTheme(selectedValue);
 | 
			
		||||
			Settings.getInstance().setCurrentTheme(selectedValue);
 | 
			
		||||
			EventBus.getInstance().dispatch(new ThemeChangeEvent(currentTheme));
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		// Apply current theme
 | 
			
		||||
@@ -143,11 +137,9 @@ public class ThemeCustomizationPanel extends SettingsPanel {
 | 
			
		||||
				}, name -> {
 | 
			
		||||
					// Modify theme
 | 
			
		||||
					Settings.getInstance().getThemes().replace(name, new Theme(name, temporaryTheme));
 | 
			
		||||
					if (themes.getSelectedItem().equals(name)) {
 | 
			
		||||
					if (themes.getSelectedItem().equals(name))
 | 
			
		||||
						EventBus.getInstance().dispatch(new ThemeChangeEvent(Settings.getInstance().getTheme(name)));
 | 
			
		||||
					} else {
 | 
			
		||||
						themes.setSelectedItem(name);
 | 
			
		||||
					}
 | 
			
		||||
					else themes.setSelectedItem(name);
 | 
			
		||||
				}).setVisible(true);
 | 
			
		||||
				themeChanged = false;
 | 
			
		||||
			}
 | 
			
		||||
@@ -232,4 +224,4 @@ public class ThemeCustomizationPanel extends SettingsPanel {
 | 
			
		||||
 | 
			
		||||
		colorsPanel.add(button, gbc_button);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user