Search in sources :

Example 6 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class JabberBrowser method display.

public void display() {
    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new GridBagLayout());
    // Setup resource
    ResourceUtils.resLabel(addressLabel, addressField, Res.getString("label.jabber.address") + ":");
    RolloverButton backButton = new RolloverButton();
    backButton.setIcon(SparkRes.getImageIcon(SparkRes.LEFT_ARROW_IMAGE));
    backButton.addActionListener(e -> {
        int selectedItem = addressField.getSelectedIndex();
        if (selectedItem > 0) {
            Object historyItem = addressField.getItemAt(selectedItem - 1);
            browse((String) historyItem);
        }
    });
    mainPanel.add(backButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    mainPanel.add(addressLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    mainPanel.add(addressField, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    JButton browseButton = new JButton("");
    ResourceUtils.resButton(browseButton, Res.getString("button.browse"));
    browseButton.addActionListener(e -> {
        String serviceName = (String) addressField.getSelectedItem();
        if (!ModelUtil.hasLength(serviceName)) {
            return;
        }
        browse(serviceName);
    });
    mainPanel.add(addressField, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    mainPanel.add(browseButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    browsePanel = new JPanel();
    browsePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    browsePanel.setBackground(Color.white);
    JScrollPane pane = new JScrollPane(browsePanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    browsePanel.setPreferredSize(new Dimension(0, 0));
    mainPanel.add(pane, new GridBagConstraints(0, 1, 4, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
    JFrame frame = new JFrame();
    frame.setIconImage(SparkRes.getImageIcon(SparkRes.FIND_IMAGE).getImage());
    JDialog dialog = new JDialog(frame, Res.getString("title.jabber.browser"));
    dialog.getContentPane().setLayout(new BorderLayout());
    dialog.getContentPane().add(mainPanel, BorderLayout.CENTER);
    dialog.pack();
    dialog.setSize(600, 400);
    dialog.setLocationRelativeTo(SparkManager.getMainWindow());
    dialog.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) RolloverButton(org.jivesoftware.spark.component.RolloverButton) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) JDialog(javax.swing.JDialog)

Example 7 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class Workpane method addButtons.

private void addButtons(final String sessionID, final RequestUtils utils, final ChatRoom room) {
    final ChatRoomButton inviteButton = new ChatRoomButton(FastpathRes.getImageIcon(FastpathRes.CHAT_INVITE_IMAGE_24x24));
    final ChatRoomButton transferButton = new ChatRoomButton(FastpathRes.getImageIcon(FastpathRes.CHAT_TRANSFER_IMAGE_24x24));
    final RolloverButton cannedResponses = new RolloverButton(FastpathRes.getImageIcon(FastpathRes.DOWN_ARROW_IMAGE));
    final ChatRoomButton endButton = new ChatRoomButton(FastpathRes.getImageIcon(FastpathRes.CHAT_ENDED_IMAGE_24x24));
    final ChatRoomButton cobrowseButton = new ChatRoomButton(FastpathRes.getImageIcon(FastpathRes.CHAT_COBROWSE_IMAGE_24x24));
    // Set tooltips
    inviteButton.setToolTipText("Invite another user to join in this conversation.");
    transferButton.setToolTipText("Transfer this conversation to another agent.");
    endButton.setToolTipText("End this conversation.");
    cobrowseButton.setToolTipText("Start a co-browsing session with this user.");
    // Update Canned Response button.
    ResourceUtils.resButton(cannedResponses, FpRes.getString("button.canned.responses"));
    room.getToolBar().addChatRoomButton(inviteButton);
    room.getToolBar().addChatRoomButton(transferButton);
    room.getToolBar().addChatRoomButton(cobrowseButton);
    room.getToolBar().addChatRoomButton(endButton);
    inviteButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            inviteOrTransfer(room, utils.getWorkgroup(), sessionID, false);
        }
    });
    cobrowseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            CoBrowser browser = new CoBrowser(sessionID, room);
            browser.showDialog();
        }
    });
    transferButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            inviteOrTransfer(room, utils.getWorkgroup(), sessionID, true);
        }
    });
    room.getEditorBar().add(cannedResponses);
    cannedResponses.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            final ChatMacroMenu chatMacroMenu = new ChatMacroMenu(room);
            chatMacroMenu.show(cannedResponses, e.getX(), e.getY());
        }
    });
    endButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            final GroupChatRoom groupChatRoom = (GroupChatRoom) room;
            groupChatRoom.leaveChatRoom();
        }
    });
    // Set Room is Active
    addFastpathChatRoom(room, RoomState.activeRoom);
}
Also used : GroupChatRoom(org.jivesoftware.spark.ui.rooms.GroupChatRoom) RolloverButton(org.jivesoftware.spark.component.RolloverButton)

Example 8 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class IncomingCallUI method addButtons.

private void addButtons() {
    // Build Accept Button
    acceptButton = new RolloverButton("      " + JingleResources.getString("button.accept"), JinglePhoneRes.getImageIcon("TOASTER_ACCEPT_BUTTON"));
    acceptButton.setHorizontalTextPosition(JLabel.CENTER);
    acceptButton.setFont(new Font("Dialog", Font.BOLD, 11));
    acceptButton.setForeground(new Color(91, 175, 41));
    acceptButton.setMargin(new Insets(0, 0, 0, 0));
    // Build Reject Button
    rejectButton = new RolloverButton("      " + JingleResources.getString("button.accept"), JinglePhoneRes.getImageIcon("TOASTER_REJECT_BUTTON"));
    rejectButton.setHorizontalTextPosition(JLabel.CENTER);
    rejectButton.setFont(new Font("Dialog", Font.BOLD, 11));
    rejectButton.setForeground(new Color(153, 32, 10));
    rejectButton.setMargin(new Insets(0, 0, 0, 0));
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    panel.add(acceptButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    panel.add(rejectButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    add(panel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) RolloverButton(org.jivesoftware.spark.component.RolloverButton) Font(java.awt.Font)

Example 9 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class FastpathPlugin method initialize.

public void initialize() {
    new WorkgroupInitializer().initialize();
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            container = new FastpathContainer();
            workgroupLabel = new JLabel(FpRes.getString("workgroup"));
            comboBox = new JComboBox();
            joinButton = new JButton(FpRes.getString("join"), null);
            logoutButton = new RolloverButton(FpRes.getString("logout"), null);
            // Initialize tab handler for Fastpath chats.
            fastpathTabHandler = new FastpathTabHandler();
            mainPanel = new BackgroundPane();
        }
    });
    try {
        DiscoverItems items = SparkManager.getSessionManager().getDiscoveredItems();
        for (DiscoverItems.Item item : items.getItems()) {
            String entityID = item.getEntityID() != null ? item.getEntityID() : "";
            if (entityID.startsWith("workgroup")) {
                // Log into workgroup
                final String workgroupService = "workgroup." + SparkManager.getSessionManager().getServerAddress();
                final String jid = SparkManager.getSessionManager().getJID();
                SwingWorker worker = new SwingWorker() {

                    public Object construct() {
                        try {
                            return Agent.getWorkgroups(workgroupService, jid, SparkManager.getConnection());
                        } catch (XMPPException | SmackException e1) {
                            return Collections.emptyList();
                        }
                    }

                    public void finished() {
                        Collection<String> agents = (Collection<String>) get();
                        if (agents.size() == 0) {
                            return;
                        }
                        showSelection(agents);
                    }
                };
                worker.start();
            }
        }
    } catch (Exception e) {
        Log.error(e);
    }
    SparkManager.getConnection().addConnectionListener(this);
}
Also used : SmackException(org.jivesoftware.smack.SmackException) DiscoverItems(org.jivesoftware.smackx.disco.packet.DiscoverItems) BackgroundPane(org.jivesoftware.fastpath.workspace.panes.BackgroundPane) RolloverButton(org.jivesoftware.spark.component.RolloverButton) SmackException(org.jivesoftware.smack.SmackException) XMPPException(org.jivesoftware.smack.XMPPException) SwingWorker(org.jivesoftware.spark.util.SwingWorker) Collection(java.util.Collection) XMPPException(org.jivesoftware.smack.XMPPException)

Example 10 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class ChatRoom method disableToolbar.

/**
 * Disables the ChatRoom toolbar.
 */
public void disableToolbar() {
    final int count = editorBarLeft.getComponentCount();
    for (int i = 0; i < count; i++) {
        final Object o = editorBarLeft.getComponent(i);
        if (o instanceof RolloverButton) {
            final RolloverButton rb = (RolloverButton) o;
            rb.setEnabled(false);
        }
    }
}
Also used : RolloverButton(org.jivesoftware.spark.component.RolloverButton)

Aggregations

RolloverButton (org.jivesoftware.spark.component.RolloverButton)25 JPanel (javax.swing.JPanel)12 GridBagConstraints (java.awt.GridBagConstraints)11 GridBagLayout (java.awt.GridBagLayout)11 Insets (java.awt.Insets)11 Font (java.awt.Font)7 Color (java.awt.Color)6 JLabel (javax.swing.JLabel)6 BorderLayout (java.awt.BorderLayout)4 JScrollPane (javax.swing.JScrollPane)4 SmackException (org.jivesoftware.smack.SmackException)4 XMPPException (org.jivesoftware.smack.XMPPException)4 FlowLayout (java.awt.FlowLayout)3 ActionEvent (java.awt.event.ActionEvent)3 JTextField (javax.swing.JTextField)3 Dimension (java.awt.Dimension)2 ActionListener (java.awt.event.ActionListener)2 KeyEvent (java.awt.event.KeyEvent)2 MouseEvent (java.awt.event.MouseEvent)2 Collection (java.util.Collection)2