git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@5243 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro 2006-09-05 04:16:31 +00:00 committed by derek
parent fd3619117b
commit 126566439d
5 changed files with 46 additions and 25 deletions

View File

@ -10,6 +10,7 @@
package org.jivesoftware.sparkimpl.search.users;
import org.jivesoftware.resource.Res;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.ReportedData;
@ -20,6 +21,13 @@ import org.jivesoftware.spark.util.ResourceUtils;
import org.jivesoftware.spark.util.SwingWorker;
import org.jivesoftware.spark.util.log.Log;
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.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@ -28,13 +36,6 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
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.KeyEvent;
public class SearchForm extends JPanel {
private UserSearchResults searchResults;
private DataFormUI questionForm;
@ -55,19 +56,19 @@ public class SearchForm extends JPanel {
}
catch (XMPPException e) {
Log.error("Unable to load search services.", e);
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to contact search service.", "Search Service Not Available", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Res.getString("message.search.service.not.available"), Res.getString("title.notification"), JOptionPane.ERROR_MESSAGE);
return;
}
searchManager = new UserSearchManager(SparkManager.getConnection());
questionForm = new DataFormUI(searchForm);
questionForm.setBorder(BorderFactory.createTitledBorder("Search Form"));
questionForm.setBorder(BorderFactory.createTitledBorder(Res.getString("group.search.form")));
add(questionForm, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
// Add User DataForm
final JButton searchButton = new JButton();
ResourceUtils.resButton(searchButton, "&Search");
ResourceUtils.resButton(searchButton, Res.getString("button.search"));
add(searchButton, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
searchButton.addActionListener(new ActionListener() {
@ -90,7 +91,7 @@ public class SearchForm extends JPanel {
// Add searchResults
searchResults = new UserSearchResults();
searchResults.setBorder(BorderFactory.createTitledBorder("Search Results"));
searchResults.setBorder(BorderFactory.createTitledBorder(Res.getString("group.search.results")));
add(searchResults, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
}
@ -128,7 +129,7 @@ public class SearchForm extends JPanel {
searchResults.showUsersFound(data);
}
else {
JOptionPane.showMessageDialog(searchResults, "No results found!", "No Results", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(searchResults, Res.getString("message.no.results.found"), Res.getString("title.notification"), JOptionPane.ERROR_MESSAGE);
}
}

View File

@ -11,6 +11,7 @@
package org.jivesoftware.sparkimpl.search.users;
import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.resource.Res;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.search.UserSearchManager;
@ -94,16 +95,17 @@ public class UserSearchForm extends JPanel {
add(titlePanel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
// Add Search Service ComboBox
final JLabel serviceLabel = new JLabel("Search Service:");
final JLabel serviceLabel = new JLabel("");
ResourceUtils.resLabel(serviceLabel, servicesBox, Res.getString("label.search.service") + ":");
add(serviceLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
add(servicesBox, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 150, 0));
final JButton addService = new JButton();
ResourceUtils.resButton(addService, "&Add Service");
ResourceUtils.resButton(addService, Res.getString("button.add.service"));
add(addService, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
addService.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
final String serviceName = JOptionPane.showInputDialog(getRootPane(), "Name of search service?", "Add Search Service", JOptionPane.QUESTION_MESSAGE);
final String serviceName = JOptionPane.showInputDialog(getRootPane(), Res.getString("message.name.of.search.service.question"), Res.getString("title.add.search.service"), JOptionPane.QUESTION_MESSAGE);
if (ModelUtil.hasLength(serviceName)) {
SwingWorker findServiceThread = new SwingWorker() {
@ -120,7 +122,7 @@ public class UserSearchForm extends JPanel {
public void finished() {
if (newForm == null) {
JOptionPane.showMessageDialog(getGUI(), "Unable to contact search service.", "Search Service Not Available", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(getGUI(), Res.getString("message.search.service.not.available"), Res.getString("title.notification"), JOptionPane.ERROR_MESSAGE);
return;
}
else {

View File

@ -11,6 +11,7 @@
package org.jivesoftware.sparkimpl.search.users;
import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.resource.Res;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.ReportedData;
import org.jivesoftware.spark.ChatManager;
@ -177,17 +178,17 @@ public class UserSearchResults extends JPanel {
final JMenuItem addAsContact = new JMenuItem(addContactAction);
addContactAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE));
addContactAction.putValue(Action.NAME, "Add as Contact");
addContactAction.putValue(Action.NAME, Res.getString("menuitem.add.as.contact"));
menu.add(addAsContact);
final JMenuItem chatMenu = new JMenuItem(chatAction);
chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE));
chatAction.putValue(Action.NAME, "Chat");
chatAction.putValue(Action.NAME, Res.getString("menuitem.chat"));
menu.add(chatMenu);
final JMenuItem viewProfileMenu = new JMenuItem(profileAction);
profileAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_PROFILE_IMAGE));
profileAction.putValue(Action.NAME, "View Profile");
profileAction.putValue(Action.NAME, Res.getString("menuitem.view.profile"));
menu.add(viewProfileMenu);

View File

@ -11,6 +11,7 @@
package org.jivesoftware.sparkimpl.search.users;
import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.resource.Res;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.search.UserSearchManager;
import org.jivesoftware.spark.SparkManager;
@ -37,7 +38,7 @@ public class UserSearchService implements Searchable {
public void search(String query) {
if (searchServices == null) {
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to locate a search service.", "Search Service Not Available", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Res.getString("message.search.service.not.available"), Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
return;
}
@ -48,7 +49,7 @@ public class UserSearchService implements Searchable {
dataFormUI = searchForm.getQuestionForm();
}
catch (Exception e) {
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to contact search service.", "Search Service Not Available", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Res.getString("message.search.service.not.available"), Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
return;
}
@ -76,7 +77,7 @@ public class UserSearchService implements Searchable {
JFrame frame = new JFrame();
frame.setIconImage(SparkRes.getImageIcon(SparkRes.VIEW_IMAGE).getImage());
final JDialog dialog = new JDialog(frame, "User Search", false);
final JDialog dialog = new JDialog(frame, Res.getString("title.person.search"), false);
dialog.getContentPane().add(searchForm);
dialog.pack();
dialog.setSize(500, 500);
@ -108,15 +109,15 @@ public class UserSearchService implements Searchable {
}
public String getToolTip() {
return "Search for other people on the server.";
return Res.getString("message.search.for.other.people");
}
public String getDefaultText() {
return "Search for other people.";
return Res.getString("message.search.for.other.people");
}
public String getName() {
return "User Search";
return Res.getString("title.person.search");
}
public Icon getIcon() {

View File

@ -52,6 +52,9 @@ button.save.for.future.use = &Save for future use
button.register = &Register
button.dial.number = &Dial Number
button.clear = &Clear
button.search = &Search
button.add.service = &Add Service
checkbox.save.password = &Save Password
@ -143,6 +146,8 @@ label.middle.name = &Middle Name
label.last.name = &Last Name
label.email.address = &Email Address
label.jid = &JID
label.search.service = &Search Service
message.username.error = Specify a username for the account.
message.password.error = Specify a password for this account.
@ -312,6 +317,10 @@ message.unable.to.load.profile = Unable to locate a profile for {0}
message.enter.jabber.id = Enter Jabber ID
message.invalid.jabber.id = Not a valid Jabber ID
message.vcard.not.supported = Server does not support VCards. Unable to save your VCard.
message.search.service.not.available = Unable to contact search service.
message.no.results.found = No search results were returned by the server.
message.name.of.search.service.question = Name of search service?
message.search.for.other.people = Search for other people on the server.
title.passwords.no.match = Confirm passwords.
title.create.problem = Account Creation Problem
@ -395,6 +404,8 @@ title.profile.information = Profile Information
title.profile.not.found = Profile Not Found
title.view.profile.for = Viewing Profile For " + jid
title.lookup.profile = Lookup Profile
title.add.search.service = Add Search Service
title.person.search = Person Search
menuitem.contacts = Contacts
menuitem.actions = Actions
@ -462,6 +473,9 @@ menuitem.view.client.version = View Client Version
menuitem.view.contact.history = View Contact History
menuitem.edit.my.profile = &Edit My Profile...
menuitem.lookup.profile = &Lookup Profile...
menuitem.add.as.contact = Add as a contact
menuitem.chat = Chat
menuitem.view.profile = View Profile
tree.conference.services = Conference Services
tree.users.in.room = Users In Room
@ -482,6 +496,8 @@ group.comma.delimited = Comma Delimited
group.general.information = General Information
group.chat.window.information = Chat Window Information
group.notification.options = Notification Options
group.search.form = Search Form
group.search.results = Search Results
tooltip.place.a.call = Place a call to this individual
tooltip.view.history = View conversation history