[jsword-svn] r1471 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop common-swing/src/main/java/org/crosswire/common/progress/swing common-swing/src/main/java/org/crosswire/common/swing common-swing/src/main/java/org/crosswire/common/swing/desktop
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Tue Jul 3 14:01:02 MST 2007
Author: dmsmith
Date: 2007-07-03 14:01:02 -0700 (Tue, 03 Jul 2007)
New Revision: 1471
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleNameCellRenderer.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/StatusBar.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java
trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/GuiUtil.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/MDIViewLayout.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TDIViewLayout.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TabbedPanePanel.java
Log:
Farsi orientation updates. More to come...
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-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -274,6 +274,7 @@
this.add(lblSummary, new GridBagConstraints(0, ++gridy, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
this.add(scrSummary, new GridBagConstraints(1, gridy, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 5, 2, 5), 0, 0));
this.add(btnGo, new GridBagConstraints(2, ++gridy, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(10, 0, 5, 5), 0, 0));
+ GuiUtil.applyDefaultOrientation(this);
}
/**
@@ -314,6 +315,8 @@
{
return null;
}
+ GuiUtil.applyDefaultOrientation(dlgMain);
+
return txtSummary.getText();
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleNameCellRenderer.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleNameCellRenderer.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleNameCellRenderer.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -26,6 +26,7 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
+import org.crosswire.common.swing.GuiUtil;
import org.crosswire.jsword.versification.BookName;
/**
@@ -44,6 +45,7 @@
public BibleNameCellRenderer()
{
this(false);
+ GuiUtil.applyDefaultOrientation(this);
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -40,6 +40,7 @@
import org.crosswire.bibledesktop.display.basic.SplitBookDataDisplay;
import org.crosswire.bibledesktop.display.basic.TabbedBookDataDisplay;
import org.crosswire.bibledesktop.passage.KeySidebar;
+import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.swing.desktop.Clearable;
import org.crosswire.common.swing.desktop.TabbedPanePanel;
import org.crosswire.common.swing.desktop.Titleable;
@@ -114,6 +115,7 @@
this.setMinimumSize(new Dimension(0, 0));
this.add(pnlSelect, BorderLayout.NORTH);
this.add(pnlPassg, BorderLayout.CENTER);
+ GuiUtil.applyDefaultOrientation(this);
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -212,6 +212,7 @@
this.add(btnSearch, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
enableComponents();
+ GuiUtil.applyDefaultOrientation(this);
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -52,6 +52,7 @@
import org.crosswire.bibledesktop.passage.KeyTreeNode;
import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.FixedSplitPane;
+import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.util.Logger;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookCategory;
@@ -328,7 +329,9 @@
}
});
- return new CWScrollPane(bookList);
+ Component scroller = new CWScrollPane(bookList);
+ GuiUtil.applyDefaultOrientation(scroller);
+ return scroller;
}
/**
@@ -354,6 +357,9 @@
panel.add(cboBooks, null);
panel.add(cboChaps, null);
panel.add(cboVerse, null);
+
+ GuiUtil.applyDefaultOrientation(panel);
+
return panel;
}
@@ -370,7 +376,9 @@
newEntry();
}
});
- return new CWScrollPane(dictionaryKeyList);
+ Component scroller = new CWScrollPane(dictionaryKeyList);
+ GuiUtil.applyDefaultOrientation(scroller);
+ return scroller;
}
/**
@@ -392,7 +400,9 @@
}
});
- return new CWScrollPane(genBookKeyTree);
+ Component scroller = new CWScrollPane(genBookKeyTree);
+ GuiUtil.applyDefaultOrientation(scroller);
+ return scroller;
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -102,6 +102,7 @@
}
enableButtons();
+ GuiUtil.applyDefaultOrientation(this);
GuiUtil.refresh(this);
fireBooksChosen(new BookSelectEvent(this));
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -110,6 +110,7 @@
this.add(createScrolledList(lblSel), new GridBagConstraints(2, 1, 1, 4, 0.5, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 2, 10, 10), 0, 0));
this.add(createMessageLabel(), new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 5, 10), 0, 0));
this.add(createDisplayPanel(), new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 10), 0, 0));
+ GuiUtil.applyDefaultOrientation(this);
}
/**
@@ -316,6 +317,7 @@
dlgMain.setTitle(title);
dlgMain.setModal(modal);
+ GuiUtil.applyDefaultOrientation(dlgMain);
GuiUtil.restrainedPack(dlgMain, 0.5f, 0.75f);
GuiUtil.centerWindow(dlgMain);
dlgMain.setVisible(true);
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -158,6 +158,7 @@
pnlProps.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tabMain.add(pnlProps, Msg.SYSTEM_PROPS_TAB_TITLE.toString());
}
+ GuiUtil.applyDefaultOrientation(pnlMain);
}
/**
@@ -193,6 +194,7 @@
doAboutOK();
}
});
+ GuiUtil.applyDefaultOrientation(dlgMain);
dlgMain.pack();
dlgMain.setLocationRelativeTo(parent);
dlgMain.setVisible(true);
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -202,6 +202,9 @@
};
Books.installed().addBooksListener(cbl);
+ // Set the left-to-right or right-to-left orientation for this and all sub-components
+ GuiUtil.applyDefaultOrientation(this);
+
startJob.done();
}
@@ -566,6 +569,7 @@
changeSupport.addPropertyChangeListener(BookDataDisplay.COMPARE_BOOKS, display);
DisplaySelectPane dsp = view.getSelectPane();
dsp.addCommandListener(this);
+ GuiUtil.applyDefaultOrientation(view);
return view;
}
@@ -1124,6 +1128,9 @@
System.setProperty("com.apple.mrj.application.live-resize", "true"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ // The first thing that has to be done is to set the locale.
+ Translations.instance().setLocale();
+
// new BusStart();
ExceptionPane.setHelpDeskListener(true);
LookAndFeelUtil.initialize();
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -145,6 +145,8 @@
close();
}
});
+
+ GuiUtil.applyDefaultOrientation(this);
this.pack();
this.setVisible(true);
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/StatusBar.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/StatusBar.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/StatusBar.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -39,6 +39,7 @@
import org.crosswire.bibledesktop.display.URIEvent;
import org.crosswire.bibledesktop.display.URIEventListener;
import org.crosswire.common.progress.swing.JobsProgressBar;
+import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.util.OSType;
/**
@@ -98,6 +99,7 @@
this.add(labelMessage, new GridBagConstraints(0, 0, 1, 1, 0.3, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(separator, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(panelProgress, new GridBagConstraints(2, 0, 1, 1, 0.7, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), finalPadX, finalPadY));
+ GuiUtil.applyDefaultOrientation(this);
}
/* (non-Javadoc)
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -211,6 +211,7 @@
this.setLayout(new BorderLayout());
this.add(tabMain, BorderLayout.CENTER);
this.add(pnlButtons, BorderLayout.SOUTH);
+ GuiUtil.applyDefaultOrientation(this);
}
/**
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-03 15:18:54 UTC (rev 1470)
+++ trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -22,6 +22,7 @@
package org.crosswire.common.progress.swing;
import java.awt.Component;
+import java.awt.ComponentOrientation;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -33,6 +34,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -82,6 +84,8 @@
}
this.setLayout(new GridLayout(1, 0, 2, 0));
+
+ GuiUtil.applyDefaultOrientation(this);
}
/* (non-Javadoc)
@@ -131,6 +135,7 @@
log.debug("adding job to panel at " + i + ": " + job.getJobName()); //$NON-NLS-1$ //$NON-NLS-2$
JProgressBar progress = new JProgressBar();
+ GuiUtil.applyOrientation(progress, ComponentOrientation.getOrientation(Locale.getDefault()));
progress.setStringPainted(true);
progress.setToolTipText(job.getJobName());
progress.setBorder(null);
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/GuiUtil.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/GuiUtil.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/GuiUtil.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -23,6 +23,8 @@
import java.awt.Button;
import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
@@ -31,6 +33,7 @@
import java.awt.Toolkit;
import java.awt.Window;
import java.net.URL;
+import java.util.Locale;
import java.util.MissingResourceException;
import javax.swing.AbstractButton;
@@ -38,6 +41,7 @@
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
+import javax.swing.JMenu;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JToolTip;
@@ -530,6 +534,47 @@
}
/**
+ * Recurisvely apply default component orientation to the component and all it contains.
+ *
+ * @param comp the root of the tree to which orientation needs to be applied
+ * @param o the orientation to be applied
+ */
+ public static void applyDefaultOrientation(Component comp)
+ {
+ applyOrientation(comp, ComponentOrientation.getOrientation(Locale.getDefault()));
+ }
+
+ /**
+ * Recurisvely apply component orientation to the component and all it contains.
+ *
+ * @param comp the root of the tree to which orientation needs to be applied
+ * @param orientation the orientation to be applied
+ */
+ public static void applyOrientation(Component comp, ComponentOrientation orientation)
+ {
+ comp.setComponentOrientation(orientation);
+
+ if (comp instanceof JMenu)
+ {
+ JMenu menu = (JMenu) comp;
+ int ncomponents = menu.getMenuComponentCount();
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ applyOrientation(menu.getMenuComponent(i), orientation);
+ }
+ }
+ else if (comp instanceof Container)
+ {
+ Container container = (Container) comp;
+ int ncomponents = container.getComponentCount();
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ applyOrientation(container.getComponent(i), orientation);
+ }
+ }
+ }
+
+ /**
* The log stream
*/
private static final Logger log = Logger.getLogger(GuiUtil.class);
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -31,6 +31,7 @@
import javax.swing.JPanel;
import javax.swing.event.EventListenerList;
+import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.swing.desktop.event.ViewEvent;
import org.crosswire.common.swing.desktop.event.ViewEventListener;
import org.crosswire.common.util.Iterable;
@@ -52,6 +53,7 @@
protected AbstractViewLayout()
{
panel = new JPanel(new BorderLayout());
+ GuiUtil.applyDefaultOrientation(panel);
views = new ArrayList();
listenerList = new EventListenerList();
}
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/MDIViewLayout.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/MDIViewLayout.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/MDIViewLayout.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -35,6 +35,8 @@
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
+import org.crosswire.common.swing.GuiUtil;
+
/**
* MDI (Multiple documet interface) manager of how we layout views
* as sub-windows.
@@ -75,6 +77,7 @@
iframe.addInternalFrameListener(new CustomInternalFrameAdapter());
iframe.addVetoableChangeListener(new CloseListener());
+ GuiUtil.applyDefaultOrientation(iframe);
iframe.setVisible(true);
iframe.pack();
}
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TDIViewLayout.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TDIViewLayout.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TDIViewLayout.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -29,7 +29,9 @@
import javax.swing.UIManager;
import javax.swing.plaf.TabbedPaneUI;
+import org.crosswire.common.swing.GuiUtil;
+
/**
* TDI (Tabbed Document Interface) manager of how we layout views
* as tabs.
@@ -53,6 +55,7 @@
tabs.setUI((TabbedPaneUI) UIManager.get("BibleViewPane.TabbedPaneUI")); //$NON-NLS-1$
}
tabs.setMinimumSize(new Dimension(0, 0));
+ GuiUtil.applyDefaultOrientation(tabs);
}
/* (non-Javadoc)
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TabbedPanePanel.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TabbedPanePanel.java 2007-07-03 15:18:54 UTC (rev 1470)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/TabbedPanePanel.java 2007-07-03 21:01:02 UTC (rev 1471)
@@ -27,6 +27,8 @@
import javax.swing.JPanel;
import javax.swing.UIManager;
+import org.crosswire.common.swing.GuiUtil;
+
/**
* A JPanel class where it's child components will paint on top of its border.
*
@@ -63,6 +65,7 @@
private void init()
{
this.setBorder(UIManager.getBorder("TabbedPanePanel.border")); //$NON-NLS-1$
+ GuiUtil.applyDefaultOrientation(this);
}
/**
More information about the jsword-svn
mailing list