Package de.novanic.gwteventservice.demo.conversationapp.client.conversation

Examples of de.novanic.gwteventservice.demo.conversationapp.client.conversation.Channel


        if(anEvent instanceof ConversationEvent) {
            ConversationEvent theConversationEvent = (ConversationEvent)anEvent;
            if(isGlobalEvent(theConversationEvent)) {
                return false;
            }
            Channel theChannel = theConversationEvent.getChannel();
            if(theChannel != null) {
                return !myEventChannelName.equals(theChannel.getName());
            }
        }
        return true;
    }
View Full Code Here


        myChannelManager = new ChannelManager();
        myChannelManager.add(GLOBAL_CHANNEL);
    }

    public Channel createChannel(String aContact, String aChannelName) {
        Channel theChannel = myChannelManager.getChannelByName(aChannelName);
        if(theChannel == null) {
            theChannel = myChannelManager.add(aChannelName);
            addEvent(CONVERSATION_DOMAIN, new NewChannelEvent(aContact, theChannel));
            LOG.debug("{} created channel and joined", aContact);
            joinInternal(aChannelName, aContact);
View Full Code Here

        return theChannel;
    }

    public void closeChannel(String aContact, String aChannelName) {
        if(!GLOBAL_CHANNEL.equals(aChannelName)) {
            Channel theChannel = myChannelManager.getChannelByName(aChannelName);
            if(theChannel != null) {
                myChannelManager.remove(theChannel.getName());
                addEvent(CONVERSATION_DOMAIN, new CloseChannelEvent(aContact, theChannel));
            }
        }
    }
View Full Code Here

    }

    public void sendMessage(String aContact, String aMessage) {
        LOG.debug("Server-Message - {}: {}", aContact, aMessage);

        Channel theChannel = myChannelManager.getChannel(aContact);
        addEvent(CONVERSATION_DOMAIN, new NewMessageEvent(aContact, theChannel, aMessage));
    }
View Full Code Here

    }

    private void joinInternal(String aChannelName, String aContact) {
        leaveInternal(aContact);

        Channel theChannel = myChannelManager.join(aChannelName, aContact);
        addEvent(CONVERSATION_DOMAIN, new UserJoinEvent(aContact, theChannel));
        setEventFilter(CONVERSATION_DOMAIN, new ChannelEventFilter(aChannelName));
    }
View Full Code Here

        addEvent(CONVERSATION_DOMAIN, new UserJoinEvent(aContact, theChannel));
        setEventFilter(CONVERSATION_DOMAIN, new ChannelEventFilter(aChannelName));
    }

    private void leaveInternal(String aContact) {
        Channel theChannel = myChannelManager.getChannel(aContact);
        if(theChannel != null) {
            theChannel.removeContact(aContact);
            addEvent(CONVERSATION_DOMAIN, new UserLeaveEvent(aContact, theChannel));
            if(theChannel.getContacts().isEmpty()) {
                closeChannel(aContact, theChannel.getName());
            }
        }
    }
View Full Code Here

    public ChannelManager() {
        myChannels = new TreeMap<String, Channel>();
    }

    public Channel add(String aChannelName) {
        Channel theChannel = new Channel(aChannelName);
        myChannels.put(aChannelName, theChannel);
        return theChannel;
    }
View Full Code Here

    public Channel remove(String aChannelName) {
        return myChannels.remove(aChannelName);
    }

    public Channel join(String aChannelName, String aContact) {
        Channel theChannel = myChannels.get(aChannelName);
        theChannel.addContact(aContact);
        return theChannel;
    }
View Full Code Here

TOP

Related Classes of de.novanic.gwteventservice.demo.conversationapp.client.conversation.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.