Implementa facade
This commit is contained in:
1 parent
fa691e6704
commit
fe1c8d24b9
50 files changed
+366
-88
No files matched your search
@@ -1,6 +1,6 @@
|
||||
#Thu, 16 Jul 2026 15:21:36 -0300
|
||||
#Fri, 17 Jul 2026 17:31:55 -0300
|
||||
|
||||
|
||||
/home/flavio/NetBeansProjects/pitiupi.chat=
|
||||
/home/perolanegra/facul/pitiupi/pitiupi.chat=
|
||||
|
||||
/home/flavio/NetBeansProjects/pitiupi=
|
||||
/home/perolanegra/facul/pitiupi/pitiupi=
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -47,8 +47,8 @@ javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=25
|
||||
javac.target=25
|
||||
javac.source=21
|
||||
javac.target=21
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
|
||||
@@ -5,18 +5,16 @@
|
||||
*/
|
||||
package pitiupi.chat.GUI;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import pitiupi.chat.net.ChatMessage;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.plugin.PitiupiFacade;
|
||||
import pitiupi.net.Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public class ChatWindow extends javax.swing.JDialog {
|
||||
|
||||
@@ -29,10 +27,10 @@ public class ChatWindow extends javax.swing.JDialog {
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JTextArea jTextArea1;
|
||||
|
||||
private final MainWindow mainWindow;
|
||||
private final PitiupiFacade pitiupi;
|
||||
|
||||
public ChatWindow(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
public ChatWindow(PitiupiFacade pitiupi) {
|
||||
this.pitiupi = pitiupi;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
@@ -94,17 +92,13 @@ public class ChatWindow extends javax.swing.JDialog {
|
||||
if (jTextArea1.getText().trim().length() == 0) {
|
||||
return;
|
||||
}
|
||||
ChatMessage message = new ChatMessage(mainWindow.getName(), jTextArea1.getText());
|
||||
ChatMessage message = new ChatMessage(pitiupi.getUserName(), jTextArea1.getText());
|
||||
this.sendChatMessage(message);
|
||||
jTextArea1.setText("");
|
||||
}
|
||||
|
||||
public void sendChatMessage(Message message) {
|
||||
try {
|
||||
mainWindow.getSocket().send(message.toByteArray());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
pitiupi.send(message);
|
||||
}
|
||||
|
||||
public void receiveChatMessage(ChatMessage message) {
|
||||
|
||||
@@ -7,7 +7,7 @@ package pitiupi.chat.plugin;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.plugin.PitiupiFacade;
|
||||
import pitiupi.chat.GUI.ChatMenu;
|
||||
import pitiupi.chat.GUI.ChatWindow;
|
||||
import pitiupi.chat.net.ChatMessage;
|
||||
@@ -17,20 +17,18 @@ import pitiupi.plugin.Plugin;
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public class ChatPlugin implements Plugin {
|
||||
|
||||
private ChatWindow chatWindow;
|
||||
private MainWindow mainWindow;
|
||||
|
||||
public ChatPlugin() {
|
||||
}
|
||||
private PitiupiFacade pitiupi;
|
||||
|
||||
@Override
|
||||
public void createPlugin(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
this.chatWindow = new ChatWindow(mainWindow);
|
||||
this.mainWindow.addMenu(new ChatMenu(chatWindow));
|
||||
public void createPlugin(PitiupiFacade pitiupi) {
|
||||
this.pitiupi = pitiupi;
|
||||
this.chatWindow = new ChatWindow(pitiupi);
|
||||
this.pitiupi.addMenu(new ChatMenu(chatWindow));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user