Package com._1c.g5.v8.dt.common.ui
Class FieldFactory<R>
- java.lang.Object
-
- com._1c.g5.v8.dt.common.ui.FieldFactory<R>
-
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 withGridLayoutwith 2 columns.
-
-
Constructor Summary
Constructors Constructor Description FieldFactory(org.eclipse.core.databinding.observable.value.IObservableValue<R> masterModel)Creates new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddModelFieldChangeListener(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> valueProvider, BiConsumer<R,T> valueUpdater, Collection<T> input, 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.voidremoveModelFieldChangeListener(ModelFieldChangeListener<R> listener)Removes 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 Detail
-
FieldFactory
public FieldFactory(org.eclipse.core.databinding.observable.value.IObservableValue<R> masterModel)
Creates new instance.- Parameters:
masterModel- the model object, that provides fiel values, notnull
-
-
Method Detail
-
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
public void addModelFieldChangeListener(ModelFieldChangeListener<R> listener)
Adds model field change listener.- Parameters:
listener- model field change listener, notnull
-
removeModelFieldChangeListener
public void removeModelFieldChangeListener(ModelFieldChangeListener<R> listener)
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> valueProvider, BiConsumer<R,T> valueUpdater, Collection<T> input, Function<T,String> labelProvider)
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, notnullinput- input for combo viewer, notnulllabelProvider- 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)
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
-
-