java.lang.Object
com.amalgamasimulation.desktop.ui.editor.Sections

public final class Sections extends Object
Creates sections, the form rows of a label, a field and buttons. Every method returns the first step of a builder, and the chain ends with create().

There are three kinds of editors. A standalone method takes a Supplier, and the new value goes to handler. A container method takes a WritableValue with an object, and valueExtractor reads the property. A method with the emf prefix takes a WritableValue with an EObject and edits a feature with a command. The editors with a default button (color, distributions, time series, date and time) drop it with withoutDefaultButton().

Author:
Ionov Ivan
  • Method Details

    • stringEditor

      public static TextSectionBuilder.ParentBuilder<String> stringEditor(Supplier<String> valueExtractor)
      Editor of a String in a text field.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • stringEditor

      public static <T> ContainerTextSectionBuilder.ParentBuilder<T,String> stringEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a String in a text field.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfStringEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfTextSectionBuilder.ParentBuilder<T,String> emfStringEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a String in a text field.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • textEditor

      public static <V> TextSectionBuilder.ParentBuilder<V> textEditor(Supplier<V> valueExtractor)
      Editor of a value of any type in a text field. The ValidationStrategy converts the value to text and back.
      Type Parameters:
      V - type of the value
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • textEditor

      public static <T, V> ContainerTextSectionBuilder.ParentBuilder<T,V> textEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a value of any type in a text field. The ValidationStrategy converts the value to text and back.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfTextEditor

      public static <T extends org.eclipse.emf.ecore.EObject, V> EmfTextSectionBuilder.ParentBuilder<T,V> emfTextEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a value of any type in a text field. The ValidationStrategy converts the value to text and back.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • doubleEditor

      public static TextSectionBuilder.ParentBuilder<Double> doubleEditor(Supplier<Double> valueExtractor)
      Editor of a double.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • doubleEditor

      public static <T> ContainerTextSectionBuilder.ParentBuilder<T,Double> doubleEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a double.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfDoubleEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfTextSectionBuilder.ParentBuilder<T,Double> emfDoubleEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a double.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • integerEditor

      public static TextSectionBuilder.ParentBuilder<Integer> integerEditor(Supplier<Integer> valueExtractor)
      Editor of an int.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • integerEditor

      public static <T> ContainerTextSectionBuilder.ParentBuilder<T,Integer> integerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of an int.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfIntegerEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfTextSectionBuilder.ParentBuilder<T,Integer> emfIntegerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of an int.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • integerSpinnerEditor

      public static SpinnerSectionBuilder.ParentBuilder<SpinnerSectionBuilder.RangeBuilder<Integer>> integerSpinnerEditor(Supplier<Integer> valueExtractor)
      Editor of an int in a spinner.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • integerSpinnerEditor

      public static <T> ContainerSpinnerSectionBuilder.ParentBuilder<T,Integer,ContainerSpinnerSectionBuilder.RangeBuilder<T,Integer>> integerSpinnerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of an int in a spinner.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfIntegerSpinnerEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfSpinnerSectionBuilder.ParentBuilder<T,Integer,EmfSpinnerSectionBuilder.RangeBuilder<T,Integer>> emfIntegerSpinnerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of an int in a spinner.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • doubleSpinnerEditor

      Editor of a double in a spinner. The number of digits after the point is set with digits(...).
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • doubleSpinnerEditor

      public static <T> ContainerSpinnerSectionBuilder.ParentBuilder<T,Double,ContainerSpinnerSectionBuilder.DigitsRangeBuilder<T,Double>> doubleSpinnerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a double in a spinner. The number of digits after the point is set with digits(...).
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfDoubleSpinnerEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfSpinnerSectionBuilder.ParentBuilder<T,Double,EmfSpinnerSectionBuilder.DigitsRangeBuilder<T,Double>> emfDoubleSpinnerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a double in a spinner. The number of digits after the point is set with digits(...).
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • spinnerEditor

      public static <V> SpinnerSectionBuilder.ParentBuilder<SpinnerSectionBuilder.ConverterBuilder<V>> spinnerEditor(Supplier<V> valueExtractor)
      Editor of a value of any type in a spinner. converter(...) turns the value into a number and back.
      Type Parameters:
      V - type of the value
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • spinnerEditor

      public static <T, V> ContainerSpinnerSectionBuilder.ParentBuilder<T,V,ContainerSpinnerSectionBuilder.ConverterBuilder<T,V>> spinnerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a value of any type in a spinner. converter(...) turns the value into a number and back.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfSpinnerEditor

      public static <T extends org.eclipse.emf.ecore.EObject, V> EmfSpinnerSectionBuilder.ParentBuilder<T,V,EmfSpinnerSectionBuilder.ConverterBuilder<T,V>> emfSpinnerEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a value of any type in a spinner. converter(...) turns the value into a number and back.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • colorEditor

      public static ColorSectionBuilder.ParentBuilder colorEditor(Supplier<Color> valueExtractor)
      Editor of a color. The field is painted in the color of the value, and the button opens the color dialog.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • colorEditor

      public static <T> ContainerColorSectionBuilder.ParentBuilder<T> colorEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a color. The field is painted in the color of the value, and the button opens the color dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfColorEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfColorSectionBuilder.ParentBuilder<T> emfColorEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a color. The field is painted in the color of the value, and the button opens the color dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • distributionEditor

      public static DistributionSectionBuilder.ParentBuilder distributionEditor(Supplier<com.amalgamasimulation.randomdatamodel.Distribution> valueExtractor)
      Editor of a Distribution, the button opens the distribution dialog. The right border is minus infinity by default, set the borders with Buttons.distribution().
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • distributionEditor

      public static <T> ContainerDistributionSectionBuilder.ParentBuilder<T> distributionEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a Distribution, the button opens the distribution dialog. The right border is minus infinity by default, set the borders with Buttons.distribution().
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfDistributionEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfDistributionSectionBuilder.ParentBuilder<T> emfDistributionEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a Distribution, the button opens the distribution dialog. The right border is minus infinity by default, set the borders with Buttons.distribution().
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • realDistributionEditor

      public static RealDistributionSectionBuilder.ParentBuilder realDistributionEditor(Supplier<org.apache.commons.math3.distribution.RealDistribution> valueExtractor)
      Editor of a RealDistribution, the button opens the distribution dialog.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • realDistributionEditor

      public static <T> ContainerRealDistributionSectionBuilder.ParentBuilder<T> realDistributionEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a RealDistribution, the button opens the distribution dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfRealDistributionEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfRealDistributionSectionBuilder.ParentBuilder<T> emfRealDistributionEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a RealDistribution, the button opens the distribution dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • timeSeriesEditor

      public static TimeSeriesSectionBuilder.ParentBuilder timeSeriesEditor(Supplier<com.amalgamasimulation.timeseriesdatamodel.TimeSeries> valueExtractor)
      Editor of a time series, the button opens the time series dialog.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • timeSeriesEditor

      public static <T> ContainerTimeSeriesSectionBuilder.ParentBuilder<T> timeSeriesEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a time series, the button opens the time series dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfTimeSeriesEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfTimeSeriesSectionBuilder.ParentBuilder<T> emfTimeSeriesEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a time series, the button opens the time series dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • localDateTimeEditor

      public static LocalDateTimeSectionBuilder.ParentBuilder localDateTimeEditor(Supplier<LocalDateTime> valueExtractor)
      Editor of a date and time, the button opens the date dialog. With date() only the date is edited.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • localDateTimeEditor

      public static <T> ContainerLocalDateTimeSectionBuilder.ParentBuilder<T> localDateTimeEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a date and time, the button opens the date dialog. With date() only the date is edited.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfLocalDateTimeEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfLocalDateTimeSectionBuilder.ParentBuilder<T> emfLocalDateTimeEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a date and time, the button opens the date dialog. With date() only the date is edited.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • localTimeEditor

      public static LocalTimeSectionBuilder.ParentBuilder localTimeEditor(Supplier<LocalTime> valueExtractor)
      Editor of a time of day, the button opens the time dialog.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • localTimeEditor

      public static <T> ContainerLocalTimeSectionBuilder.ParentBuilder<T> localTimeEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a time of day, the button opens the time dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfLocalTimeEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfLocalTimeSectionBuilder.ParentBuilder<T> emfLocalTimeEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a time of day, the button opens the time dialog.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • checkBoxEditor

      public static CheckBoxSectionBuilder.ParentBuilder checkBoxEditor(BooleanSupplier valueExtractor)
      Editor of a boolean as a check box.
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • checkBoxEditor

      public static <T> ContainerCheckBoxSectionBuilder.ParentBuilder<T> checkBoxEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a boolean as a check box.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfCheckBoxEditor

      public static <T extends org.eclipse.emf.ecore.EObject> EmfCheckBoxSectionBuilder.ParentBuilder<T> emfCheckBoxEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Editor of a boolean as a check box.
      Type Parameters:
      T - type of the object in the container
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • comboBoxEditor

      public static <V> ComboBoxSectionBuilder.ParentBuilder<V> comboBoxEditor(Supplier<V> valueExtractor)
      Selects an object from a list. An IObservableList passed to elements(...) keeps the list up to date.
      Type Parameters:
      V - type of the value
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • comboBoxEditor

      public static <T, V> ContainerComboBoxSectionBuilder.ParentBuilder<T,V> comboBoxEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Selects an object from a list. An IObservableList passed to elements(...) keeps the list up to date.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfComboBoxEditor

      public static <T extends org.eclipse.emf.ecore.EObject, V> EmfComboBoxSectionBuilder.ParentBuilder<T,V> emfComboBoxEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Selects an object from a list. An IObservableList passed to elements(...) keeps the list up to date. selectFromTableButton(...) adds a button that selects the object from a table.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • enumEditor

      public static <V> EnumSectionBuilder.ParentBuilder<V> enumEditor(Supplier<V> valueExtractor)
      Selects a constant of an enum from a list.
      Type Parameters:
      V - type of the value
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • enumEditor

      public static <T, V> ContainerEnumSectionBuilder.ParentBuilder<T,V> enumEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Selects a constant of an enum from a list.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfEnumEditor

      public static <T extends org.eclipse.emf.ecore.EObject, V> EmfEnumSectionBuilder.ParentBuilder<T,V> emfEnumEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Selects a constant of an enum from a list.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • autoCompleteEditor

      public static <V> AutoCompleteSectionBuilder.ParentBuilder<V> autoCompleteEditor(Supplier<V> valueExtractor)
      Selects an object from a list: the user types a part of the name and picks it from the suggestions.
      Type Parameters:
      V - type of the value
      Parameters:
      valueExtractor - reads the current value
      Returns:
      the first step of the builder
    • autoCompleteEditor

      public static <T, V> ContainerAutoCompleteSectionBuilder.ParentBuilder<T,V> autoCompleteEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Selects an object from a list: the user types a part of the name and picks it from the suggestions.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • emfAutoCompleteEditor

      public static <T extends org.eclipse.emf.ecore.EObject, V> EmfAutoCompleteSectionBuilder.ParentBuilder<T,V> emfAutoCompleteEditor(org.eclipse.core.databinding.observable.value.WritableValue<T> containerObservable)
      Selects an object from a list: the user types a part of the name and picks it from the suggestions.
      Type Parameters:
      T - type of the object in the container
      V - type of the value
      Parameters:
      containerObservable - container with the edited object
      Returns:
      the first step of the builder
    • customSectionBuilder

      public static CustomSectionBuilder.FinalBuilder customSectionBuilder(org.eclipse.swt.widgets.Composite parent)
      Row of your own elements: labels, fields, check boxes, separate buttons and your own composite. Sets SWT.INHERIT_DEFAULT on the parent, so the elements take its background.
      Parameters:
      parent - composite of the row
      Returns:
      the builder of the row
    • customEditor

      @Deprecated public static CustomSectionBuilder.FinalBuilder customEditor(org.eclipse.swt.widgets.Composite parent)
      Parameters:
      parent - composite of the row
      Returns:
      the builder of the row
    • fillLineSection

      public static void fillLineSection(org.eclipse.swt.widgets.Composite parent)
      Empty row across the parent, a vertical gap between sections.
      Parameters:
      parent - composite of the row
    • separator

      public static void separator(org.eclipse.swt.widgets.Composite parent)
      Thin horizontal line across the parent.
      Parameters:
      parent - composite of the row