@@ -0,0 +1,2320 @@
+/*%0D%0A * Copyright 2002-2007 the original author or authors.%0D%0A * %0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may not%0D%0A * use this file except in compliance with the License. You may obtain a copy of%0D%0A * the License at%0D%0A * %0D%0A * http://www.apache.org/licenses/LICENSE-2.0%0D%0A * %0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0D%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0D%0A * License for the specific language governing permissions and limitations under%0D%0A * the License.%0D%0A */%0D%0Apackage org.springframework.richclient.form.builder.support;%0D%0A%0D%0Aimport javax.swing.JComponent;%0D%0A%0D%0Aimport org.springframework.binding.form.FormModel;%0D%0Aimport org.springframework.richclient.form.builder.FormComponentInterceptor;%0D%0Aimport org.springframework.richclient.form.builder.FormComponentInterceptorFactory;%0D%0A%0D%0A/**%0D%0A * If a form property has a %3Ccode%3Ecaption%3C/code%3E defined in the%0D%0A * messages.properties file it will be used as the tooltip for the form%0D%0A * component.%0D%0A * %0D%0A * @author Peter De Bruycker%0D%0A */%0D%0Apublic class ToolTipInterceptorFactory implements FormComponentInterceptorFactory %7B%0D%0A%09private boolean processComponent = true;%0D%0A%0D%0A%09private boolean processLabel = true;%0D%0A%0D%0A%09public FormComponentInterceptor getInterceptor(FormModel formModel) %7B%0D%0A%09%09return new ToolTipInterceptor(formModel);%0D%0A%09%7D%0D%0A%0D%0A%09private class ToolTipInterceptor extends AbstractFormComponentInterceptor %7B%0D%0A%09%09private FormModel formModel;%0D%0A%0D%0A%09%09public ToolTipInterceptor(FormModel formModel) %7B%0D%0A%09%09%09this.formModel = formModel;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09String getCaption(String propertyName) %7B%0D%0A%09%09%09return formModel.getFieldFace(propertyName).getCaption();%0D%0A%09%09%7D%0D%0A%0D%0A%09%09public void processComponent(final String propertyName, final JComponent component) %7B%0D%0A%09%09%09if (processComponent) %7B%0D%0A%09%09%09%09component.setToolTipText(getCaption(propertyName));%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%0D%0A%09%09public void processLabel(String propertyName, JComponent label) %7B%0D%0A%09%09%09if (processLabel) %7B%0D%0A%09%09%09%09label.setToolTipText(getCaption(propertyName));%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%09public void setProcessComponent(boolean processComponent) %7B%0D%0A%09%09this.processComponent = processComponent;%0D%0A%09%7D%0D%0A%09%0D%0A%09public void setProcessLabel(boolean processLabel) %7B%0D%0A%09%09this.processLabel = processLabel;%0D%0A%09%7D%0D%0A%7D%0D%0A

fix for RCP-495