Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Scout/Concepts/SmartField
The Scout documentation has been moved to https://eclipsescout.github.io/.
Specific type of The Scout documentation has been moved to https://eclipsescout.github.io/. to use a Smart association (with The Scout documentation has been moved to https://eclipsescout.github.io/. or The Scout documentation has been moved to https://eclipsescout.github.io/.).
- implements: The Scout documentation has been moved to https://eclipsescout.github.io/.
- extends: The Scout documentation has been moved to https://eclipsescout.github.io/.
Contents
Description
A SmartField gives a selection of available values to the client. The field gets his contents from a CodeType or a LookupCall.
If the client doesn't write something into the SmartField, it will show all available values. (Lookup-Service Statement <all></all>
)
If the client write text into the field, it will show all values, which starts with this text. (Lookup-Service Statement <text></text>
)
Wildcards like *
, %
or _
are also possible to write into the SmartField.
The functions:
- setValue(value)
- getValue()
use the key of the CodeType or the LookupCall. (Lookup-Service Statement <key></key>
)
Screenshot
Type | RAP | SWT | Swing | Swing Rayo |
---|---|---|---|---|
Without values | ||||
With text | ||||
With text and wildcard |
Properties
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
See also the The Scout documentation has been moved to https://eclipsescout.github.io/. and the The Scout documentation has been moved to https://eclipsescout.github.io/. pages for the properties that all fields have in common.
The Scout documentation has been moved to https://eclipsescout.github.io/.: overwrites the property of The Scout documentation has been moved to https://eclipsescout.github.io/. of the CodeType. If true the CodeType will be displayed as a tree, if false it will be displayed as a list.
Events
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
See also the The Scout documentation has been moved to https://eclipsescout.github.io/. and the The Scout documentation has been moved to https://eclipsescout.github.io/. pages for the events that all fields have in common.
Concepts
Replace the SmartFields proposal table
The proposal table can be replaced or extended by an own implementation. This feature is primarily used for adding more columns to a smart field. How to get there:
-
Write your own table
implements org.eclipse.scout.rt.client.ui.form.fields.smartfield.IContentAssistFieldTable<KEY_TYPE>
or extend the default tableextends org.eclipse.scout.rt.client.ui.form.fields.smartfield.ContentAssistFieldTable<KEY>
providing already a key and text column and several utility functions. This table can be written in its own class file or as an inner class of the smart field. -
In case the table is implemented in its own compilation unit the
org.eclipsescout.demo.widgets.client.ui.forms.SmartFieldForm.MainBox.GroupBox.LeftBox.ListWithTableProposalField.getConfiguredContentAssistTable()
must be implemented and return the table class. -
To provide additional data to the created table use the
org.eclipse.scout.rt.shared.services.lookup.ILookupRow.setAdditionalTableRowData(AbstractTableRowData)
method. Create your own table row data class (a simple property bean with access methods name-matching with the column names and add it to the lookup row in the lookup service.
Example
Smart Field
public class SmartField extends AbstractSmartField<Long> { @Override protected String getConfiguredLabel() { return "A smart field"; } @Override protected Class<? extends ILookupCall<Long>> getConfiguredLookupCall() { return CompanyLookupCall.class; } public class Table extends ContentAssistFieldTable<Long> { @Override protected String getConfiguredDefaultIconId() { return Icons.WeatherSnow; } @Override protected boolean getConfiguredHeaderVisible() { return true; } @Order(40) public class AdditionalInfoColumn extends AbstractStringColumn { @Override protected String getConfiguredHeaderText() { return TEXTS.get("AdditionalInfo"); } @Override protected int getConfiguredWidth() { return 200; } } @Order(50) public class CompanyTypeColumn extends AbstractSmartColumn<Long> { @Override protected String getConfiguredHeaderText() { return TEXTS.get("CompanyType"); } @Override protected int getConfiguredWidth() { return 200; } @Override protected Class<? extends ILookupCall<Long>> getConfiguredLookupCall() { return CompanyTypeLookupCall.class; } @Override protected void execDecorateCell(Cell cell, ITableRow row) throws ProcessingException { decorateCellWithLookupRow(cell, row); } } } }
Lookup call
public class CompanyLookupCall extends LocalLookupCall<Long> { private static final long serialVersionUID = 1L; @Override protected List<ILookupRow<Long>> execCreateLookupRows() throws ProcessingException { ArrayList<ILookupRow<Long>> rows = new ArrayList<ILookupRow<Long>>(); rows.add(createLookupRow(1L, "Business Systems Integration AG", "World best company.", 3L, Icons.WeatherSun, true)); rows.add(createLookupRow(2L, "Eclipse", "Open source stuff.", 1L, Icons.WeatherCloudy, false)); rows.add(createLookupRow(3L, "Google", "Also a fancy company.", 1L, null, false)); // create some more rows for (int i = 4; i < 120; i++) { rows.add(createLookupRow(4L, "company" + String.format("%03d", i), "A company with id " + String.format("%03d", i) + ".", 3L, null, false)); } return rows; } private LookupRow<Long> createLookupRow(long id, String name, String detail, long companyType, String iconId, boolean bold) { CompanySmartTableData addTableData = new CompanySmartTableData(detail, companyType); LookupRow<Long> result = new LookupRow<Long>(id, name, iconId, null, null, null, bold ? FontSpec.parse("bold") : null); result.setAdditionalTableRowData(addTableData); return result; } }
Table row data
public class CompanySmartTableData extends AbstractTableRowData { private static final long serialVersionUID = 1L; public static final String additionalInfo = "additionalInfo"; public static final String companyType = "companyType"; private String m_additionalInfo; private Long m_companyType; public CompanySmartTableData() { } public CompanySmartTableData(String additionalInfo, Long companyType) { m_additionalInfo = additionalInfo; m_companyType = companyType; } public String getAdditionalInfo() { return m_additionalInfo; } public void setAdditionalInfo(String additionalInfo) { m_additionalInfo = additionalInfo; } public Long getCompanyType() { return m_companyType; } public void setCompanyType(Long companyType) { m_companyType = companyType; } }
Company type lookup call
public class CompanyTypeLookupCall extends LocalLookupCall<Long> { private static final long serialVersionUID = 1L; @Override protected List<ILookupRow<Long>> execCreateLookupRows() throws ProcessingException { List<ILookupRow<Long>> rows = new ArrayList<ILookupRow<Long>>(); rows.add(new LookupRow<Long>(1L, "Customer")); rows.add(new LookupRow<Long>(2L, "Supplier")); rows.add(new LookupRow<Long>(3L, "Other")); return rows; } }
See Also
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The corresponding column: The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.