Package com._1c.g5.v8.dt.common.ui
Class FieldFactory<R>
java.lang.Object
com._1c.g5.v8.dt.common.ui.FieldFactory<R>
- Direct Known Subclasses:
DevelopmentProcessSettingsFieldFactory
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 Summary
ConstructorsConstructorDescriptionFieldFactory(org.eclipse.core.databinding.observable.value.IObservableValue<R> masterModel) Creates new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModelFieldChangeListener(ModelFieldChangeListener<R> listener) Adds model field change listener.org.eclipse.swt.widgets.Buttoncheckbox(org.eclipse.swt.widgets.Composite parent, String label, Function<R, Boolean> valueProvider, BiConsumer<R, Boolean> valueUpdater) CreatesLabelandButtonwithSWT.CHECKstyle.<T> ComboViewercombo(org.eclipse.swt.widgets.Composite parent, String label, Function<R, T> modelMapper, BiConsumer<R, T> valueUpdater, Collection<T> selectableElements, Function<T, String> labelProvider) CreatesLabeland .<T> ComboViewercombo(org.eclipse.swt.widgets.Composite parent, String label, Function<R, T> valueProvider, BiConsumer<R, T> valueUpdater, org.eclipse.emf.ecore.EEnum eenum) CreatesLabeland .<T> ComboViewercombo(org.eclipse.swt.widgets.Composite parent, String label, Function<R, T> valueProvider, BiConsumer<R, T> valueUpdater, ComboViewer combo) CreatesLabeland .org.eclipse.swt.widgets.Textdirectory(org.eclipse.swt.widgets.Composite parent, String label, Function<R, String> valueProvider, BiConsumer<R, String> valueUpdater) CreatesLabel,TextandButtonto select a directory.org.eclipse.swt.widgets.Compositefile(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) CreatesLabel,TextandButtonto select a directory.static intgetButtonWidthHint(org.eclipse.swt.widgets.Button button) Compute given button width.<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) CreatesGroupand list of withSWT.RADIOstyle.voidRemoves model field change listener.org.eclipse.swt.widgets.Texttext(org.eclipse.swt.widgets.Composite parent, String label, Function<R, String> valueProvider, BiConsumer<R, String> valueUpdater) CreatesLabelandText.org.eclipse.swt.widgets.Texttext(org.eclipse.swt.widgets.Composite parent, String label, Function<R, String> valueProvider, BiConsumer<R, String> valueUpdater, int style) CreatesLabelandText.
-
Constructor Details
-
FieldFactory
Creates new instance.- Parameters:
masterModel- the model object, that provides fiel values, notnull
-
-
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 benull- Returns:
- button width
-
addModelFieldChangeListener
Adds model field change listener.- Parameters:
listener- model field change listener, notnull
-
removeModelFieldChangeListener
Removes model field change listener.- Parameters:
listener- model field change listener, notnull
-
checkbox
public org.eclipse.swt.widgets.Button checkbox(org.eclipse.swt.widgets.Composite parent, String label, Function<R, Boolean> valueProvider, BiConsumer<R, Boolean> valueUpdater) CreatesLabelandButtonwithSWT.CHECKstyle. Value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after widget value changing, notnull- 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) CreatesLabeland . Viewer value binds with the model through functionsvalueProviderandlabelProvider.- Type Parameters:
T- Type of input values.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullmodelMapper- 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 amonginputvalues). Must not benullbut may returnnullif 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. IfvalueUpdaterisnullor selection is empty, nothing will happen.selectableElements- Elements that can be selected in combo. Must not benull.labelProvider- Maps values fromselectableElementsto text labels shown in combo. Must not benull.- 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) CreatesLabeland . Viewer value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after widget value changing, notnulleenum- the representation of the model object for creatin viewer input and label provider, notnull- 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) CreatesLabel,TextandButtonto select a directory. Text value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after combo viewer value changing, ifvalueUpdater == nullwidget sets read only, can benull- 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) CreatesGroupand list of withSWT.RADIOstyle. Selected item binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- radio group text, notnullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after value changing, notnullvalues- map of creating items: key - item text, value - item value, notnull- 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) CreatesLabelandText. Text value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after widget value changing, ifvalueUpdater == nullwidget sets read only, can benull- 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) CreatesLabelandText. Text value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after widget value changing, ifvalueUpdater == nullwidget sets read only, can benullstyle- 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) CreatesLabel,TextandButtonto select a directory. Text value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after combo viewer value changing, ifvalueUpdater == nullwidget sets read only, can benullfilterExtensions- an array of file filter extensions, can benulldirectoryProvider- function to provide directory, notnull- 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) CreatesLabeland . Viewer value binds with the model through functionsvalueProviderandlabelProvider.- Parameters:
parent- composite withGridLayoutand 2 columns, notnulllabel- iflabel != nullwill be created label with text =label, can benullvalueProvider- function for computing combo viewer value after model changing, notnullvalueUpdater- function for updating model after widget value changing, notnullcombo- combo to use, notnull- Returns:
- created combo viewer, not
null
-