Class Buttons
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.Buttons
Creates buttons for
addButton(...) of the sections. Sections are of three kinds: standalone (the value comes from a Supplier,
for example Sections.doubleEditor(() -> value)), container (a property of an object in a WritableValue,
for example Sections.doubleEditor(writableValue)) and EMF (a feature of an EObject in a WritableValue,
for example Sections.emfDoubleEditor(writableValue)). A button can be added only to a section of a fitting kind:
simpleButton()and the built-in buttons (refresh,clear,color,distribution,realDistribution,timeSeries,localDateTime,localTime,openFile,saveFile,openDirectory,highlight,navigate,showProperty) work in all three kinds;containerButton(),selectElementFromTable()andselectElementFromGef()work in container and EMF sections;emfButton(),selectEmfElementFromTable(),selectElementsFromTable()andselectEmfElementFromGef()work only in EMF sections;separateButton()andcheckBox()are added directly tocustomSectionBuilder.
addButton(...) on a nested text, combobox or autocomplete editor places the button
after that editor and passes its current value to the action. EMF editors also accept emfButton().
highlight(), navigate(), showProperty(), selectElementFromGef() and selectEmfElementFromGef()
send an event to IEventBroker. On a BasePage the broker comes by itself. Outside it pass the broker
with eventBroker(...), otherwise a click throws NullPointerException.- Author:
- Ionov Ivan
-
Method Summary
Modifier and TypeMethodDescriptionstatic CheckBoxButtonPropertiescheckBox()Check box in acustomSectionBuilderrow,checkBoxEditorof that builder adds it.static <V> ClearButtonProperties<V> clear()Writesnull.static ColorButtonPropertiescolor()Opens the color dialog.static <T,V> ImplContainerButtonProperties <T, V> Customizable button of a container section: the action gets the object and the value.static DistributionButtonPropertiesOpens theDistributiondialog.static <T extends org.eclipse.emf.ecore.EObject,V>
ImplEmfButtonProperties<T, V> Customizable button of an EMF section: the action gets the object and the feature.static <V> HighlightButtonProperties<V> CallseventBroker.send(PlatformTopics.HIGHLIGHT, value).Opens the date and time dialog.static LocalTimeButtonPropertiesOpens the time dialog.static <V> NavigateButtonProperties<V> navigate()CallseventBroker.send(PlatformTopics.NAVIGATE_TO, value).Opens the folder dialog and writes the path.static OpenFileButtonPropertiesopenFile()Opens the file dialog and writes the path.Opens theRealDistributiondialog.static <V> RefreshButtonProperties<V> refresh()Reads the value again and shows it in the field.static SaveFileButtonPropertiessaveFile()Opens the save dialog and writes the path.static <T,V> SelectElementFromGefButtonProperties <T, V> The same asselectEmfElementFromGef()for a container section, but onlycustomAction(...)writes the object.static <T,V> SelectElementFromTableButtonProperties <T, V> Opens a table of the elements, the selected element becomes the value.static <T extends org.eclipse.emf.ecore.EObject,V>
SelectElementsFromTableButtonProperties<T, V> Opens a table with check boxes for a many-valued feature and writes the change with a command.static <T extends org.eclipse.emf.ecore.EObject,V>
SelectEmfElementFromGefButtonProperties<T, V> Waits for an object selected in the GEF editor that passesfilter(...)and writes it with a command.static <T extends org.eclipse.emf.ecore.EObject,V>
SelectEmfElementFromTableButtonProperties<T, V> Opens a table of the elements and writes the selected element to the feature with a command.static SeparateButtonPropertiesIndependent button in acustomSectionBuilderrow.static <V> ShowPropertyButtonProperties<V> CallseventBroker.send(PlatformTopics.PROPERTY_PERSPECTIVE_CHANGED, value).static <V> ImplSimpleButtonProperties<V> The most customizable button: the action inaction(...)gets the current value.static TimeSeriesButtonPropertiesOpens the time series dialog.
-
Method Details
-
separateButton
Independent button in acustomSectionBuilderrow.handler(...)sets the action, without it a click does nothing.- Returns:
- the properties of the button
-
simpleButton
The most customizable button: the action inaction(...)gets the current value.- Type Parameters:
V- type of the value- Returns:
- the properties of the button
-
containerButton
Customizable button of a container section: the action gets the object and the value.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
emfButton
Customizable button of an EMF section: the action gets the object and the feature.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
color
Opens the color dialog. The default button ofcolorEditor.- Returns:
- the properties of the button
-
checkBox
Check box in acustomSectionBuilderrow,checkBoxEditorof that builder adds it.- Returns:
- the properties of the button
-
refresh
Reads the value again and shows it in the field.- Type Parameters:
V- type of the value- Returns:
- the properties of the button
-
clear
Writesnull.action(...)sets your own value instead ofnull.- Type Parameters:
V- type of the value- Returns:
- the properties of the button
-
distribution
Opens theDistributiondialog. The default button ofdistributionEditor, the right border is minus infinity by default.- Returns:
- the properties of the button
-
realDistribution
Opens theRealDistributiondialog. The default button ofrealDistributionEditor.- Returns:
- the properties of the button
-
timeSeries
Opens the time series dialog. The default button oftimeSeriesEditor.- Returns:
- the properties of the button
-
openFile
Opens the file dialog and writes the path. WithmultipleFiles()several files can be selected.- Returns:
- the properties of the button
-
saveFile
Opens the save dialog and writes the path.- Returns:
- the properties of the button
-
openDirectory
Opens the folder dialog and writes the path.- Returns:
- the properties of the button
-
localDateTime
Opens the date and time dialog. The default button oflocalDateTimeEditor.- Returns:
- the properties of the button
-
localTime
Opens the time dialog. The default button oflocalTimeEditor.- Returns:
- the properties of the button
-
selectEmfElementFromTable
public static <T extends org.eclipse.emf.ecore.EObject,V> SelectEmfElementFromTableButtonProperties<T,V> selectEmfElementFromTable()Opens a table of the elements and writes the selected element to the feature with a command.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
selectElementFromTable
Opens a table of the elements, the selected element becomes the value.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
selectElementsFromTable
public static <T extends org.eclipse.emf.ecore.EObject,V> SelectElementsFromTableButtonProperties<T,V> selectElementsFromTable()Opens a table with check boxes for a many-valued feature and writes the change with a command.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
selectEmfElementFromGef
public static <T extends org.eclipse.emf.ecore.EObject,V> SelectEmfElementFromGefButtonProperties<T,V> selectEmfElementFromGef()Waits for an object selected in the GEF editor that passesfilter(...)and writes it with a command. CallseventBroker.send(PlatformTopics.WAITING_FOR_FILTERED_OBJECT_SELECTION, request). Withoutfilter(...)a click throwsNullPointerException.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
selectElementFromGef
The same asselectEmfElementFromGef()for a container section, but onlycustomAction(...)writes the object.- Type Parameters:
T- type of the object in the containerV- type of the value- Returns:
- the properties of the button
-
highlight
CallseventBroker.send(PlatformTopics.HIGHLIGHT, value). NeedsIEventBroker, see the class description.- Type Parameters:
V- type of the value- Returns:
- the properties of the button
-
showProperty
CallseventBroker.send(PlatformTopics.PROPERTY_PERSPECTIVE_CHANGED, value). NeedsIEventBroker, see the class description. The property panel shows the value if it has a page for its class.- Type Parameters:
V- type of the value- Returns:
- the properties of the button
-