Package org.springframework.richclient.form.binding

Examples of org.springframework.richclient.form.binding.Binding


        FormModel formModel = new DefaultFormModel(bean);

        DirtyIndicatorInterceptor interceptor = new DirtyIndicatorInterceptor(formModel);
        assertEquals(formModel, interceptor.getFormModel());

        Binding binding = new SwingBindingFactory(formModel).createBinding("property");
        JTextField field = (JTextField)binding.getControl();
        field.setColumns(25);
        assertNotNull("sanity check: binding defines no component", field);

        interceptor.processComponent("property", field);
View Full Code Here


    }

    public void testExistingModel() {
        JComboBox cb = new JComboBox(new DefaultComboBoxModel(new Object[] { "1", "2", "3" }));
        ComboBoxBinder binder = new ComboBoxBinder();
        Binding binding = binder.bind(cb, fm, "simpleProperty", Collections.EMPTY_MAP);
        assertEquals(3, ((JComboBox) binding.getControl()).getModel().getSize());
    }
View Full Code Here

    }

    protected Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context) {
        Assert.isTrue(control instanceof JScrollPane, "Control must be an instance of JScrollPane.");
        JScrollPane scrollPane = (JScrollPane)control;
        Binding viewBinding = getViewBinding(scrollPane, formModel, formPropertyPath, context);
        return new ScrollPaneDecoratedBinding(viewBinding, scrollPane);
    }
View Full Code Here

    }

    protected Binding getViewBinding(JScrollPane scrollPane, FormModel formModel, String formPropertyPath, Map context) {
        JComponent view = (JComponent)scrollPane.getViewport().getView();
        if (view == null) {
            Binding viewBinding = viewBinderSelectionStrategy.selectBinder(defaultViewType, formModel, formPropertyPath)
                    .bind(formModel, formPropertyPath, context);
            scrollPane.setViewportView(viewBinding.getControl());
            return viewBinding;
        }
        Binding existingBinding = (Binding)view.getClientProperty(BINDING_CLIENT_PROPERTY_KEY);
        if (existingBinding != null) {
            return existingBinding;
        }
        return viewBinderSelectionStrategy.selectBinder(view.getClass(), formModel, formPropertyPath).bind(
                view, formModel, formPropertyPath, context);
View Full Code Here

    //Create the form
    Form form = createForm( childModel );
    control.add( form.getControl(), BorderLayout.CENTER );

    return new Binding() {
      @Override
      public FormModel getFormModel() {
        return formModel;
      }
View Full Code Here

TOP

Related Classes of org.springframework.richclient.form.binding.Binding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.