1 7 8 package org.jdesktop.jdnc.markup.attr; 9 10 import org.jdesktop.swing.data.DataModel; 11 import org.jdesktop.swing.data.DefaultTableModelExt; 12 import org.jdesktop.swing.data.TableModelExtAdapter; 13 14 import org.jdesktop.swing.binding.Binding; 15 import org.jdesktop.swing.binding.BindException; 16 17 import org.jdesktop.swing.JXTable; 18 import org.jdesktop.swing.decorator.FilterPipeline; 19 import org.jdesktop.swing.form.JForm; 20 import org.jdesktop.swing.form.RowSelector; 21 22 import org.jdesktop.jdnc.JNForm; 23 import org.jdesktop.jdnc.JNTable; 24 25 import org.jdesktop.jdnc.markup.elem.FormElement; 26 27 import javax.swing.JTable ; 28 import javax.swing.event.TableModelEvent ; 29 import javax.swing.event.TableModelListener ; 30 31 import net.openmarkup.ApplierException; 32 import net.openmarkup.AttributeApplier; 33 import net.openmarkup.Realizable; 34 35 36 39 public class FormAttributes { 40 41 public static final AttributeApplier dataApplier = new AttributeApplier() { 42 public void apply(Realizable target, String namespaceURI, 43 String attributeName, String attributeValue) 44 throws ApplierException { 45 Object dataModel = BaseAttribute.getReferencedObject(target, attributeValue); 46 JNForm form = (JNForm) target.getObject(); 47 ((FormElement)target).handleBinding(form, dataModel); 48 } 49 }; 50 51 54 public static final AttributeApplier tracksApplier = new AttributeApplier() { 55 public void apply(Realizable target, String namespaceURI, 56 String attributeName, String attributeValue) 57 throws ApplierException { 58 Object selectionComponent = BaseAttribute.getReferencedObject(target, 59 attributeValue); 60 JNForm form = (JNForm) target.getObject(); 61 if (selectionComponent instanceof JNTable) { 62 Binding bindings[] = form.getForm().getBindings(); 63 DataModel model = null; 64 if (bindings.length > 0) { 65 model = bindings[0].getDataModel(); 66 } 67 final JTable table = ((JNTable)selectionComponent).getTable(); 68 new org.jdesktop.swing.form.RowSelector(table, model); 69 92 } 93 } 94 }; 95 } 97 | Popular Tags |