Package org.springframework.richclient.form.builder

Examples of org.springframework.richclient.form.builder.TableFormBuilder


        // Avoid the default viewport size of 450,400
        Dimension ps = masterTable.getPreferredSize();
        masterTable.setPreferredScrollableViewportSize(ps);

        TableFormBuilder formBuilder = new TableFormBuilder(getBindingFactory());
        formBuilder.getLayoutBuilder().cell(createMainPanel(),
                "align=default,default rowSpec=fill:default:g");

        updateControlsForState();

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


    /**
     * Construct the form with the username and password fields.
     */
    protected JComponent createFormControl() {
        TableFormBuilder formBuilder = new TableFormBuilder( getBindingFactory() );
        usernameField = formBuilder.add( LoginDetails.PROPERTY_USERNAME )[1];
        formBuilder.row();
        passwordField = formBuilder.addPasswordField( LoginDetails.PROPERTY_PASSWORD )[1];
        return formBuilder.getForm();
    }
View Full Code Here

      super(FormModelHelper.createFormModel(new ParentPOJO(), "parent"), "parent");
    }

    @Override
    protected JComponent createFormControl() {
      TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
      builder.add("parentName");
      builder.row();
      builder.add("parentDescription");
      JPanel panel = new JPanel(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC,
          FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, new RowSpec[] {
          FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
          FormFactory.UNRELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
          FormFactory.DEFAULT_ROWSPEC, FormFactory.UNRELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
          FormFactory.UNRELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
      CellConstraints cc = new CellConstraints();
      panel.add(new JLabel(getMessage("parentForm.label")), cc.xy(1, 1));
      panel.add(builder.getForm(), cc.xy(3, 3));
      CommandGroup parentFormcommandGroup = CommandGroup.createCommandGroup(new ActionCommand[] {
          getEnableFormModelCommand(), getReadOnlyFormModelCommand(), getValidatingFormModelCommand() });
      panel.add(parentFormcommandGroup.createButtonBar(), cc.xy(3, 5));
      panel.add(new JLabel(getMessage("childForm.label")), cc.xy(1, 7));
      childForm = new ChildForm();
View Full Code Here

      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

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

    @Override
    protected JComponent createFormControl() {
      TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
      builder.add("name");
      builder.row();
      builder.add("surname");
      builder.row();
      builder.add("title");
      builder.row();
      ConfigurableFormModel formModel = getFormModel();
      ValueModel derivedValueModel = new MessageFormatValueModel("{2} {1} {0}", new ValueModel[] {
          getValueModel("name"), getValueModel("surname"), getValueModel("title") });
      FieldMetadata fieldMetaData = new ReadOnlyFieldMetadata(getFormModel(), String.class);
      formModel.add("derivedValue", derivedValueModel, fieldMetaData);
      builder.add("derivedValue");
      return builder.getForm();
    }
View Full Code Here

        }

        @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

    public RegExpForm() {
      super(FormModelHelper.createFormModel(new RegExpValue(), false));
    }

    protected JComponent createFormControl() {
      TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
      builder.add("regExp");
      builder.row();
      builder.add("value");
      newSingleLineResultsReporter(BasicRegExpConstraintDialog.this);
      JPanel panel = new JPanel();
      panel.add(builder.getForm());
      panel.add(createValidateCommand().createButton());
      return panel;
    }
View Full Code Here

    public StringLengthConstraintForm() {
      super(FormModelHelper.createFormModel(new StringLengthValue(), false, "stringLengthValue"));
    }

    protected JComponent createFormControl() {
      TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
      builder.add("relationalOperator");
      builder.row();
      builder.add("length");
      builder.row();
      builder.add("minLength");
      builder.row();
      builder.add("maxLength");
      builder.row();
      builder.add("rangeConstraint");
      builder.row();
      builder.add("value");
      newSingleLineResultsReporter(StringLenghtConstraintDialog.this);
      JPanel panel = new JPanel();
      panel.add(builder.getForm());
      panel.add(createValidateCommand().createButton());
      return panel;
    }
View Full Code Here

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

    @Override
    protected JComponent createFormControl() {
      TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
      builder.add("primitiveInt");
      newSingleLineResultsReporter(NumberConversionDialog.this);
      return builder.getForm();
    }
View Full Code Here

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

    @Override
    protected JComponent createFormControl() {
      TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
      builder.add("name");
      builder.row();
      builder.add("surname");
      builder.row();

      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[] {
          getValueModel("name"), getValueModel("surname"), getValueModel("birthday") });
      FieldMetadata fieldMetaData = new ReadOnlyFieldMetadata(getFormModel(), String.class);
      formModel.add("derivedBirthday", derivedValueModel, fieldMetaData);
      builder.add("derivedBirthday");
      return builder.getForm();
    }
View Full Code Here

TOP

Related Classes of org.springframework.richclient.form.builder.TableFormBuilder

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.