[jsword-svn] r1523 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book common-swing/src/main/java/org/crosswire/common/progress/swing
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Tue Jul 24 13:51:33 MST 2007
Author: dmsmith
Date: 2007-07-24 13:51:33 -0700 (Tue, 24 Jul 2007)
New Revision: 1523
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java
Log:
farsified percent in progress bar and advanced search pane rank.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java 2007-07-24 20:11:02 UTC (rev 1522)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java 2007-07-24 20:51:33 UTC (rev 1523)
@@ -32,6 +32,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
+import java.util.Dictionary;
+import java.util.Hashtable;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
@@ -55,6 +57,7 @@
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import org.crosswire.common.icu.NumberShaper;
import org.crosswire.common.swing.ActionFactory;
import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
@@ -84,6 +87,8 @@
*/
private void initialize()
{
+ shaper = new NumberShaper();
+
actions = new ActionFactory(AdvancedSearchPane.class, this);
// SystemColor.controlShadow
@@ -134,6 +139,7 @@
0, DisplaySelectPane.getMaxNumRankedVerses(), DisplaySelectPane.getNumRankedVerses());
sliderRank.setMajorTickSpacing(DisplaySelectPane.getMaxNumRankedVerses() / 5);
sliderRank.setMinorTickSpacing(DisplaySelectPane.getMaxNumRankedVerses() / 20);
+ sliderRank.setLabelTable(createSliderLabels());
sliderRank.setPaintTicks(true);
sliderRank.setPaintLabels(true);
sliderRank.setVisible(false);
@@ -329,15 +335,15 @@
{
if (val == 0)
{
- lblRank.setText(Msg.RANK.toString("All")); //$NON-NLS-1$
+ lblRank.setText(shaper.shape(Msg.RANK.toString("All"))); //$NON-NLS-1$
}
else if (val == 1)
{
- lblRank.setText(Msg.RANK_ONE.toString());
+ lblRank.setText(shaper.shape(Msg.RANK_ONE.toString()));
}
else
{
- lblRank.setText(Msg.RANK.toString(new Integer(val)));
+ lblRank.setText(shaper.shape(Msg.RANK.toString(new Integer(val))));
}
}
@@ -620,6 +626,22 @@
// System.exit(0);
// }
+ /**
+ * Create the internationalized labels for the slider.
+ * @return the labels
+ */
+ private Dictionary createSliderLabels()
+ {
+ Dictionary labels = new Hashtable();
+ int max = DisplaySelectPane.getMaxNumRankedVerses();
+ for (int i = 0; i <= max; i += 20)
+ {
+ Integer label = new Integer(i);
+ labels.put(label, new JLabel(shaper.shape(label.toString()), SwingConstants.CENTER));
+ }
+ return labels;
+ }
+
/*
* Action constants
*/
@@ -668,6 +690,11 @@
private transient ActionFactory actions;
/**
+ * The transformer of numeric representation.
+ */
+ private NumberShaper shaper;
+
+ /**
* The entries in the restrictions preset
*/
private String[] presets;
Modified: trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java 2007-07-24 20:11:02 UTC (rev 1522)
+++ trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java 2007-07-24 20:51:33 UTC (rev 1523)
@@ -44,6 +44,7 @@
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
+import org.crosswire.common.icu.NumberShaper;
import org.crosswire.common.progress.Job;
import org.crosswire.common.progress.JobManager;
import org.crosswire.common.progress.Progress;
@@ -68,6 +69,8 @@
{
jobs = new HashMap();
positions = new ArrayList();
+ shaper = new NumberShaper();
+
if (small)
{
// They start off at 15pt (on Windows at least)
@@ -172,7 +175,11 @@
JobData jobdata = (JobData) jobs.get(job);
int percent = job.getWork();
- jobdata.getProgress().setString(job.getSectionName() + ": (" + percent + "%)"); //$NON-NLS-1$ //$NON-NLS-2$
+ StringBuffer buf = new StringBuffer(job.getSectionName());
+ buf.append(": "); //$NON-NLS-1$
+ buf.append(shaper.shape(Integer.toString(percent)));
+ buf.append('%');
+ jobdata.getProgress().setString(buf.toString());
jobdata.getProgress().setValue(percent);
}
@@ -234,6 +241,11 @@
private Font font;
/**
+ * Shape numbers into locale representation.
+ */
+ private NumberShaper shaper = new NumberShaper();
+
+ /**
* The log stream
*/
private static final Logger log = Logger.getLogger(JobsProgressBar.class);
More information about the jsword-svn
mailing list