openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r946267 - in /openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook: client/Demo.java server/QueryParameterBinder.java
Date Wed, 19 May 2010 16:41:06 GMT
Author: ppoddar
Date: Wed May 19 16:41:06 2010
New Revision: 946267

URL: http://svn.apache.org/viewvc?rev=946267&view=rev
Log:
Adjust widget size by screen size

Modified:
    openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java
    openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java

Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java?rev=946267&r1=946266&r2=946267&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/client/Demo.java Wed May
19 16:41:06 2010
@@ -17,10 +17,12 @@
 package openbook.client;
 
 import java.awt.BorderLayout;
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Cursor;
 import java.awt.Dimension;
+import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.io.PrintStream;
 import java.util.Arrays;
@@ -32,6 +34,7 @@ import javax.swing.AbstractAction;
 import javax.swing.Action;
 import javax.swing.Box;
 import javax.swing.Icon;
+import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JDialog;
 import javax.swing.JFrame;
@@ -76,9 +79,9 @@ import org.apache.openjpa.persistence.Op
  */
 @SuppressWarnings("serial")
 public class Demo extends JFrame implements Thread.UncaughtExceptionHandler {
-    private static final Dimension TAB_VIEW = new Dimension(800,600);
-    private static final Dimension OUT_VIEW = new Dimension(800,200);
-    private static final Dimension NAV_VIEW = new Dimension(400,800);
+    private static Dimension TAB_VIEW = new Dimension(800,600);
+    private static Dimension OUT_VIEW = new Dimension(800,200);
+    private static Dimension NAV_VIEW = new Dimension(400,800);
 
     /**
      * The actions invoked by this sample demonstration.
@@ -121,6 +124,7 @@ public class Demo extends JFrame impleme
      */
     public static void main(String[] args) throws Exception {
         SwingHelper.setLookAndFeel(14);
+        adjustWidgetSize();
         SwingUtilities.invokeLater(new Runnable() {
             public void run() {
                 Demo demo = new Demo();
@@ -132,12 +136,21 @@ public class Demo extends JFrame impleme
             }
         });
     }
+    
+    static void adjustWidgetSize() {
+        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+        int sw = (int)(95*screen.getWidth()/100);
+        int sh = (int)(80*screen.getHeight()/100);
+        NAV_VIEW = new Dimension(25*sw/100, sh);
+        TAB_VIEW = new Dimension(75*sw/100, 75*sh/100);
+        OUT_VIEW = new Dimension(75*sw/100, 25*sh/100);
+    }
 
     
     private Demo() {
         Thread.currentThread().setUncaughtExceptionHandler(this);
         _config = PropertyHelper.load(System.getProperty("openbook.client.config", "demo.properties"));
-        
+        setIconImage(((ImageIcon)LOGO).getImage());
         setTitle("OpenBooks: A Sample JPA 2.0 Application");
         
         _root         = new WelcomeAction("OpenBooks", "images/OpenBooks.jpg", "OpenBooks");
@@ -622,8 +635,12 @@ public class Demo extends JFrame impleme
             button.setHorizontalTextPosition(SwingConstants.RIGHT);
             button.setEnabled(true);
             button.setBorderPainted(false);
+            JLabel openJPALogo = new JLabel(Images.getIcon("images/openjpa-logo-small.png"));
+            openJPALogo.setBackground(Color.BLACK);
+
             add(button, BorderLayout.CENTER);
-            add(new JLabel(Images.getIcon("images/openjpa-log-small.png")), BorderLayout.SOUTH);
+            add(openJPALogo, BorderLayout.SOUTH);
+
             setTitle("About OpenBooks");
             setAlwaysOnTop(true);
             setResizable(false);

Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java?rev=946267&r1=946266&r2=946267&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java
(original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/server/QueryParameterBinder.java
Wed May 19 16:41:06 2010
@@ -17,7 +17,6 @@
 package openbook.server;
 
 import javax.persistence.Query;
-import javax.persistence.TypedQuery;
 
 /**
  * Decorates a query by binding parameters.



Mime
View raw message