Search in sources :

Example 6 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class Channels method addChannel.

/**
 * Adds a channel with the given name. If the default channel is still there
 * it is used for this channel and renamed.
 *
 * @param channelName
 * @param type
 * @return
 */
public Channel addChannel(Room room, Channel.Type type) {
    if (channels.get(room.getChannel()) != null) {
        return null;
    }
    Channel panel;
    if (defaultChannel != null) {
        // Reuse default channel
        panel = defaultChannel;
        defaultChannel = null;
        panel.setType(type);
        panel.setRoom(room);
        channelChanged();
    } else {
        // No default channel, so create a new one
        panel = createChannel(room, type);
        tabs.addTab(panel);
        if (type != Channel.Type.WHISPER) {
            tabs.setSelectedComponent(panel);
        }
    }
    channels.put(room.getChannel(), panel);
    return panel;
}
Also used : Channel(chatty.gui.components.Channel)

Example 7 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class Channels method removeChannel.

public void removeChannel(final String channelName) {
    Channel channel = channels.get(channelName);
    if (channel == null) {
        return;
    }
    channels.remove(channelName);
    closePopout(channel);
    tabs.removeTab(channel);
    channel.cleanUp();
    if (tabs.getTabCount() == 0) {
        if (dialogs.isEmpty() || !closeLastChannelPopout) {
            addDefaultChannel();
        } else {
            closePopout(dialogs.keySet().iterator().next());
        }
        lastActiveChannel = null;
        channelChanged();
        gui.updateState();
    }
}
Also used : Channel(chatty.gui.components.Channel)

Example 8 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class MainGui method addUser.

// User stuff
/**
 * Adds a user to a channel, adding to the userlist
 *
 * @param channel
 * @param user
 */
public void addUser(final User user) {
    SwingUtilities.invokeLater(() -> {
        if (shouldUpdateUser(user)) {
            Channel c = channels.getChannel(user.getRoom());
            c.addUser(user);
            if (channels.getActiveChannel() == c) {
                state.update();
            }
        }
    });
}
Also used : Channel(chatty.gui.components.Channel)

Example 9 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class MainGui method printLineByOwnerChannel.

public void printLineByOwnerChannel(final String channel, final String text) {
    SwingUtilities.invokeLater(() -> {
        for (Channel chan : channels.getExistingChannelsByOwner(channel)) {
            chan.printLine(text);
            client.chatLog.info(chan.getFilename(), text);
        }
    });
}
Also used : Channel(chatty.gui.components.Channel)

Aggregations

Channel (chatty.gui.components.Channel)9 User (chatty.User)1 CommandActionEvent (chatty.gui.components.menus.CommandActionEvent)1 NotificationWindowManager (chatty.gui.notifications.NotificationWindowManager)1 AbstractAction (javax.swing.AbstractAction)1