Class FieldFactory<R>

java.lang.Object
com._1c.g5.v8.dt.common.ui.FieldFactory<R>
Direct Known Subclasses:
DevelopmentProcessSettingsFieldFactory

public class FieldFactory<R> extends Object
Factory for creating field for observable master entity for patter Master-Detail. If observable value is empty fields is disabled. Field creates with label and supposed to adds in component with GridLayout with 2 columns.
  • Constructor Details

    • FieldFactory

      public FieldFactory(org.eclipse.core.databinding.observable.value.IObservableValue<R> masterModel)
      Creates new instance.
      Parameters:
      masterModel - the model object, that provides fiel values, not null
  • Method Details

    • getButtonWidthHint

      public static int getButtonWidthHint(org.eclipse.swt.widgets.Button button)
      Compute given button width.
      Parameters:
      button - button to compute width for, cannot be null
      Returns:
      button width
    • addModelFieldChangeListener

      public void addModelFieldChangeListener(ModelFieldChangeListener<R> listener)
      Adds model field change listener.
      Parameters:
      listener - model field change listener, not null
    • removeModelFieldChangeListener

      public void removeModelFieldChangeListener(ModelFieldChangeListener<R> listener)
      Removes model field change listener.
      Parameters:
      listener - model field change listener, not null
    • checkbox

      public org.eclipse.swt.widgets.Button checkbox(org.eclipse.swt.widgets.Composite parent, String label, Function<R,Boolean> valueProvider, BiConsumer<R,Boolean> valueUpdater)
      Creates Label and Button with SWT.CHECK style. Value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after widget value changing, not null
      Returns:
      created button, not null
    • combo

      public <T> ComboViewer combo(org.eclipse.swt.widgets.Composite parent, String label, Function<R,T> modelMapper, BiConsumer<R,T> valueUpdater, Collection<T> selectableElements, Function<T,String> labelProvider)
      Creates Label and . Viewer value binds with the model through functions valueProvider and labelProvider.
      Type Parameters:
      T - Type of input values.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      modelMapper - Transforms values from model. Whenever model changes, the supplied mapper will be used to transform the model value into what will be then propagated as combo's selection (which should me among input values). Must not be null but may return null if selection is not to be changed.
      valueUpdater - If specified, will be called whenever combo selection changes and is not empty. First argument will be model value and second argument will be whatever is selected in combo. If valueUpdater is null or selection is empty, nothing will happen.
      selectableElements - Elements that can be selected in combo. Must not be null.
      labelProvider - Maps values from selectableElements to text labels shown in combo. Must not be null.
      Returns:
      created combo viewer, not null
    • combo

      public <T> ComboViewer combo(org.eclipse.swt.widgets.Composite parent, String label, Function<R,T> valueProvider, BiConsumer<R,T> valueUpdater, org.eclipse.emf.ecore.EEnum eenum)
      Creates Label and . Viewer value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after widget value changing, not null
      eenum - the representation of the model object for creatin viewer input and label provider, not null
      Returns:
      created combo viewer, not null
    • directory

      public org.eclipse.swt.widgets.Text directory(org.eclipse.swt.widgets.Composite parent, String label, Function<R,String> valueProvider, BiConsumer<R,String> valueUpdater)
      Creates Label, Text and Button to select a directory. Text value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after combo viewer value changing, if valueUpdater == null widget sets read only, can be null
      Returns:
      created text, not null
    • radioGroup

      public <T> List<org.eclipse.swt.widgets.Button> radioGroup(org.eclipse.swt.widgets.Composite parent, String label, Function<R,T> valueProvider, BiConsumer<R,T> valueUpdater, Map<String,T> values)
      Creates Group and list of with SWT.RADIO style. Selected item binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - radio group text, not null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after value changing, not null
      values - map of creating items: key - item text, value - item value, not null
      Returns:
      list of created buttons, not null
    • text

      public org.eclipse.swt.widgets.Text text(org.eclipse.swt.widgets.Composite parent, String label, Function<R,String> valueProvider, BiConsumer<R,String> valueUpdater)
      Creates Label and Text. Text value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after widget value changing, if valueUpdater == null widget sets read only, can be null
      Returns:
      created text, not null
    • text

      public org.eclipse.swt.widgets.Text text(org.eclipse.swt.widgets.Composite parent, String label, Function<R,String> valueProvider, BiConsumer<R,String> valueUpdater, int style)
      Creates Label and Text. Text value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after widget value changing, if valueUpdater == null widget sets read only, can be null
      style - style for control constructor
      Returns:
      created text, not null
    • file

      public org.eclipse.swt.widgets.Composite file(org.eclipse.swt.widgets.Composite parent, String label, Function<R,String> valueProvider, BiConsumer<R,String> valueUpdater, String[] filterExtensions, Function<R,String> directoryProvider, Consumer<org.eclipse.swt.events.ModifyEvent> textModifyConsumer)
      Creates Label, Text and Button to select a directory. Text value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after combo viewer value changing, if valueUpdater == null widget sets read only, can be null
      filterExtensions - an array of file filter extensions, can be null
      directoryProvider - function to provide directory, not null
      Returns:
      created text, not null
    • combo

      public <T> ComboViewer combo(org.eclipse.swt.widgets.Composite parent, String label, Function<R,T> valueProvider, BiConsumer<R,T> valueUpdater, ComboViewer combo)
      Creates Label and . Viewer value binds with the model through functions valueProvider and labelProvider.
      Parameters:
      parent - composite with GridLayout and 2 columns, not null
      label - if label != null will be created label with text = label, can be null
      valueProvider - function for computing combo viewer value after model changing, not null
      valueUpdater - function for updating model after widget value changing, not null
      combo - combo to use, not null
      Returns:
      created combo viewer, not null