001package csheets.ext.share.controller;
002
003import java.util.*;
004
005import csheets.core.Cell;
006import csheets.ext.share.core.*;
007
008/**
009 * Controller of the receive action
010 * 
011 * @author Andre
012 * 
013 */
014public class ReceiveController {
015
016        /**
017         * Method that will create a new client and will start the connection
018         * 
019         * @param IP
020         *            the server ip
021         * @param port
022         *            the connection port of the server
023         * @param cellStart
024         *            cell where we paste the content of the shared cells
025         * @param password
026         *            the connection password
027         * @param observer
028         *            the observer class
029         */
030        public void startClient(String IP, int port, Cell cellStart,
031                        String password, Observer observer) {
032                Client cli = new Client();
033                cli.startClient(IP, port, cellStart, password, observer);
034        }
035
036        /**
037         * Find a servers that have an active sharing
038         * 
039         * @param observer
040         *            the observer class
041         * @return a list of servers with active sharing
042         */
043        public List<Connections> findServers(Observer observer) {
044                return ClientDiscover.getInstance().findServers(observer);
045        }
046
047        /**
048         * Method that will create a new client and will start the connection
049         * 
050         * @param connection
051         *            the connection details
052         * @param cellStart
053         *            cell where we paste the content of the shared cells
054         * @param observer
055         *            the observer class
056         * @param password
057         *            the password connection
058         */
059        public void startClient(Connections connection, Cell cellStart,
060                        Observer observer, String password) {
061                Client cli = new Client();
062                cli.startClient(connection, cellStart, observer, password);
063        }
064
065}