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 TypeMethodDescriptionvoid
addModelFieldChangeListener
(ModelFieldChangeListener<R> listener) Adds model field change listener.org.eclipse.swt.widgets.Button
checkbox
(org.eclipse.swt.widgets.Composite parent, String label, Function<R, Boolean> valueProvider, BiConsumer<R, Boolean> valueUpdater) CreatesLabel
andButton
withSWT.CHECK
style.<T> ComboViewer
combo
(org.eclipse.swt.widgets.Composite parent, String label, Function<R, T> valueProvider, BiConsumer<R, T> valueUpdater, Collection<T> input, Function<T, String> labelProvider) CreatesLabel
and .<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) CreatesLabel
and .<T> ComboViewer
combo
(org.eclipse.swt.widgets.Composite parent, String label, Function<R, T> valueProvider, BiConsumer<R, T> valueUpdater, ComboViewer combo) CreatesLabel
and .org.eclipse.swt.widgets.Text
directory
(org.eclipse.swt.widgets.Composite parent, String label, Function<R, String> valueProvider, BiConsumer<R, String> valueUpdater) CreatesLabel
,Text
andButton
to select a directory.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
,Text
andButton
to select a directory.static int
getButtonWidthHint
(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) CreatesGroup
and list of withSWT.RADIO
style.void
Removes model field change listener.org.eclipse.swt.widgets.Text
text
(org.eclipse.swt.widgets.Composite parent, String label, Function<R, String> valueProvider, BiConsumer<R, String> valueUpdater) CreatesLabel
andText
.org.eclipse.swt.widgets.Text
text
(org.eclipse.swt.widgets.Composite parent, String label, Function<R, String> valueProvider, BiConsumer<R, String> valueUpdater, int style) CreatesLabel
andText
.
-
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) CreatesLabel
andButton
withSWT.CHECK
style. Value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- 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> valueProvider, BiConsumer<R, T> valueUpdater, Collection<T> input, Function<T, String> labelProvider) CreatesLabel
and . Viewer value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after widget value changing, notnull
input
- input for combo viewer, notnull
labelProvider
- function for viewing input values, notnull
- 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) CreatesLabel
and . Viewer value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after widget value changing, notnull
eenum
- 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
,Text
andButton
to select a directory. Text value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after combo viewer value changing, ifvalueUpdater == null
widget 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) CreatesGroup
and list of withSWT.RADIO
style. Selected item binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- radio group text, notnull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after value changing, notnull
values
- 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) CreatesLabel
andText
. Text value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after widget value changing, ifvalueUpdater == null
widget 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) CreatesLabel
andText
. Text value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after widget value changing, ifvalueUpdater == null
widget sets read only, can benull
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) CreatesLabel
,Text
andButton
to select a directory. Text value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after combo viewer value changing, ifvalueUpdater == null
widget sets read only, can benull
filterExtensions
- an array of file filter extensions, can benull
directoryProvider
- 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) CreatesLabel
and . Viewer value binds with the model through functionsvalueProvider
andlabelProvider
.- Parameters:
parent
- composite withGridLayout
and 2 columns, notnull
label
- iflabel != null
will be created label with text =label
, can benull
valueProvider
- function for computing combo viewer value after model changing, notnull
valueUpdater
- function for updating model after widget value changing, notnull
combo
- combo to use, notnull
- Returns:
- created combo viewer, not
null
-