mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Update UI per new UI Mockups.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6698 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -21,16 +21,15 @@ import org.jivesoftware.smack.packet.Presence;
|
|||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||||
import org.jivesoftware.smackx.packet.DelayInformation;
|
import org.jivesoftware.smackx.packet.DelayInformation;
|
||||||
import org.jivesoftware.spark.component.VerticalFlowLayout;
|
|
||||||
import org.jivesoftware.spark.component.panes.CollapsiblePane;
|
|
||||||
import org.jivesoftware.spark.component.tabbedPane.SparkTabbedPane;
|
import org.jivesoftware.spark.component.tabbedPane.SparkTabbedPane;
|
||||||
import org.jivesoftware.spark.filetransfer.SparkTransferManager;
|
import org.jivesoftware.spark.filetransfer.SparkTransferManager;
|
||||||
import org.jivesoftware.spark.search.SearchManager;
|
import org.jivesoftware.spark.search.SearchManager;
|
||||||
|
import org.jivesoftware.spark.ui.ChatContainer;
|
||||||
import org.jivesoftware.spark.ui.ChatRoom;
|
import org.jivesoftware.spark.ui.ChatRoom;
|
||||||
import org.jivesoftware.spark.ui.ChatRoomNotFoundException;
|
import org.jivesoftware.spark.ui.ChatRoomNotFoundException;
|
||||||
|
import org.jivesoftware.spark.ui.CommandPanel;
|
||||||
import org.jivesoftware.spark.ui.ContactItem;
|
import org.jivesoftware.spark.ui.ContactItem;
|
||||||
import org.jivesoftware.spark.ui.ContactList;
|
import org.jivesoftware.spark.ui.ContactList;
|
||||||
import org.jivesoftware.spark.ui.ChatContainer;
|
|
||||||
import org.jivesoftware.spark.ui.conferences.Conferences;
|
import org.jivesoftware.spark.ui.conferences.Conferences;
|
||||||
import org.jivesoftware.spark.ui.status.StatusBar;
|
import org.jivesoftware.spark.ui.status.StatusBar;
|
||||||
import org.jivesoftware.spark.util.SwingWorker;
|
import org.jivesoftware.spark.util.SwingWorker;
|
||||||
@ -40,7 +39,6 @@ import org.jivesoftware.sparkimpl.plugin.transcripts.ChatTranscriptPlugin;
|
|||||||
|
|
||||||
import java.awt.CardLayout;
|
import java.awt.CardLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
@ -57,7 +55,6 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,6 +75,7 @@ import javax.swing.UIManager;
|
|||||||
public class Workspace extends JPanel implements PacketListener {
|
public class Workspace extends JPanel implements PacketListener {
|
||||||
private SparkTabbedPane workspacePane;
|
private SparkTabbedPane workspacePane;
|
||||||
private StatusBar statusBox;
|
private StatusBar statusBox;
|
||||||
|
private CommandPanel commandPanel;
|
||||||
private ContactList contactList;
|
private ContactList contactList;
|
||||||
private Conferences conferences;
|
private Conferences conferences;
|
||||||
|
|
||||||
@ -90,9 +88,6 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
|
|
||||||
public static final String WORKSPACE_PANE = "WORKSPACE_PANE";
|
public static final String WORKSPACE_PANE = "WORKSPACE_PANE";
|
||||||
|
|
||||||
private final CollapsiblePane alerts = new CollapsiblePane();
|
|
||||||
private final JPanel alertPanel = new JPanel();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the singleton instance of <CODE>Workspace</CODE>,
|
* Returns the singleton instance of <CODE>Workspace</CODE>,
|
||||||
@ -119,7 +114,7 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
* Creates the instance of the SupportChatWorkspace.
|
* Creates the instance of the SupportChatWorkspace.
|
||||||
*/
|
*/
|
||||||
private Workspace() {
|
private Workspace() {
|
||||||
MainWindow mainWindow = SparkManager.getMainWindow();
|
final MainWindow mainWindow = SparkManager.getMainWindow();
|
||||||
|
|
||||||
// Add MainWindow listener
|
// Add MainWindow listener
|
||||||
mainWindow.addMainWindowListener(new MainWindowListener() {
|
mainWindow.addMainWindowListener(new MainWindowListener() {
|
||||||
@ -153,21 +148,14 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
cardPanel.setOpaque(false);
|
cardPanel.setOpaque(false);
|
||||||
cardPanel.add(WORKSPACE_PANE, this);
|
cardPanel.add(WORKSPACE_PANE, this);
|
||||||
|
|
||||||
// Setup alert Panel
|
|
||||||
alertPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
|
|
||||||
alertPanel.setBackground((Color)UIManager.get("List.background"));
|
|
||||||
|
|
||||||
alerts.setContentPane(alertPanel);
|
|
||||||
alerts.getTitlePane().setVisible(false);
|
|
||||||
alerts.setVisible(false);
|
|
||||||
|
|
||||||
statusBox = new StatusBar();
|
statusBox = new StatusBar();
|
||||||
|
commandPanel = new CommandPanel();
|
||||||
|
|
||||||
// Build default workspace
|
// Build default workspace
|
||||||
this.setLayout(new GridBagLayout());
|
this.setLayout(new GridBagLayout());
|
||||||
add(workspacePane, new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 4, 4, 4), 0, 0));
|
add(workspacePane, new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 4, 4, 4), 0, 0));
|
||||||
add(statusBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 4, 4, 4), 0, 0));
|
add(statusBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 4, 4, 4), 0, 0));
|
||||||
add(alerts, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 4, 4, 4), 0, 0));
|
add(commandPanel, new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 4, 0, 4), 0, 0));
|
||||||
|
|
||||||
|
|
||||||
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F12"), "showDebugger");
|
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F12"), "showDebugger");
|
||||||
@ -423,36 +411,6 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
chatRoom.getChatInputEditor().requestFocusInWindow();
|
chatRoom.getChatInputEditor().requestFocusInWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAlert(Component comp) {
|
|
||||||
alertPanel.add(comp);
|
|
||||||
|
|
||||||
int comps = alertPanel.getComponentCount();
|
|
||||||
alerts.setVisible(true);
|
|
||||||
alerts.getTitlePane().setVisible(true);
|
|
||||||
alerts.setTitle("Alerts (" + comps + ")");
|
|
||||||
|
|
||||||
alertPanel.invalidate();
|
|
||||||
alertPanel.validate();
|
|
||||||
alertPanel.repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeAlert(Component comp) {
|
|
||||||
alertPanel.remove(comp);
|
|
||||||
|
|
||||||
int comps = alertPanel.getComponentCount();
|
|
||||||
if (comps == 0) {
|
|
||||||
alerts.getTitlePane().setVisible(false);
|
|
||||||
alerts.setVisible(false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
alerts.setTitle("Alerts (" + comps + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidate();
|
|
||||||
validate();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Workspace TabbedPane. If you wish to add your
|
* Returns the Workspace TabbedPane. If you wish to add your
|
||||||
@ -482,7 +440,12 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
return cardPanel;
|
return cardPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPanel getAlertPanel() {
|
/**
|
||||||
return alertPanel;
|
* Returns the <code>CommandPanel</code> of this Workspace.
|
||||||
|
*
|
||||||
|
* @return the CommandPanel.
|
||||||
|
*/
|
||||||
|
public CommandPanel getCommandPanel() {
|
||||||
|
return commandPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,111 +0,0 @@
|
|||||||
/**
|
|
||||||
* $Revision: $
|
|
||||||
* $Date: $
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
|
||||||
* a copy of which is included in this distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jivesoftware.spark.component;
|
|
||||||
|
|
||||||
import org.jivesoftware.resource.Res;
|
|
||||||
import org.jivesoftware.resource.SparkRes;
|
|
||||||
import org.jivesoftware.spark.SparkManager;
|
|
||||||
import org.jivesoftware.spark.util.GraphicUtils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.GridBagConstraints;
|
|
||||||
import java.awt.GridBagLayout;
|
|
||||||
import java.awt.Insets;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.MouseAdapter;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple notification UI within Spark.
|
|
||||||
*
|
|
||||||
* @author Derek DeMoro
|
|
||||||
*/
|
|
||||||
public class AlertUI extends JPanel implements ActionListener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Buidls an AlertUI
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* @param description
|
|
||||||
*/
|
|
||||||
public AlertUI(final String message, final String description) {
|
|
||||||
final RolloverButton closeButton;
|
|
||||||
|
|
||||||
// Set Layout
|
|
||||||
setLayout(new GridBagLayout());
|
|
||||||
|
|
||||||
// Build UI
|
|
||||||
final JLabel titleLabel = new JLabel();
|
|
||||||
final JLabel descriptionLabel = new JLabel();
|
|
||||||
|
|
||||||
final JLabel dateLabel = new JLabel();
|
|
||||||
final JLabel dateLabelValue = new JLabel();
|
|
||||||
|
|
||||||
add(titleLabel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0));
|
|
||||||
add(descriptionLabel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 5), 0, 0));
|
|
||||||
|
|
||||||
add(dateLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 5), 0, 0));
|
|
||||||
add(dateLabelValue, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 5), 0, 0));
|
|
||||||
|
|
||||||
titleLabel.setFont(new Font("dialog", Font.BOLD, 11));
|
|
||||||
titleLabel.setText(message);
|
|
||||||
|
|
||||||
descriptionLabel.setForeground(Color.gray);
|
|
||||||
|
|
||||||
// Set Date Label
|
|
||||||
dateLabel.setText(Res.getString("label.received") + ":");
|
|
||||||
final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a");
|
|
||||||
final String date = formatter.format(new Date());
|
|
||||||
dateLabelValue.setText(date);
|
|
||||||
|
|
||||||
// Add accept and reject buttons
|
|
||||||
closeButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.CLOSE_IMAGE));
|
|
||||||
|
|
||||||
add(closeButton, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
|
||||||
|
|
||||||
|
|
||||||
closeButton.addActionListener(this);
|
|
||||||
|
|
||||||
setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.lightGray));
|
|
||||||
setBackground(Color.white);
|
|
||||||
|
|
||||||
titleLabel.setToolTipText(GraphicUtils.createToolTip(message, 200));
|
|
||||||
|
|
||||||
addMouseListener(new MouseAdapter() {
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
if (e.getClickCount() == 2) {
|
|
||||||
// Show message in dialog
|
|
||||||
MessageDialog.showAlert(description, Res.getString("title.alert"), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
descriptionLabel.setText(description);
|
|
||||||
|
|
||||||
SparkManager.getWorkspace().addAlert(this);
|
|
||||||
SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow());
|
|
||||||
setBackground(new Color(195, 217, 255));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
SparkManager.getWorkspace().removeAlert(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -201,7 +201,7 @@ public class SparkTransferManager {
|
|||||||
|
|
||||||
// Add View Downloads to Command Panel
|
// Add View Downloads to Command Panel
|
||||||
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
||||||
JPanel commandPanel = statusBar.getCommandPanel();
|
final JPanel commandPanel = SparkManager.getWorkspace().getCommandPanel();
|
||||||
|
|
||||||
RolloverButton viewDownloads = new RolloverButton(SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16));
|
RolloverButton viewDownloads = new RolloverButton(SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16));
|
||||||
viewDownloads.setToolTipText(Res.getString("menuitem.view.downloads"));
|
viewDownloads.setToolTipText(Res.getString("menuitem.view.downloads"));
|
||||||
|
|||||||
@ -236,7 +236,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
|||||||
chatWindowPanel.setOpaque(false);
|
chatWindowPanel.setOpaque(false);
|
||||||
|
|
||||||
// Layout Components
|
// Layout Components
|
||||||
chatPanel.add(chatWindowPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
|
chatPanel.add(chatWindowPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 2, 0, 2), 0, 0));
|
||||||
|
|
||||||
// Add edit buttons to Chat Room
|
// Add edit buttons to Chat Room
|
||||||
editorBar.setOpaque(false);
|
editorBar.setOpaque(false);
|
||||||
|
|||||||
46
src/java/org/jivesoftware/spark/ui/CommandPanel.java
Normal file
46
src/java/org/jivesoftware/spark/ui/CommandPanel.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* $Revision: $
|
||||||
|
* $Date: $
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||||
|
* a copy of which is included in this distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jivesoftware.spark.ui;
|
||||||
|
|
||||||
|
import org.jivesoftware.resource.Default;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CommandPanel extends JPanel {
|
||||||
|
|
||||||
|
private final Image backgroundImage;
|
||||||
|
|
||||||
|
public CommandPanel() {
|
||||||
|
setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||||
|
|
||||||
|
backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
|
||||||
|
|
||||||
|
setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(197, 213, 230)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paintComponent(Graphics g) {
|
||||||
|
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||||
|
double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
||||||
|
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
||||||
|
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -224,7 +224,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
|||||||
|
|
||||||
// Get command panel and add View Online/Offline, Add Contact
|
// Get command panel and add View Online/Offline, Add Contact
|
||||||
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
||||||
JPanel commandPanel = statusBar.getCommandPanel();
|
final JPanel commandPanel = SparkManager.getWorkspace().getCommandPanel();
|
||||||
|
|
||||||
|
|
||||||
final RolloverButton addContactButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.USER1_ADD_16x16));
|
final RolloverButton addContactButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.USER1_ADD_16x16));
|
||||||
|
|||||||
@ -81,8 +81,7 @@ public class Conferences {
|
|||||||
|
|
||||||
// Add Join Conference Button to StatusBar
|
// Add Join Conference Button to StatusBar
|
||||||
// Get command panel and add View Online/Offline, Add Contact
|
// Get command panel and add View Online/Offline, Add Contact
|
||||||
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
JPanel commandPanel = SparkManager.getWorkspace().getCommandPanel();
|
||||||
JPanel commandPanel = statusBar.getCommandPanel();
|
|
||||||
|
|
||||||
RolloverButton joinConference = new RolloverButton(SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16));
|
RolloverButton joinConference = new RolloverButton(SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16));
|
||||||
joinConference.setToolTipText(Res.getString("message.join.conference.room"));
|
joinConference.setToolTipText(Res.getString("message.join.conference.room"));
|
||||||
|
|||||||
@ -195,7 +195,7 @@ public class ChatRoomImpl extends ChatRoom {
|
|||||||
|
|
||||||
// Add VCard Panel
|
// Add VCard Panel
|
||||||
final VCardPanel vcardPanel = new VCardPanel(participantJID);
|
final VCardPanel vcardPanel = new VCardPanel(participantJID);
|
||||||
getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
|
getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 2), 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,22 +24,7 @@ import org.jivesoftware.spark.util.SwingWorker;
|
|||||||
import org.jivesoftware.spark.util.log.Log;
|
import org.jivesoftware.spark.util.log.Log;
|
||||||
import org.jivesoftware.sparkimpl.profile.VCardManager;
|
import org.jivesoftware.sparkimpl.profile.VCardManager;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
|
||||||
import javax.swing.Action;
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.BoxLayout;
|
|
||||||
import javax.swing.Icon;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.border.Border;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@ -58,6 +43,19 @@ import java.util.Collection;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JMenu;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
|
||||||
public class StatusBar extends JPanel {
|
public class StatusBar extends JPanel {
|
||||||
private List<StatusItem> statusList = new ArrayList<StatusItem>();
|
private List<StatusItem> statusList = new ArrayList<StatusItem>();
|
||||||
|
|
||||||
@ -69,33 +67,11 @@ public class StatusBar extends JPanel {
|
|||||||
|
|
||||||
private Presence currentPresence;
|
private Presence currentPresence;
|
||||||
|
|
||||||
private JPanel commandPanel;
|
|
||||||
|
|
||||||
public StatusBar() {
|
public StatusBar() {
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
|
|
||||||
|
|
||||||
backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
|
backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
|
||||||
|
|
||||||
// Initialze command panel
|
|
||||||
commandPanel = new JPanel() {
|
|
||||||
|
|
||||||
public Dimension getPreferredSize() {
|
|
||||||
Dimension dim = super.getPreferredSize();
|
|
||||||
Component[] comps = getComponents();
|
|
||||||
for (int i = 0; i < comps.length; i++) {
|
|
||||||
if (comps[i].isVisible()) {
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println("Nope");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dim;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
commandPanel.setLayout(new BoxLayout(commandPanel, BoxLayout.X_AXIS));
|
|
||||||
commandPanel.setOpaque(false);
|
|
||||||
|
|
||||||
ImageIcon brandedImage = Default.getImageIcon(Default.BRANDED_IMAGE);
|
ImageIcon brandedImage = Default.getImageIcon(Default.BRANDED_IMAGE);
|
||||||
if (brandedImage != null && brandedImage.getIconWidth() > 1) {
|
if (brandedImage != null && brandedImage.getIconWidth() > 1) {
|
||||||
@ -109,9 +85,6 @@ public class StatusBar extends JPanel {
|
|||||||
add(nicknameLabel, new GridBagConstraints(1, 0, 2, 2, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
|
add(nicknameLabel, new GridBagConstraints(1, 0, 2, 2, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
|
||||||
add(statusPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0));
|
add(statusPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0));
|
||||||
|
|
||||||
// Add Command Panel. We want adding command buttons to be simple.
|
|
||||||
add(commandPanel, new GridBagConstraints(1, 3, 3, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
|
||||||
|
|
||||||
nicknameLabel.setToolTipText(SparkManager.getConnection().getUser());
|
nicknameLabel.setToolTipText(SparkManager.getConnection().getUser());
|
||||||
nicknameLabel.setFont(new Font("Dialog", Font.BOLD, 12));
|
nicknameLabel.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||||
|
|
||||||
@ -567,11 +540,6 @@ public class StatusBar extends JPanel {
|
|||||||
this.backgroundImage = image;
|
this.backgroundImage = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPanel getCommandPanel() {
|
|
||||||
return commandPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
Dimension dim = super.getPreferredSize();
|
Dimension dim = super.getPreferredSize();
|
||||||
dim.width = 0;
|
dim.width = 0;
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public class BroadcastPlugin implements Plugin, PacketListener {
|
|||||||
|
|
||||||
// Add Broadcast to roster
|
// Add Broadcast to roster
|
||||||
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
||||||
JPanel commandPanel = statusBar.getCommandPanel();
|
final JPanel commandPanel = SparkManager.getWorkspace().getCommandPanel();
|
||||||
|
|
||||||
RolloverButton broadcastToRosterButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.MEGAPHONE_16x16));
|
RolloverButton broadcastToRosterButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.MEGAPHONE_16x16));
|
||||||
broadcastToRosterButton.setToolTipText(Res.getString("message.send.a.broadcast"));
|
broadcastToRosterButton.setToolTipText(Res.getString("message.send.a.broadcast"));
|
||||||
|
|||||||
@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
package org.jivesoftware.sparkimpl.plugin.bookmarks;
|
package org.jivesoftware.sparkimpl.plugin.bookmarks;
|
||||||
|
|
||||||
import org.jivesoftware.resource.SparkRes;
|
|
||||||
import org.jivesoftware.resource.Res;
|
import org.jivesoftware.resource.Res;
|
||||||
|
import org.jivesoftware.resource.SparkRes;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smackx.PrivateDataManager;
|
import org.jivesoftware.smackx.PrivateDataManager;
|
||||||
import org.jivesoftware.smackx.bookmark.BookmarkedConference;
|
import org.jivesoftware.smackx.bookmark.BookmarkedConference;
|
||||||
@ -25,11 +25,6 @@ import org.jivesoftware.spark.util.BrowserLauncher;
|
|||||||
import org.jivesoftware.spark.util.SwingWorker;
|
import org.jivesoftware.spark.util.SwingWorker;
|
||||||
import org.jivesoftware.spark.util.log.Log;
|
import org.jivesoftware.spark.util.log.Log;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
|
||||||
import javax.swing.Action;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@ -37,6 +32,11 @@ import java.io.IOException;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows for adding and removal of Bookmarks within Spark.
|
* Allows for adding and removal of Bookmarks within Spark.
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ public class BookmarkPlugin implements Plugin {
|
|||||||
|
|
||||||
if (bookmarks != null) {
|
if (bookmarks != null) {
|
||||||
// Add to status bar
|
// Add to status bar
|
||||||
final JPanel commandPanel = SparkManager.getWorkspace().getStatusBar().getCommandPanel();
|
final JPanel commandPanel = SparkManager.getWorkspace().getCommandPanel();
|
||||||
final RolloverButton bookmarkButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.BOOKMARK_ICON));
|
final RolloverButton bookmarkButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.BOOKMARK_ICON));
|
||||||
bookmarkButton.addMouseListener(new MouseAdapter() {
|
bookmarkButton.addMouseListener(new MouseAdapter() {
|
||||||
public void mouseClicked(MouseEvent mouseEvent) {
|
public void mouseClicked(MouseEvent mouseEvent) {
|
||||||
|
|||||||
@ -47,17 +47,13 @@ public class GatewayButton extends JPanel {
|
|||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
|
|
||||||
final StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
final StatusBar statusBar = SparkManager.getWorkspace().getStatusBar();
|
||||||
final JPanel commandPanel = statusBar.getCommandPanel();
|
final JPanel commandPanel = SparkManager.getWorkspace().getCommandPanel();
|
||||||
|
|
||||||
button.setIcon(transport.getInactiveIcon());
|
button.setIcon(transport.getInactiveIcon());
|
||||||
button.setToolTipText(transport.getInstructions());
|
button.setToolTipText(transport.getInstructions());
|
||||||
|
|
||||||
commandPanel.add(button);
|
commandPanel.add(button);
|
||||||
|
|
||||||
statusBar.invalidate();
|
|
||||||
statusBar.validate();
|
|
||||||
statusBar.repaint();
|
|
||||||
|
|
||||||
button.addMouseListener(new MouseAdapter() {
|
button.addMouseListener(new MouseAdapter() {
|
||||||
public void mousePressed(MouseEvent mouseEvent) {
|
public void mousePressed(MouseEvent mouseEvent) {
|
||||||
handlePopup(mouseEvent);
|
handlePopup(mouseEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user