Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe1c8d24b9 |
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Thu, 16 Jul 2026 15:21:39 -0300
|
||||
#Thu, 16 Jul 2026 17:43:45 -0300
|
||||
|
||||
|
||||
/home/flavio/NetBeansProjects/pitiupi.screenCast=
|
||||
/home/perolanegra/facul/2.26/fls/pitiupi/pitiupi.screenCast=
|
||||
|
||||
/home/flavio/NetBeansProjects/pitiupi=
|
||||
/home/perolanegra/facul/2.26/fls/pitiupi/pitiupi=
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -45,8 +45,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}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# NetBeans
|
||||
/build/
|
||||
/dist/
|
||||
/nbproject/private/
|
||||
|
||||
# Java compilado
|
||||
*.class
|
||||
|
||||
# JARs gerados
|
||||
*.jar
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,7 +11,7 @@ JAR files manifest file (MANIFEST.MF).
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "pitiupi.screenCast.jar"
|
||||
java -jar "pitiupi.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
Vendored
BIN
Binary file not shown.
@@ -5,4 +5,4 @@ do.jlink=false
|
||||
javac.debug=true
|
||||
javadoc.preview=true
|
||||
jlink.strip=false
|
||||
user.properties.file=/home/flavio/snap/netbeans/145/build.properties
|
||||
user.properties.file=/home/perolanegra/snap/netbeans/145/build.properties
|
||||
@@ -2,9 +2,6 @@
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/home/flavio/NetBeansProjects/pitiupi/src/pitiupi/control/PluginManager.java</file>
|
||||
<file>file:/home/flavio/NetBeansProjects/pitiupi/src/pitiupi/control/ImageTransformation.java</file>
|
||||
</group>
|
||||
<group/>
|
||||
</open-files>
|
||||
</project-private>
|
||||
@@ -46,8 +46,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}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../pitiupi.screenCast/dist/pitiupi.screenCast.jar
|
||||
@@ -22,7 +22,6 @@ import javax.swing.JTextField;
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public final class Login extends JDialog {
|
||||
|
||||
@@ -83,17 +82,10 @@ public final class Login extends JDialog {
|
||||
this.add(topPanel);
|
||||
this.add(buttonPanel, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
okButton.addActionListener((ActionEvent e) -> {
|
||||
try {
|
||||
portField.commitEdit();
|
||||
} catch (java.text.ParseException ex) {
|
||||
return;
|
||||
}
|
||||
Login.this.setVisible(false);
|
||||
});
|
||||
|
||||
|
||||
cancelButton.addActionListener((ActionEvent e) -> {
|
||||
System.exit(0);
|
||||
});
|
||||
|
||||
@@ -16,7 +16,6 @@ import pitiupi.control.HeartbeatManager;
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public class MainWindow extends javax.swing.JFrame {
|
||||
|
||||
@@ -25,15 +24,13 @@ public class MainWindow extends javax.swing.JFrame {
|
||||
private javax.swing.JLabel status;
|
||||
private javax.swing.JPanel statusPanel;
|
||||
private javax.swing.JTabbedPane tabbedPane;
|
||||
|
||||
private HeartbeatManager heartbeatManager;
|
||||
private OnlineUsersPanel onlineUsersPanel;
|
||||
|
||||
|
||||
private Socket socket;
|
||||
|
||||
private String userName;
|
||||
private int port;
|
||||
private final String userName;
|
||||
private final int port;
|
||||
|
||||
private PluginLoader pluginManager;
|
||||
private final List<Plugin> plugins;
|
||||
@@ -69,7 +66,7 @@ public class MainWindow extends javax.swing.JFrame {
|
||||
|
||||
this.socket = new Socket(this);
|
||||
this.socket.start();
|
||||
|
||||
|
||||
this.heartbeatManager = new HeartbeatManager(this);
|
||||
this.onlineUsersPanel = new OnlineUsersPanel();
|
||||
this.heartbeatManager.addPeerListener(this.onlineUsersPanel);
|
||||
@@ -111,28 +108,4 @@ public class MainWindow extends javax.swing.JFrame {
|
||||
public List<Plugin> getPlugins() {
|
||||
return plugins;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
reconnect();
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void updateStatus() {
|
||||
this.status.setText("Connected on port " + this.port + " name " + this.userName);
|
||||
}
|
||||
|
||||
private void reconnect() {
|
||||
if (this.socket != null) {
|
||||
this.socket.close();
|
||||
}
|
||||
this.socket = new Socket(this);
|
||||
this.socket.start();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import javax.swing.JMenuBar;
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*
|
||||
*/
|
||||
public class MenuBar extends JMenuBar {
|
||||
|
||||
@@ -58,14 +56,9 @@ public class MenuBar extends JMenuBar {
|
||||
mainWindow.exit();
|
||||
}
|
||||
|
||||
|
||||
private void setupMenuActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
private void setupMenuActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
Login login = new Login();
|
||||
login.setVisible(true);
|
||||
|
||||
mainWindow.setUserName(login.getName());
|
||||
mainWindow.setPort(login.getPort());
|
||||
|
||||
login.dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,7 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import pitiupi.control.PeerInfo;
|
||||
import pitiupi.control.PeerListener;
|
||||
/**
|
||||
*
|
||||
* @author tony
|
||||
*/
|
||||
|
||||
public class OnlineUsersPanel extends JPanel implements PeerListener {
|
||||
|
||||
private final DefaultListModel<String> listModel;
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.logging.Logger;
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
@@ -41,17 +40,16 @@ public class Main {
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(pitiupi.GUI.MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pitiupi.GUI.Login login = new pitiupi.GUI.Login();
|
||||
login.setVisible(true);
|
||||
|
||||
pitiupi.GUI.MainWindow main;
|
||||
main = new pitiupi.GUI.MainWindow(login.getName(), login.getPort());
|
||||
main = new pitiupi.GUI.MainWindow(System.getProperty("user.name"), 8000);
|
||||
main.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.net.HeartbeatMessage;
|
||||
/**
|
||||
*
|
||||
* @author tony
|
||||
*/
|
||||
|
||||
public class HeartbeatManager {
|
||||
|
||||
private static final long HEARTBEAT_INTERVAL_MS = 5000;
|
||||
@@ -55,7 +52,7 @@ public class HeartbeatManager {
|
||||
|
||||
// Chamado pelo Socket quando um pacote é identificado como heartbeat
|
||||
public void receiveHeartbeat(HeartbeatMessage msg, InetAddress from) {
|
||||
// ignora o próprio heartbeat
|
||||
// ignora o próprio heartbeat (multicast normalmente ecoa pro remetente)
|
||||
if (msg.getUserName().equals(mainWindow.getUserName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package pitiupi.control;
|
||||
|
||||
import java.net.InetAddress;
|
||||
/**
|
||||
*
|
||||
* @author tony
|
||||
*/
|
||||
|
||||
public class PeerInfo {
|
||||
|
||||
private final String userName;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package pitiupi.control;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
* @author tony
|
||||
*/
|
||||
|
||||
public interface PeerListener {
|
||||
void onPeersChanged(List<PeerInfo> peers);
|
||||
}
|
||||
@@ -15,10 +15,11 @@ import java.util.Vector;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.Main;
|
||||
import pitiupi.plugin.Plugin;
|
||||
|
||||
import pitiupi.plugin.PitiupiFacade;
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public class PluginLoader {
|
||||
|
||||
@@ -55,12 +56,14 @@ public class PluginLoader {
|
||||
// 4. Locate and instantiate all classes implementing the Plugin interface
|
||||
ServiceLoader<Plugin> serviceLoader = ServiceLoader.load(Plugin.class, pluginClassLoader);
|
||||
|
||||
System.out.println("\n--- Executing Discovered Plugins ---" + serviceLoader.findFirst());
|
||||
for (Plugin plugin : serviceLoader) {
|
||||
System.out.println("Loading: " + plugin.getName());
|
||||
plugin.createPlugin(this.mainWindow);
|
||||
this.mainWindow.getPlugins().add(plugin);
|
||||
}
|
||||
PitiupiFacade facade = new PitiupiFacade(this.mainWindow);
|
||||
|
||||
System.out.println("\n--- Executing Discovered Plugins ---" + serviceLoader.findFirst());
|
||||
for (Plugin plugin : serviceLoader) {
|
||||
System.out.println("Loading: " + plugin.getName());
|
||||
plugin.createPlugin(facade);
|
||||
this.mainWindow.getPlugins().add(plugin);
|
||||
}
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
System.out.println(e.toString());
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package pitiupi.net;
|
||||
/**
|
||||
*
|
||||
* @author tony
|
||||
*/
|
||||
|
||||
public class HeartbeatMessage extends Message {
|
||||
|
||||
private final String userName;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
Line truncated
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
|
||||
@@ -17,8 +17,9 @@ import java.net.UnknownHostException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import pitiupi.plugin.Plugin;
|
||||
import pitiupi.net.HeartbeatMessage;
|
||||
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.InetSocketAddress;
|
||||
import pitiupi.net.HeartbeatMessage; // lib
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
@@ -29,7 +30,6 @@ public class Socket extends Thread {
|
||||
private MulticastSocket multicastSocket;
|
||||
private InetAddress address;
|
||||
private MainWindow main;
|
||||
private volatile boolean running = true;
|
||||
public final static String INET_ADDR = "224.0.0.3";
|
||||
|
||||
public Socket(MainWindow main) {
|
||||
@@ -44,7 +44,45 @@ public class Socket extends Thread {
|
||||
multicastSocket.setSendBufferSize(256000);
|
||||
multicastSocket.setReceiveBufferSize(256000);
|
||||
multicastSocket.setReuseAddress(true);
|
||||
multicastSocket.joinGroup(address);
|
||||
System.out.println("Endereço local: " + multicastSocket.getLocalAddress());
|
||||
System.out.println("Interface: " + multicastSocket.getNetworkInterface());
|
||||
//InetAddress local = InetAddress.getLocalHost();
|
||||
|
||||
NetworkInterface nif = null;
|
||||
|
||||
for (NetworkInterface ni : java.util.Collections.list(
|
||||
NetworkInterface.getNetworkInterfaces())) {
|
||||
|
||||
if (ni.isUp()
|
||||
&& ni.supportsMulticast()
|
||||
&& !ni.isLoopback()) {
|
||||
|
||||
nif = ni;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nif != null) {
|
||||
System.out.println("Interface escolhida:");
|
||||
System.out.println("Nome: " + nif.getName());
|
||||
System.out.println("Descrição: " + nif.getDisplayName());
|
||||
System.out.println("Ativa: " + nif.isUp());
|
||||
System.out.println("Multicast: " + nif.supportsMulticast());
|
||||
|
||||
System.out.println("Endereços IP:");
|
||||
|
||||
for (InetAddress ip : java.util.Collections.list(nif.getInetAddresses())) {
|
||||
System.out.println(" " + ip.getHostAddress());
|
||||
}
|
||||
} else {
|
||||
System.out.println("Nenhuma interface multicast encontrada");
|
||||
}
|
||||
multicastSocket.joinGroup(
|
||||
new InetSocketAddress(address, main.getPort()),
|
||||
nif
|
||||
);
|
||||
System.out.println("nif: " + nif);
|
||||
|
||||
// multicastSocket.joinGroup(address);
|
||||
} catch (IOException ex) {
|
||||
System.out.println("There is no socket connection. Sorry.");
|
||||
System.out.println(ex.toString());
|
||||
@@ -54,38 +92,27 @@ public class Socket extends Thread {
|
||||
public void send(byte[] msg) throws IOException {
|
||||
DatagramPacket msgPacket;
|
||||
msgPacket = new DatagramPacket(msg, msg.length, this.address, this.main.getPort());
|
||||
|
||||
System.out.println("Enviando pacote");
|
||||
System.out.println("Destino: " + address);
|
||||
System.out.println("Porta: " + this.main.getPort());
|
||||
System.out.println("Bytes: " + msg.length);
|
||||
|
||||
multicastSocket.send(msgPacket);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
running = false;
|
||||
if (multicastSocket != null) {
|
||||
try {
|
||||
multicastSocket.leaveGroup(address);
|
||||
} catch (IOException ex) {
|
||||
|
||||
}
|
||||
multicastSocket.close();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
public void receive() throws UnknownHostException, IOException, ClassNotFoundException {
|
||||
byte[] buf = new byte[256000];
|
||||
while (running) {
|
||||
while (true) {
|
||||
DatagramPacket msgPacket = new DatagramPacket(buf, buf.length);
|
||||
try {
|
||||
multicastSocket.receive(msgPacket);
|
||||
} catch (IOException ex) {
|
||||
if (!running) {
|
||||
break;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
multicastSocket.receive(msgPacket);
|
||||
|
||||
HeartbeatMessage heartbeat = tryParseHeartbeat(msgPacket.getData());
|
||||
if (heartbeat != null) {
|
||||
main.getHeartbeatManager().receiveHeartbeat(heartbeat, msgPacket.getAddress());
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Plugin plugin : main.getPlugins()) {
|
||||
System.out.println(msgPacket.getAddress().toString());
|
||||
plugin.receiveMessage(msgPacket.getData());
|
||||
@@ -93,8 +120,6 @@ public class Socket extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private HeartbeatMessage tryParseHeartbeat(byte[] data) {
|
||||
try {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(data);
|
||||
@@ -105,7 +130,7 @@ public class Socket extends Thread {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package pitiupi.plugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.swing.JMenu;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.net.Message;
|
||||
|
||||
public class PitiupiFacade {
|
||||
|
||||
private final MainWindow mainWindow;
|
||||
|
||||
public PitiupiFacade(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
}
|
||||
|
||||
public void addMenu(JMenu menu) {
|
||||
mainWindow.addMenu(menu);
|
||||
}
|
||||
|
||||
public void send(Message message) {
|
||||
try {
|
||||
mainWindow.getSocket().send(message.toByteArray());
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Falha ao enviar mensagem: " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return mainWindow.getUserName();
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return mainWindow.getPort();
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,19 @@
|
||||
*/
|
||||
package pitiupi.plugin;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import pitiupi.GUI.MainWindow;
|
||||
import pitiupi.net.Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author flavio
|
||||
* @author tony
|
||||
*/
|
||||
public interface Plugin {
|
||||
|
||||
public String getName();
|
||||
public String getAuthor();
|
||||
public String getVersion();
|
||||
public void createPlugin(MainWindow window);
|
||||
public void createPlugin(PitiupiFacade pitiupi);
|
||||
public Message getMessage();
|
||||
public void receiveMessage(byte[] message);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user