mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
26.44.2008 53206ce28721940f13e60c351ef4773edab89be7
Fix for issue 3633 (status-panel is not coming up in Asian locales)

This issue seems similar to:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468089

Which is a duplicate of:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6389282

It seems that the problem is caused for not calling UIManager.setLookAndFeel from the event thread. The fix consists of calling it from the event thread.
3 files modified
109 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java 36 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java 47 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java 26 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java
@@ -31,6 +31,7 @@
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
@@ -63,8 +64,7 @@
  public static void main(String[] args) {
    try
    {
      UIManager.setLookAndFeel(
          UIManager.getSystemLookAndFeelClassName());
      initLookAndFeel();
    }
    catch (Throwable t)
    {
@@ -122,4 +122,36 @@
      controlCenterPane.getLoginDialog().toFront();
    }
  }
  private static void initLookAndFeel() throws Throwable
  {
    if (SwingUtilities.isEventDispatchThread())
    {
      UIManager.setLookAndFeel(
          UIManager.getSystemLookAndFeelClassName());
    }
    else
    {
      final Throwable[] ts = {null};
      SwingUtilities.invokeAndWait(new Runnable()
      {
        public void run()
        {
          try
          {
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());
          }
          catch (Throwable t)
          {
            ts[0] = t;
          }
        }
      });
      if (ts[0] != null)
      {
        throw ts[0];
      }
    }
  }
}
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
@@ -177,13 +177,9 @@
      {
        try
        {
          // Setup MacOSX native menu bar before AWT is loaded.
          Utils.setMacOSXMenuBar(
              AdminToolMessages.INFO_CONTROL_PANEL_TITLE.get());
          try
          {
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());
            initLookAndFeel();
          }
          catch (Throwable t)
          {
@@ -237,7 +233,48 @@
    System.setErr(printStream);
    return returnValue[0];
  }
  private static void initLookAndFeel() throws Throwable
  {
    if (SwingUtilities.isEventDispatchThread())
    {
//    Setup MacOSX native menu bar before AWT is loaded.
      Utils.setMacOSXMenuBar(
          AdminToolMessages.INFO_CONTROL_PANEL_TITLE.get());
      UIManager.setLookAndFeel(
          UIManager.getSystemLookAndFeelClassName());
}
    else
    {
      final Throwable[] ts = {null};
      SwingUtilities.invokeAndWait(new Runnable()
      {
        public void run()
        {
          try
          {
//          Setup MacOSX native menu bar before AWT is loaded.
            Utils.setMacOSXMenuBar(
                AdminToolMessages.INFO_CONTROL_PANEL_TITLE.get());
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());
          }
          catch (Throwable t)
          {
            ts[0] = t;
          }
        }
      });
      if (ts[0] != null)
      {
        throw ts[0];
      }
    }
  }
}
/**
 * The enumeration containing the different return codes that the command-line
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -725,17 +725,37 @@
  {
    if (!initialized)
    {
      Runnable r = new Runnable()
      {
        public void run()
        {
      System.setProperty("swing.aatext", "true");
      try
      {
        UIManager.setLookAndFeel(
            UIManager.getSystemLookAndFeelClassName());
      } catch (Exception ex)
          } catch (Throwable t)
      {
        ex.printStackTrace();
            t.printStackTrace();
      }
      JFrame.setDefaultLookAndFeelDecorated(false);
        }
      };
      if (SwingUtilities.isEventDispatchThread())
      {
        r.run();
      }
      else
      {
        try
        {
          SwingUtilities.invokeAndWait(r);
        }
        catch (Throwable t)
        {
          t.printStackTrace();
        }
      }
      initialized = true;
    }
  }