Plugins adaptados para a nova versão
This commit is contained in:
1 parent
9fb4952f32
commit
fa696194aa
42 files changed
+274
-106
No files matched your search
@@ -1,6 +1,6 @@
|
||||
#Mon, 17 Aug 2026 14:26:26 -0300
|
||||
#Tue, 29 Sep 2026 11:11:06 -0300
|
||||
|
||||
|
||||
C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi.chat=
|
||||
C\:\\Users\\Gustavo\\OneDrive\\Documentos\\Faculdade\\2026_2\\Monitoria\\pitiupi\\pitiupi.chat=
|
||||
|
||||
C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi=
|
||||
C\:\\Users\\Gustavo\\OneDrive\\Documentos\\Faculdade\\2026_2\\Monitoria\\pitiupi\\pitiupi=
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../pitiupi/dist/pitiupi.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -12,6 +12,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import pitiupi.chat.net.ChatMessage;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.control.ConnectionManager;
|
||||
import pitiupi.net.Message;
|
||||
|
||||
/**
|
||||
@@ -29,10 +30,10 @@ public class ChatWindow extends javax.swing.JDialog {
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JTextArea jTextArea1;
|
||||
|
||||
private final MainWindow mainWindow;
|
||||
private final ConnectionManager connectionManager;
|
||||
|
||||
public ChatWindow(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
public ChatWindow(ConnectionManager connectionManager) {
|
||||
this.connectionManager = connectionManager;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
@@ -94,17 +95,13 @@ public class ChatWindow extends javax.swing.JDialog {
|
||||
if (jTextArea1.getText().trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ChatMessage message = new ChatMessage(mainWindow.getUserName(), jTextArea1.getText());
|
||||
ChatMessage message = new ChatMessage(connectionManager.getUserName(), jTextArea1.getText());
|
||||
this.sendChatMessage(message);
|
||||
jTextArea1.setText("");
|
||||
}
|
||||
|
||||
public void sendChatMessage(Message message) {
|
||||
try {
|
||||
mainWindow.getSocketUDP().sendMulticast(message.toByteArray());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
connectionManager.sendUdpMulticast(message);
|
||||
}
|
||||
|
||||
public void receiveChatMessage(ChatMessage message) {
|
||||
|
||||
@@ -11,6 +11,8 @@ import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.chat.GUI.ChatMenu;
|
||||
import pitiupi.chat.GUI.ChatWindow;
|
||||
import pitiupi.chat.net.ChatMessage;
|
||||
import pitiupi.control.ConnectionManager;
|
||||
import pitiupi.control.GuiManager;
|
||||
import pitiupi.net.Message;
|
||||
import pitiupi.plugin.Plugin;
|
||||
|
||||
@@ -21,16 +23,14 @@ import pitiupi.plugin.Plugin;
|
||||
public class ChatPlugin implements Plugin {
|
||||
|
||||
private ChatWindow chatWindow;
|
||||
private MainWindow mainWindow;
|
||||
|
||||
public ChatPlugin() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPlugin(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
this.chatWindow = new ChatWindow(mainWindow);
|
||||
this.mainWindow.addMenu(new ChatMenu(chatWindow));
|
||||
public void createPlugin(ConnectionManager connectionManager, GuiManager guiManager) {
|
||||
this.chatWindow = new ChatWindow(connectionManager);
|
||||
guiManager.addMenu(new ChatMenu(chatWindow));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,9 +42,7 @@ public class ChatPlugin implements Plugin {
|
||||
if (ois.readObject() instanceof ChatMessage msg) {
|
||||
this.chatWindow.receiveChatMessage(msg);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
System.out.println(ex.toString());
|
||||
} catch (ClassNotFoundException ex) {
|
||||
} catch (IOException | ClassNotFoundException ex) {
|
||||
System.out.println(ex.toString());
|
||||
}
|
||||
}
|
||||
@@ -64,6 +62,11 @@ public class ChatPlugin implements Plugin {
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "Pitiupi.Chat.Example";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message getMessage() {
|
||||
return new ChatMessage();
|
||||
|
||||
Reference in new issue
Block a user