Search in sources :

Example 1 with GroupChatParticipantList

use of org.jivesoftware.spark.ui.conferences.GroupChatParticipantList in project Spark by igniterealtime.

the class Workpane method addRoomInfo.

private void addRoomInfo(final String sessionID, final RequestUtils utils, final ChatRoom room) {
    final JTabbedPane tabbedPane = new JTabbedPane();
    GroupChatParticipantList participantList = ((GroupChatRoom) room).getConferenceRoomInfo();
    room.getSplitPane().setRightComponent(tabbedPane);
    Form form = null;
    try {
        form = FastpathPlugin.getWorkgroup().getWorkgroupForm();
    } catch (XMPPException | SmackException e) {
        Log.error(e);
        return;
    }
    final BackgroundPane transcriptAlert = new BackgroundPane() {

        public Dimension getPreferredSize() {
            final Dimension size = super.getPreferredSize();
            size.width = 0;
            return size;
        }
    };
    transcriptAlert.setLayout(new GridBagLayout());
    JLabel userImage = new JLabel(FastpathRes.getImageIcon(FastpathRes.FASTPATH_IMAGE_24x24));
    userImage.setHorizontalAlignment(JLabel.LEFT);
    userImage.setText(utils.getUsername());
    transcriptAlert.add(userImage, new GridBagConstraints(0, 0, 4, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    userImage.setFont(new Font("Dialog", Font.BOLD, 12));
    final RoomInformation roomInformation = new RoomInformation();
    roomInformation.showFormInformation(form, utils);
    final UserHistory userHistory = new UserHistory(utils.getUserID());
    final JScrollPane userScroll = new JScrollPane(roomInformation);
    final JScrollPane historyScroll = new JScrollPane(userHistory);
    historyScroll.getVerticalScrollBar().setBlockIncrement(50);
    historyScroll.getVerticalScrollBar().setUnitIncrement(20);
    tabbedPane.addTab(FpRes.getString("tab.user.info"), userScroll);
    tabbedPane.addTab(FpRes.getString("tab.participants"), participantList);
    tabbedPane.addTab(FpRes.getString("tab.user.history"), historyScroll);
    final Notes notes = new Notes(sessionID, room);
    tabbedPane.addTab(FpRes.getString("tab.notes"), notes);
    tabbedPane.addChangeListener(new ChangeListener() {

        boolean loaded;

        public void stateChanged(ChangeEvent e) {
            if (!loaded) {
                if (tabbedPane.getSelectedComponent() == historyScroll) {
                    userHistory.loadHistory();
                    loaded = true;
                }
            }
        }
    });
    final GroupChatRoom groupRoom = (GroupChatRoom) room;
    room.getTranscriptWindow().clear();
    final ChatFrame frame = SparkManager.getChatManager().getChatContainer().getChatFrame();
    if (frame != null) {
        int height = frame.getHeight();
        int width = frame.getWidth();
        if (height < 400) {
            height = 400;
        }
        if (width < 600) {
            width = 600;
        }
        frame.setSize(width, height);
        frame.validate();
        frame.repaint();
    }
    fireFastPathChatOpened(room, sessionID, utils, tabbedPane);
    DataManager.getInstance().setMetadataForRoom(room, utils.getMetadata());
}
Also used : GroupChatParticipantList(org.jivesoftware.spark.ui.conferences.GroupChatParticipantList) Form(org.jivesoftware.smackx.xdata.Form) SmackException(org.jivesoftware.smack.SmackException) GroupChatRoom(org.jivesoftware.spark.ui.rooms.GroupChatRoom) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) XMPPException(org.jivesoftware.smack.XMPPException)

Aggregations

ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 SmackException (org.jivesoftware.smack.SmackException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 Form (org.jivesoftware.smackx.xdata.Form)1 GroupChatParticipantList (org.jivesoftware.spark.ui.conferences.GroupChatParticipantList)1 GroupChatRoom (org.jivesoftware.spark.ui.rooms.GroupChatRoom)1