Revision: 1243
Author:   peterdb
Date:     2006-07-27 01:39:28 -0700 (Thu, 27 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/spring-rich-c/?rev=1243&view=rev

Log Message:
-----------
renamed and moved FocusIndicatorInterceptorFactory to 
ShowCaptionInStatusBarInterceptorFactory

Added Paths:
-----------
    
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/builder/support/
    
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/builder/support/ShowCaptionInStatusBarInterceptorFactory.java

Removed Paths:
-------------
    
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/text/FocusIndicatorInterceptorFactory.java
Added: 
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/builder/support/ShowCaptionInStatusBarInterceptorFactory.java
===================================================================
--- 
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/builder/support/ShowCaptionInStatusBarInterceptorFactory.java
                             (rev 0)
+++ 
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/builder/support/ShowCaptionInStatusBarInterceptorFactory.java
     2006-07-27 08:39:28 UTC (rev 1243)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy 
of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations 
under
+ * the License.
+ */
+package org.springframework.richclient.form.builder.support;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+
+import javax.swing.JComponent;
+
+import org.springframework.binding.form.FormModel;
+import org.springframework.richclient.application.Application;
+import org.springframework.richclient.form.builder.FormComponentInterceptor;
+import 
org.springframework.richclient.form.builder.FormComponentInterceptorFactory;
+import 
org.springframework.richclient.form.builder.support.AbstractFormComponentInterceptor;
+
+/**
+ * If a form property has a caption defined in the messages.properties file 
the following
+ * happens: When component receives focus, the value is shown in the 
statusbar, when the
+ * component loses focus, the statusbar is emptied.
+ * 
+ * @author Peter De Bruycker
+ */
+public class ShowCaptionInStatusBarInterceptorFactory implements 
FormComponentInterceptorFactory {
+
+    public FormComponentInterceptor getInterceptor( FormModel formModel ) {
+        return new FocusIndicatorInterceptor( formModel );
+    }
+
+    private class FocusIndicatorInterceptor extends 
AbstractFormComponentInterceptor {
+
+        private FormModel formModel;
+
+        public FocusIndicatorInterceptor( FormModel formModel ) {
+            this.formModel = formModel;
+        }
+
+        private String getCaption( String propertyName ) {
+            String caption = formModel.getFieldFace( propertyName 
).getCaption();
+
+            if( caption.contains( ".caption" ) ) {
+                // FIXME dirty hack, otherwise "propertyName.caption" is shown 
in the
+                // status bar
+                return null;
+            }
+
+            return caption;
+        }
+
+        public void processComponent( final String propertyName, final 
JComponent component ) {
+            component.addFocusListener( new FocusListener() {
+                public void focusGained( FocusEvent e ) {
+                    if( Application.instance().getActiveWindow() != null ) {
+                        String caption = getCaption( propertyName );
+                        if( caption != null ) {
+                            
Application.instance().getActiveWindow().getStatusBar().setMessage( caption );
+                        }
+                    }
+                }
+
+                public void focusLost( FocusEvent e ) {
+                    if( Application.instance().getActiveWindow() != null ) {
+                        
Application.instance().getActiveWindow().getStatusBar().setMessage( "" );
+                    }
+                }
+            } );
+        }
+    }
+}

Deleted: 
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/text/FocusIndicatorInterceptorFactory.java
===================================================================
--- 
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/text/FocusIndicatorInterceptorFactory.java
     2006-07-26 16:44:04 UTC (rev 1242)
+++ 
trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/text/FocusIndicatorInterceptorFactory.java
     2006-07-27 08:39:28 UTC (rev 1243)
@@ -1,74 +0,0 @@
-/*
- * Copyright 2002-2004 the original author or authors.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy 
of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations 
under
- * the License.
- */
-package org.springframework.richclient.text;
-
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-
-import javax.swing.JComponent;
-
-import org.springframework.binding.form.FormModel;
-import org.springframework.richclient.application.Application;
-import org.springframework.richclient.form.builder.FormComponentInterceptor;
-import 
org.springframework.richclient.form.builder.FormComponentInterceptorFactory;
-import 
org.springframework.richclient.form.builder.support.AbstractFormComponentInterceptor;
-
-/**
- * If a form property has an entry "caption.propertyName" in the
- * messages.properties file the following happens: When component receives
- * focus, the value is shown in the statusbar, when the component loses focus,
- * the statusbar is emptied.
- * 
- * @author Peter De Bruycker
- */
-public class FocusIndicatorInterceptorFactory implements 
FormComponentInterceptorFactory {
-
-    public FormComponentInterceptor getInterceptor(FormModel formModel) {
-        return new FocusIndicatorInterceptor(formModel);
-    }
-
-    private class FocusIndicatorInterceptor extends 
AbstractFormComponentInterceptor {
-
-        private FormModel formModel;
-
-        public FocusIndicatorInterceptor(FormModel formModel) {
-            this.formModel = formModel;
-        }
-
-        private String getCaption(String propertyName) {
-            return formModel.getFieldFace(propertyName).getCaption();
-        }
-
-        public void processComponent(final String propertyName, final 
JComponent component) {
-            component.addFocusListener(new FocusListener() {
-                public void focusGained(FocusEvent e) {
-                    if (Application.instance().getActiveWindow() != null) {
-                        String caption = getCaption(propertyName);
-                        if (caption != null) {
-                            
Application.instance().getActiveWindow().getStatusBar().setMessage(caption);
-                        }
-                    }
-                }
-
-                public void focusLost(FocusEvent e) {
-                    if (Application.instance().getActiveWindow() != null) {
-                        
Application.instance().getActiveWindow().getStatusBar().setMessage("");
-                    }
-                }
-            });
-        }
-    }
-}
\ No newline at end of file


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to