Examples of SwingBindingFactory


Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

                return new AbstractDaoForm(parentFormModel,
                        "dualeventsDetails", valueHolder, masterList) {

                    @Override
                    protected JComponent createFormControl() {
                        SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();
                        TableFormBuilder formBuilder = getFormBuilder();

                        Binding bind = factory.createBoundList("commonPersons");
                        formBuilder.add(bind);
                        JPanel mainPanel = new JPanel(new BorderLayout());
                        mainPanel.add(getFormBuilder().getForm(), BorderLayout.CENTER);
                        updateControlsForState();
                        return mainPanel;
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

        this.settings = settings;
    }

    @Override
    protected JComponent createFormControl() {
        SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();
        TableFormBuilder formBuilder = getFormBuilder();

        nameEditor = formBuilder.add("name")[1];
        formBuilder.row();

        Binding binding = new EventStartBinding(getFormModel(), settings);
        formBuilder.addBinding(binding, (JComponent) null, "colSpan=1 align=left");       

        formBuilder.add(factory.createBoundComboBox("duration", EventStartBinding.createList(1, settings.getTimeslotsPerDay() + 1)));
        formBuilder.row();

        formBuilder.addTextArea("description");
        formBuilder.row();
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

                objForm = new EventForm(parentFormModel,
                        "eventsDetails", valueHolder, masterList) {

                    @Override
                    protected void addTabs() {
                        SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();

                        getFormBuilder().add(factory.createBoundComboBox(
                                "location", pool.getDao(Location.class).getAll(), "name"));

                        TableFormBuilder builder = createTab(getMessage("persons.label"));

                        final Dao<Person> personDao = pool.getDao(Person.class);

                        /****************************************************************
                         * WARNING: it is important to wrap the (person) collection in
                         * another one (here ArrayList). Otherwise the changes
                         * to the dao will have direct effect to the value in ValueHolder
                         * and newValue.equals(oldValue) == true for every change!
                         ****************************************************************/
                        final ValueHolder personHolder = new ValueHolder(new ArrayList<Person>(personDao.getAll()));
                        //1. persons => Event.set and getPersons are necessary
                        //2. personDao.getAll() => all available persons
                        //3. name => prints the name as one list item
                        ShuttleList sl = (ShuttleList) builder.add(
                                factory.createBoundShuttleList("persons",
                                personHolder, "name"))[1];
                        sl.setVisibleRowCount(10);

                        TableFormBuilder fBuilder = createTab(getMessage("features.label"));
                        final Dao<Feature> featureDao = pool.getDao(Feature.class);
                        final ValueHolder featureHolder = new ValueHolder(new ArrayList<Feature>(featureDao.getAll()));
                        sl = (ShuttleList) fBuilder.add(factory.createBoundShuttleList("features",
                                featureHolder, null))[1];
                        sl.setVisibleRowCount(10);

                        // now notify ShuttleList when collection change to update the JList
                        personDao.addListener(new PropertyChangeListener() {
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

    public ListSelectionBindingForm() {
      super(FormModelHelper.createFormModel(new Selection()));
    }

    protected JComponent createFormControl() {
      SwingBindingFactory bf = new SwingBindingFactory(getFormModel());
      TableFormBuilder formBuilder = new TableFormBuilder(bf);
      formBuilder.row();

      Map<String, Object> countryContext = new HashMap<String, Object>();
      countryContext.put(ListSelectionDialogBinder.SELECTABLE_ITEMS_HOLDER_KEY, new ValueHolder(countries));
      countryContext.put(ListSelectionDialogBinder.LABEL_PROVIDER_KEY, new LabelProvider() {
        public String getLabel(Object item) {
          Country country = (Country) item;
          return country == null ? "" : country.getName();
        }
      });
      countryContext.put(ListSelectionDialogBinder.FILTERED_KEY, Boolean.TRUE);
      countryContext.put(ListSelectionDialogBinder.FILTER_PROPERTIES_KEY, new String[] { "name" });
       
      // this works ... but unfortunately ListSelectionDialogBinder has no public constructor
//          ListSelectionDialogBinder binder = new ListSelectionDialogBinder();
//          Binding binding = binder.bind(getFormModel(), "country", countryContext);
//          formBuilder.add(binding, "colSpan=2");

            // this works if the binderSelectionStrategy is configured in richclient-application-context.xml
            formBuilder.add(bf.createBinding("country", countryContext), "colSpan=2");

            formBuilder.row();

      this.addFormValueChangeListener("country", new ChangeCountryListener());

      refreshableTownValueHolder = new RefreshableValueHolder(new Closure() {
        public Object call(Object object) {
          Country country = (Country) getValue("country");
          List<Town> towns = getTowns(country);
          if (towns == null) {
                        towns = Collections.EMPTY_LIST;
                    }
          return towns;
        }
      }, true, false);
      refreshableTownValueHolder.setValue(Collections.EMPTY_LIST);
      formBuilder
          .add(bf.createBoundComboBox("town", refreshableTownValueHolder, "name"), "colSpan=2 align=left");
      formBuilder.row();

      return formBuilder.getForm();
    }
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

            super(FormModelHelper.createFormModel(new Values()));
        }

        @Override
        protected JComponent createFormControl() {
            SwingBindingFactory bindingFactory = new SwingBindingFactory(getFormModel());
            TableFormBuilder builder = new TableFormBuilder(bindingFactory);
            builder.setLabelAttributes("colGrId=label colSpec=left:pref rowSpec=top:pref");
            builder.add(bindingFactory.createBoundShuttleList("selectedRegions", selectableRegions));
            return builder.getForm();
        }
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

      Map<String, Object> context = new HashMap<String, Object>();
      context.put(NachoCalendarDateFieldBinder.SHOW_OK_CANCEL_KEY, Boolean.TRUE);
      context.put(NachoCalendarDateFieldBinder.SHOW_WEEKNUMBERS_KEY, Boolean.TRUE);
//      context.put(NachoCalendarDateFieldBinder.DATE_FORMAT, "MM'/'yyyy");
      context.put(NachoCalendarDateFieldBinder.WORKING_DAYS_KEY, new boolean[] {true, true, true, false, false, false, false});
      final SwingBindingFactory bf = (SwingBindingFactory) getBindingFactory();
      Binding b = bf.createBinding("birthday", context);
      builder.add(b);
//      builder.add("birthday");
      builder.row();
      ConfigurableFormModel formModel = getFormModel();
      ValueModel derivedValueModel = new MessageFormatValueModel("{0} {1} was born on {2}", new ValueModel[] {
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

        fileNameField.setEnabled(enabled);
        browseButton.setEnabled(false);
    }

    protected JComponent createControl() {
        this.fileNameField = (JTextField)new SwingBindingFactory(formModel).createBinding(JTextField.class,
                formProperty).getControl();
        JLabel fileToProcess = getComponentFactory().createLabelFor(fileChooserLabel, fileNameField);
        this.browseButton = getComponentFactory().createButton("button.browse");
        BrowseActionHandler browseActionHandler = new BrowseActionHandler();
        browseButton.addActionListener(browseActionHandler);
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

    }

    public InputApplicationDialog(ValidatingFormModel formModel, String propertyName) {
        this();
        this.formModel = formModel;
        setInputField(new SwingBindingFactory(formModel).createBinding(propertyName).getControl());
    }
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

        // Now put the two forms into a split pane
        JSplitPane splitter = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
        configureSplitter(splitter, panel, getDetailForm().getControl());

        final SwingBindingFactory sbf = (SwingBindingFactory) getBindingFactory();
        TableFormBuilder formBuilder = new TableFormBuilder( sbf );
        formBuilder.getLayoutBuilder().cell( splitter, "align=default,default rowSpec=fill:default:g" );

        updateControlsForState();
View Full Code Here

Examples of org.springframework.richclient.form.binding.swing.SwingBindingFactory

        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
TOP
Copyright © 2018 www.massapi.com. 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.