Updating for secret 3.0 pre-alpha release.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6339 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2006-12-08 06:53:33 +00:00
committed by derek
parent e5b8755e61
commit fe17ff2b79
5 changed files with 78 additions and 47 deletions

View File

@ -636,7 +636,7 @@ public class SparkTransferManager {
});
sendingUI.sendFile(transfer, transferManager, presence.getFrom(), contactItem.getNickname());
transcriptWindow.add(sendingUI, BorderLayout.AFTER_LAST_LINE);
transcriptWindow.addComponent(sendingUI);
return chatRoom;
}

View File

@ -81,7 +81,6 @@ public class TranscriptWindow extends JPanel {
private Timer timer = new Timer();
/**
* Creates a default instance of <code>TranscriptWindow</code>.
*/
@ -93,7 +92,7 @@ public class TranscriptWindow extends JPanel {
extraPanel = new JPanel();
//Core function to create browser
//Core function to create browser
browser = BrowserFactory.spawnMozilla();
browser.addNetworkListener(new NetworkListener() {
public void onProgressChange(NetworkEvent networkEvent) {
@ -512,9 +511,9 @@ public class TranscriptWindow extends JPanel {
public void addComponent(JComponent component) {
extraPanel.add(component);
extraPanel.setVisible(true);
extraPanel.invalidate();
extraPanel.validate();
extraPanel.repaint();
invalidate();
validate();
repaint();
}
public void removeComponent(JComponent component) {
@ -523,9 +522,9 @@ public class TranscriptWindow extends JPanel {
}
extraPanel.remove(component);
extraPanel.invalidate();
extraPanel.validate();
extraPanel.repaint();
invalidate();
validate();
repaint();
}
public Dimension getPreferredSize() {

View File

@ -125,12 +125,25 @@ public class ThemeManager {
String themeName = pref.getTheme();
File theme = new File(THEMES_DIRECTORY, themeName);
if (!theme.exists()) {
File themeDir = ThemeManager.THEMES_DIRECTORY;
File[] dirs = themeDir.listFiles();
for (int i = 0; i < dirs.length; i++) {
File file = dirs[i];
if (file.isDirectory()) {
themeName = file.getName();
pref.setTheme(themeName);
theme = new File(THEMES_DIRECTORY, themeName);
break;
}
}
}
try {
setTheme(theme);
}
catch (Exception e) {
System.err.println("Could not locate "+theme);
System.err.println("Could not locate " + theme);
e.printStackTrace();
}

View File

@ -21,6 +21,7 @@ import org.jivesoftware.smackx.filetransfer.FileTransfer;
import org.jivesoftware.smackx.filetransfer.FileTransferRequest;
import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.component.RolloverButton;
import org.jivesoftware.spark.ui.ChatRoom;
import org.jivesoftware.spark.ui.ContactItem;
import org.jivesoftware.spark.ui.ContactList;
@ -34,20 +35,6 @@ import org.jivesoftware.spark.util.URLFileSystem;
import org.jivesoftware.spark.util.log.Log;
import org.jivesoftware.sparkimpl.plugin.filetransfer.transfer.Downloads;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
@ -66,6 +53,20 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
public class ReceiveMessage extends JPanel {
private JLabel imageLabel = new JLabel();
private JLabel titleLabel = new JLabel();
@ -91,6 +92,14 @@ public class ReceiveMessage extends JPanel {
titleLabel.setForeground(new Color(211, 174, 102));
add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 2, 2), 0, 0));
final RolloverButton hideButton = new RolloverButton("Hide", SparkRes.getImageIcon(SparkRes.SMALL_CLOSE_BUTTON));
add(hideButton, new GridBagConstraints(2, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
hideButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 2), 0, 0));
add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 2), 0, 0));
@ -272,8 +281,8 @@ public class ReceiveMessage extends JPanel {
progressBar.setValue((int)bytesRead);
FileTransfer.Status status = transfer.getStatus();
if (status == FileTransfer.Status.error ||
status == FileTransfer.Status.complete || status == FileTransfer.Status.cancelled ||
status == FileTransfer.Status.refused) {
status == FileTransfer.Status.complete || status == FileTransfer.Status.cancelled ||
status == FileTransfer.Status.refused) {
break;
}
else if (status == FileTransfer.Status.negotiating_stream) {
@ -361,7 +370,7 @@ public class ReceiveMessage extends JPanel {
transferMessage = Res.getString("message.transfer.refused");
}
else if (transfer.getStatus() == FileTransfer.Status.cancelled ||
transfer.getAmountWritten() < request.getFileSize()) {
transfer.getAmountWritten() < request.getFileSize()) {
transferMessage = Res.getString("message.transfer.cancelled");
}
@ -680,26 +689,26 @@ public class ReceiveMessage extends JPanel {
String fileURL = file.toURL().toString();
String folderURL = file.getParentFile().toURL().toString();
builder.append("<table width=\"100%\">" +
" <tr>" +
" <td><img src=\"" + iconURL + "\"></td>" +
" <td>" +
" " + title + "" +
" </td>" +
" </tr>" +
" <tr>" +
" <td colspan=\"2\">" +
" " + file.getName() + "" +
" </td>" +
" </tr>" +
" <tr>" +
" <td width=\"5%\">" +
" <a href=\"" + fileURL + "\" target=\"_blank\">Open</a>" +
" </td>" +
" <td align=\"left\">" +
" <a href=\"" + folderURL + "\" target=\"_blank\">Open Folder</a>" +
" </td>" +
" </tr>" +
"</table>");
" <tr>" +
" <td><img src=\"" + iconURL + "\"></td>" +
" <td>" +
" " + title + "" +
" </td>" +
" </tr>" +
" <tr>" +
" <td colspan=\"2\">" +
" " + file.getName() + "" +
" </td>" +
" </tr>" +
" <tr>" +
" <td width=\"5%\">" +
" <a href=\"" + fileURL + "\" target=\"_blank\">Open</a>" +
" </td>" +
" <td align=\"left\">" +
" <a href=\"" + folderURL + "\" target=\"_blank\">Open Folder</a>" +
" </td>" +
" </tr>" +
"</table>");
return builder.toString();
}

View File

@ -21,6 +21,7 @@ import org.jivesoftware.smackx.filetransfer.FileTransfer.Status;
import org.jivesoftware.smackx.filetransfer.FileTransferManager;
import org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.component.RolloverButton;
import org.jivesoftware.spark.ui.ContactItem;
import org.jivesoftware.spark.ui.ContactList;
import org.jivesoftware.spark.util.ByteFormat;
@ -77,6 +78,15 @@ public class SendMessage extends JPanel {
add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
titleLabel.setFont(new Font("Dialog", Font.BOLD, 11));
titleLabel.setForeground(new Color(211, 174, 102));
final RolloverButton hideButton = new RolloverButton("Hide", SparkRes.getImageIcon(SparkRes.SMALL_CLOSE_BUTTON));
add(hideButton, new GridBagConstraints(2, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
hideButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 2, 2), 0, 0));
cancelButton.setText(Res.getString("cancel"));