This is an old revision of the document!


Data Input, View, and Edit Controls

Data Input, View, and Edit Controls is a SOLoist sample application that demonstrates various SOLoist controls for entering, viewing, and editing data from the object space. It is based on a universal Element Component that can be configured and combined in very different ways, as shown in this example. The so-called Service Access Points for fetching objects from the object space into the UI and providing them on output pins are also introduced here.

This example demonstrates almost every combination in which a GUIElementComponent could be used. Its configuration is done along three dimensions:

  1. its kind:
    1. input: it is not bound to any backend object to edit, but it just captures the user's input or selection and provides it on its output pin
    2. edit: it is bound to a backend object whose slot it edits.
  2. its widget type: how it is presented in the UI, and
  3. the source for the contents: how it gets the content which it presents (for lists, trees, and grids):
    1. as a collection provided on its input pin
    2. as a value of a slot of the object provided on its input pin.

In this example, all elements are divided into two tab groups, according to their kind (inputs and editors). Every tab within these tab groups represents a different widget (field, combo box, suggest box, list, tree, and grid/table). The panel under the corresponding tab contains element components that get the objects to be rendered from different sources (collection or slot value).

All changes made in the edit controls will instantly be saved in the object space (database): an editor element component with a field widget commits the changes as soon as it looses its focus. The changes are instantly reflected in the UI.

The appropriate OQL query can inspect the changes in the object space SOLoist Explorer.

Live example

UML Model

Business Logic Code

None.

GUI Code

package rs.sol.sampleapps;
 
import rs.sol.sampleapps.commands.FetchPersonsOnly;
import rs.sol.sampleapps.listener.ObjectSpaceInit;
import rs.sol.soloist.helpers.init.DefaultContextInit;
import rs.sol.soloist.helpers.init.Initializer;
import rs.sol.soloist.helpers.init.InitializerFailedException;
import rs.sol.soloist.modelreader.Repository;
import rs.sol.soloist.server.builtindomains.builtindatatypes.Boolean;
import rs.sol.soloist.server.builtindomains.builtindatatypes.Date;
import rs.sol.soloist.server.builtindomains.builtindatatypes.Integer;
import rs.sol.soloist.server.builtindomains.builtindatatypes.Real;
import rs.sol.soloist.server.builtindomains.builtindatatypes.Text;
import rs.sol.soloist.server.builtindomains.common.ClassifierInstanceDescriptor;
import rs.sol.soloist.server.builtindomains.common.ElementDescriptor;
import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent;
import rs.sol.soloist.server.guiconfiguration.components.GUICommandComponent;
import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent;
import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent;
import rs.sol.soloist.server.guiconfiguration.components.GUITabComponent;
import rs.sol.soloist.server.guiconfiguration.components.PerformImmediately;
import rs.sol.soloist.server.guiconfiguration.construction.GUIComponent;
import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding;
import rs.sol.soloist.server.guiconfiguration.construction.GUIFactory;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUICollectionInput;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIComboWidget;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIElementComponent;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIInputKind;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIListWidget;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISlotEditorKind;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISlotValueInput;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISuggestWidget;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUITableWidget;
import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUITreeWidget;
import rs.sol.soloist.server.guiconfiguration.layout.CellLayoutData;
import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData;
import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIComparationFilter;
import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent;
import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindSingleInstanceSAPComponent;
import rs.sol.soloist.server.guiconfiguration.style.GUIContext;
import rs.sol.soloist.server.guiconfiguration.style.GUINavigatorFeature;
import rs.sol.soloist.server.guiconfiguration.style.GUIObjectSetting;
import rs.sol.soloist.server.guiconfiguration.style.GUIPictureFeature;
import rs.sol.soloist.server.guiconfiguration.style.GUITextFeature;
import rs.sol.soloist.server.server.SoloistServiceServlet;
 
public enum ElementComponent implements Initializer {
 
	INSTANCE;
 
	@Override
	public void init() throws InitializerFailedException {
		GUIApplicationComponent page = new GUIApplicationComponent();
		page.name.set(Text.fromString("ElementComponent"));
		SoloistServiceServlet.registerApplication(page);
		page.context.set(createContextAndStyles());
 
		GUIPanelComponent root = GUIPanelComponent.createFlow(page);
 
		GUILabelComponent title = GUILabelComponent.create(root, "Element Component");
		title.styleName.set(Text.fromString("titleStyle"));
 
		GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root);
		topPanel.styleName.set(Text.fromString("topPanel"));
 
		// Service Access Points
		GUIFindAllInstancesSAPComponent allPersons = GUIFindAllInstancesSAPComponent.create(root, Person.FQ_TYPE_NAME);
		GUIFindSingleInstanceSAPComponent findJohnDoe = GUIFindSingleInstanceSAPComponent.create(root, Person.FQ_TYPE_NAME, Person.FQPropertyNames.desc,
				(ClassifierInstanceDescriptor) ElementDescriptor.create(Text.fromString(ObjectSpaceInit.JOHN_DOE_IDENTIFIER)), false);
		GUIFindSingleInstanceSAPComponent findJohnDeoRootDepartment = GUIFindSingleInstanceSAPComponent.create(root, BankDepartment.FQ_TYPE_NAME,
				BankDepartment.FQPropertyNames.desc,
				(ClassifierInstanceDescriptor) ElementDescriptor.create(Text.fromString(ObjectSpaceInit.JOHN_DOE_ROOT_DEPARTMENT)), false);
		GUICommandComponent allPersonsNotAdvisers = GUICommandComponent.create(root, new FetchPersonsOnly(), PerformImmediately.NOTHING);
		GUIComponentBinding.create(page.start, allPersonsNotAdvisers.click);
		GUIFindSingleInstanceSAPComponent findJanneRoe = GUIFindSingleInstanceSAPComponent.create(root, Person.FQ_TYPE_NAME, Person.FQPropertyNames.desc,
				(ClassifierInstanceDescriptor) ElementDescriptor.create(Text.fromString(ObjectSpaceInit.JANNE_ROE_IDENTIFIER)), false);
 
		// Inputs
		GUIPanelComponent inputs = GUIPanelComponent.createFlow(topPanel);
		inputs.styleName.set(Text.fromString("leftSide"));
		GUILabelComponent l1 = GUILabelComponent.create(inputs, "Input kind");
		l1.styleName.set(Text.fromString("subtitle"));
		GUITabComponent tabInput = GUITabComponent.create(inputs, "Field", "Combo", "Suggest", "List", "Tree", "Table");
		GUIPanelComponent inputFieldsTable = GUIPanelComponent.createTable(tabInput);
		GUIPanelComponent inputComboTable = GUIPanelComponent.createTable(tabInput);
		GUIPanelComponent inputSuggestTable = GUIPanelComponent.createTable(tabInput);
		GUIPanelComponent inputListsTable = GUIPanelComponent.createTable(tabInput);
		GUIPanelComponent inputTreesTable = GUIPanelComponent.createTable(tabInput);
		GUIPanelComponent inputTablesTable = GUIPanelComponent.createTable(tabInput);
 
		int i = 0;
		GUIComparationFilter gcf0 = GUIComparationFilter.create(root, tabInput.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcf0.yes, allPersons.refresh);
		GUIComparationFilter gcf1 = GUIComparationFilter.create(root, tabInput.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcf1.yes, allPersons.refresh);
		GUIComparationFilter gcf2 = GUIComparationFilter.create(root, tabInput.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcf2.yes, allPersons.refresh);
		GUIComparationFilter gcf3 = GUIComparationFilter.create(root, tabInput.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcf3.yes, allPersons.refresh);
		GUIComparationFilter gcf4 = GUIComparationFilter.create(root, tabInput.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcf4.yes, allPersons.refresh);
		GUIComparationFilter gcf5 = GUIComparationFilter.create(root, tabInput.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcf5.yes, allPersons.refresh);
 
		// Input fields
		int row = 0, col = 0;
		GUILabelComponent.create(inputFieldsTable, "Text: ", row, col);
		GUIElementComponent.createInput(inputFieldsTable, "", Text.CLASSIFIER, row++, col + 1);
 
		GUILabelComponent.create(inputFieldsTable, "Integer: ", row, col);
		GUIElementComponent.createInput(inputFieldsTable, "", Integer.CLASSIFIER, row++, col + 1);
 
		GUILabelComponent.create(inputFieldsTable, "Real: ", row, col);
		GUIElementComponent.createInput(inputFieldsTable, "", Real.CLASSIFIER, row++, col + 1);
 
		GUILabelComponent.create(inputFieldsTable, "Date: ", row, col);
		GUIElementComponent.createInput(inputFieldsTable, "", Date.CLASSIFIER, row++, col + 1);
 
		GUILabelComponent.create(inputFieldsTable, "Boolean: ", row, col);
		GUIElementComponent.createInputCheckbox(inputFieldsTable, "", "", false, new TableLayoutData(row++, col + 1));
 
		GUILabelComponent.create(inputFieldsTable, "Enum: ", row, col);
		GUIElementComponent.createInput(inputFieldsTable, "", Repository.getRepository().getEnumeration(Gender.FQ_TYPE_NAME), row++, col + 1);
 
		// Input combo
		row = 0; col = 0;
		GUILabelComponent.create(inputComboTable, "Collection source: ", row, col);
		GUIElementComponent collectionInputCombo = GUIElementComponent.createInput(inputComboTable, new GUIComboWidget(), new GUICollectionInput(), row++, col + 1);
		GUIComponentBinding.create(allPersons.value, GUICollectionInput.get(collectionInputCombo).collection);
 
		GUILabelComponent.create(inputComboTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueInputCombo = GUIElementComponent.createInput(inputComboTable, new GUIComboWidget(),
				GUISlotValueInput.create(Person.PROPERTIES.accounts), row++, col + 1);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotValueInput.get(slotValueInputCombo).element);
 
		// Input suggest
		row = 0; col = 0;
		GUILabelComponent.create(inputSuggestTable, "Collection source: ", row, col);
		GUIElementComponent collectionInputSuggest = GUIElementComponent.createInput(inputSuggestTable, new GUISuggestWidget(), new GUICollectionInput(), row++, col + 1);
		GUIComponentBinding.create(allPersons.value, GUICollectionInput.get(collectionInputSuggest).collection);
 
		GUILabelComponent.create(inputSuggestTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueInputSuggest = GUIElementComponent.createInput(inputSuggestTable, new GUISuggestWidget(),
				GUISlotValueInput.create(Person.PROPERTIES.accounts), row++, col + 1);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotValueInput.get(slotValueInputSuggest).element);
 
		// Input lists
		row = 0; col = 0;
		GUILabelComponent.create(inputListsTable, "Collection source: ", row, col);
		GUIElementComponent collectionInputList = GUIElementComponent.createInput(inputListsTable, new GUIListWidget(), new GUICollectionInput(), row++, col + 1);
		GUIComponentBinding.create(allPersons.value, GUICollectionInput.get(collectionInputList).collection);
		CellLayoutData.setSize(collectionInputList, "250px", "200px");
		collectionInputList.styleName.set(Text.fromString("listWidget"));
 
		GUILabelComponent.create(inputListsTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueInputList = GUIElementComponent.createInput(inputListsTable, new GUIListWidget(),
				GUISlotValueInput.create(Person.PROPERTIES.accounts), row++, col + 1);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotValueInput.get(slotValueInputList).element);
		CellLayoutData.setSize(slotValueInputList, "250px", "200px");
		slotValueInputList.styleName.set(Text.fromString("listWidget"));
 
		// Input trees
		row = 0; col = 0;
		GUILabelComponent.create(inputTreesTable, "Collection source: ", row, col);
		GUIElementComponent personsTree = GUIElementComponent.createInput(inputTreesTable, new GUITreeWidget(), new GUICollectionInput(), row++, col + 1);
		GUIComponentBinding.create(allPersons.value, GUICollectionInput.get(personsTree).collection);
		CellLayoutData.setSize(personsTree, "250px", "200px");
		personsTree.styleName.set(Text.fromString("treeWidget"));
 
		GUILabelComponent.create(inputTreesTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueInputTree = GUIElementComponent.createInput(inputTreesTable, new GUITreeWidget(),
				GUISlotValueInput.create(BankDepartment.PROPERTIES.subDepartments), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJohnDeoRootDepartment.value, GUISlotValueInput.get(slotValueInputTree).element);
		CellLayoutData.setSize(slotValueInputTree, "250px", "200px");
		slotValueInputTree.styleName.set(Text.fromString("treeWidget"));
 
		// Input tables
		row = 0; col = 0;
		GUILabelComponent.create(inputTablesTable, "Collection source: ", row, col);
		GUIElementComponent genderValue = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.gender);
		GUISlotEditorKind.get(genderValue).readOnly.set(Boolean.valueOf(true));
		GUISlotEditorKind.get(genderValue).displayAsLabel.set(Boolean.valueOf(true));
 
		GUIElementComponent dateOfBirthValue = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.dateOfBirth);
		GUISlotEditorKind.get(dateOfBirthValue).readOnly.set(Boolean.valueOf(true));
		GUISlotEditorKind.get(dateOfBirthValue).displayAsLabel.set(Boolean.valueOf(true));
 
		GUIElementComponent isMarriedValue = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.isMarried);
		GUISlotEditorKind.get(isMarriedValue).readOnly.set(Boolean.valueOf(true));
		GUISlotEditorKind.get(isMarriedValue).displayAsLabel.set(Boolean.valueOf(true));
 
		GUITableWidget gtw1 = GUITableWidget.create(new String[] { "Person", "Gender", "Date of Birth", "Is Married" }, new GUIComponent[] { genderValue,
				dateOfBirthValue, isMarriedValue });
 
		gtw1.minRows.set(Integer.valueOf(3));
		GUIElementComponent collectionInputTable = GUIElementComponent.create(inputTablesTable, new GUIInputKind(), gtw1, new GUICollectionInput(),
				new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(allPersons.value, GUICollectionInput.get(collectionInputTable).collection);
 
		GUILabelComponent.create(inputTablesTable, "Slot value source: ", row, col);
		GUIElementComponent bankNameValue = GUIElementComponent.createSlotEditor(null, BankAccount.PROPERTIES.bankName);
		GUISlotEditorKind.get(bankNameValue).readOnly.set(Boolean.valueOf(true));
		GUISlotEditorKind.get(bankNameValue).displayAsLabel.set(Boolean.valueOf(true));
 
		GUITableWidget gtw2 = GUITableWidget.create(new String[] { "Bank Account", "Bank Name" }, new GUIComponent[] { bankNameValue });
 
		gtw2.minRows.set(Integer.valueOf(3));
		GUIElementComponent slotValueInputTable = GUIElementComponent.create(inputTablesTable, new GUIInputKind(), gtw2,
				GUISlotValueInput.create(Person.PROPERTIES.accounts), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJohnDoe.value, GUISlotValueInput.get(slotValueInputTable).element);
 
		// Edits
		GUIPanelComponent edits = GUIPanelComponent.createFlow(topPanel);
		GUILabelComponent l2 = GUILabelComponent.create(edits, "Slot Editor Kind");
		l2.styleName.set(Text.fromString("subtitle	"));
		GUITabComponent tabEdit = GUITabComponent.create(edits, "Field", "Combo", "Suggest", "List", "Tree", "Table");
		GUIPanelComponent editFieldsTable = GUIPanelComponent.createTable(tabEdit);
		GUIPanelComponent editComboTable = GUIPanelComponent.createTable(tabEdit);
		GUIPanelComponent editSuggestTable = GUIPanelComponent.createTable(tabEdit);
		GUIPanelComponent editListsTable = GUIPanelComponent.createTable(tabEdit);
		GUIPanelComponent editTreesTable = GUIPanelComponent.createTable(tabEdit);
		GUIPanelComponent editTablesTable = GUIPanelComponent.createTable(tabEdit);
 
		i = 0;
		GUIComparationFilter gcfe0 = GUIComparationFilter.create(root, tabEdit.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcfe0.yes, allPersons.refresh);
		GUIComparationFilter gcfe1 = GUIComparationFilter.create(root, tabEdit.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcfe1.yes, allPersons.refresh);
		GUIComparationFilter gcfe2 = GUIComparationFilter.create(root, tabEdit.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcfe2.yes, allPersons.refresh);
		GUIComparationFilter gcfe3 = GUIComparationFilter.create(root, tabEdit.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcfe3.yes, allPersons.refresh);
		GUIComparationFilter gcfe4 = GUIComparationFilter.create(root, tabEdit.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcfe4.yes, allPersons.refresh);
		GUIComparationFilter gcfe5 = GUIComparationFilter.create(root, tabEdit.visibleChild, Integer.valueOf(i++));
		GUIComponentBinding.create(gcfe5.yes, allPersons.refresh);
 
		// Edit fields
		row = 0; col = 0;
		GUILabelComponent.create(editFieldsTable, "Text: ", row, col);
		GUIElementComponent textEditor = GUIElementComponent.createSlotEditor(editFieldsTable, Person.PROPERTIES.name, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Integer: ", row, col);
		GUIElementComponent integerEditor = GUIElementComponent.createSlotEditor(editFieldsTable, Person.PROPERTIES.age, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Real: ", row, col);
		GUIElementComponent realEditor = GUIElementComponent.createSlotEditor(editFieldsTable, Person.PROPERTIES.height, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Date: ", row, col);
		GUIElementComponent dateEditor = GUIElementComponent.createSlotEditor(editFieldsTable, Person.PROPERTIES.dateOfBirth, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Boolean: ", row, col);
		GUIElementComponent booleanEditor = GUIElementComponent.createSlotEditor(editFieldsTable, Person.PROPERTIES.isMarried, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Enum: ", row, col);
		GUIElementComponent enumEditor = GUIElementComponent.createSlotEditor(editFieldsTable, Person.PROPERTIES.gender, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Picture: ", row, col);
		GUIPanelComponent photoUpload = GUIFactory.createFileComponent(editFieldsTable, Person.PROPERTIES.photo, true, false);
		TableLayoutData.setRowColumn(photoUpload, row++, col + 1);
 
		GUILabelComponent.create(editFieldsTable, "Picture Value: ", row, col);
		GUIPanelComponent photoValue = GUIFactory.createFileComponent(editFieldsTable, Person.PROPERTIES.photo, false, true);
		TableLayoutData.setRowColumn(photoValue, row++, col + 1);
 
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(textEditor).element);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(integerEditor).element);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(realEditor).element);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(dateEditor).element);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(booleanEditor).element);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(enumEditor).element);
		GUIComponentBinding.create(findJohnDoe.value, photoUpload.input);
		GUIComponentBinding.create(findJohnDoe.value, photoValue.input);
 
		// Edit lists
		row = 0; col = 0;
		GUILabelComponent.create(editListsTable, "Collection source: ", row, col);
		GUIElementComponent collectionEditList = GUIElementComponent.create(editListsTable, GUISlotEditorKind.create(BankAdviser.PROPERTIES.myClients),
				new GUIListWidget(), new GUICollectionInput(), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(allPersonsNotAdvisers, FetchPersonsOnly.PROPERTIES.fetchedPersons, GUICollectionInput.get(collectionEditList).collection);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(collectionEditList).element);
		CellLayoutData.setSize(collectionEditList, "250px", "200px");
		collectionEditList.styleName.set(Text.fromString("listEditor"));
 
		GUILabelComponent.create(editListsTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueEditList = GUIElementComponent.create(editListsTable, GUISlotEditorKind.create(Person.PROPERTIES.successfulAdvisers),
				new GUIListWidget(), GUISlotValueInput.create(Person.PROPERTIES.myBankAdvisers), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJanneRoe.value, GUISlotEditorKind.get(slotValueEditList).element);
		GUIComponentBinding.create(findJanneRoe.value, GUISlotValueInput.get(slotValueEditList).element);
		CellLayoutData.setSize(slotValueEditList, "250px", "200px");
		slotValueEditList.styleName.set(Text.fromString("listEditor"));
 
		// Edit combos
		row = 0; col = 0;
		GUILabelComponent.create(editComboTable, "Collection source: ", row, col);
		GUIElementComponent collectionEditCombo = GUIElementComponent.create(editComboTable, GUISlotEditorKind.create(BankAdviser.PROPERTIES.myClients),
				new GUIComboWidget(), new GUICollectionInput(), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(allPersonsNotAdvisers, FetchPersonsOnly.PROPERTIES.fetchedPersons, GUICollectionInput.get(collectionEditCombo).collection);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(collectionEditCombo).element);
 
		GUILabelComponent.create(editComboTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueEditCombo = GUIElementComponent.create(editComboTable, GUISlotEditorKind.create(Person.PROPERTIES.successfulAdvisers),
				new GUIComboWidget(), GUISlotValueInput.create(Person.PROPERTIES.myBankAdvisers), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJanneRoe.value, GUISlotEditorKind.get(slotValueEditCombo).element);
		GUIComponentBinding.create(findJanneRoe.value, GUISlotValueInput.get(slotValueEditCombo).element);
 
		// Edit suggest
		GUILabelComponent.create(editSuggestTable, "Collection source: ", row, col);
		GUIElementComponent collectionEditSuggest = GUIElementComponent.create(editSuggestTable, GUISlotEditorKind.create(BankAdviser.PROPERTIES.myClients),
				new GUISuggestWidget(), new GUICollectionInput(), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(allPersonsNotAdvisers, FetchPersonsOnly.PROPERTIES.fetchedPersons, GUICollectionInput.get(collectionEditSuggest).collection);
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(collectionEditSuggest).element);
 
		GUILabelComponent.create(editSuggestTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueEditSuggest = GUIElementComponent.create(editSuggestTable, GUISlotEditorKind.create(Person.PROPERTIES.successfulAdvisers),
				new GUISuggestWidget(), GUISlotValueInput.create(Person.PROPERTIES.myBankAdvisers), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJanneRoe.value, GUISlotEditorKind.get(slotValueEditSuggest).element);
		GUIComponentBinding.create(findJanneRoe.value, GUISlotValueInput.get(slotValueEditSuggest).element);
 
		// Edit trees
		row = 0; col = 0;
		GUILabelComponent.create(editTreesTable, "Collection source: ", row, col);
		GUIElementComponent collectionEditTree = GUIElementComponent.createSlotEditorTree(editTreesTable, BankAdviser.PROPERTIES.myDepartment,
				new GUICollectionInput(), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(collectionEditTree).element);
		GUIComponentBinding.create(findJohnDeoRootDepartment.value, GUICollectionInput.get(collectionEditTree).collection);
		CellLayoutData.setSize(collectionEditTree, "250px", "200px");
		collectionEditTree.styleName.set(Text.fromString("treeEditor"));
 
		GUILabelComponent.create(editTreesTable, "Slot value source: ", row, col);
		GUIElementComponent slotValueEditTree = GUIElementComponent.createSlotEditorTree(editTreesTable, BankAdviser.PROPERTIES.myDepartment,
				GUISlotValueInput.create(BankDepartment.PROPERTIES.subDepartments), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJohnDoe.value, GUISlotEditorKind.get(slotValueEditTree).element);
		GUIComponentBinding.create(findJohnDeoRootDepartment.value, GUISlotValueInput.get(slotValueEditTree).element);
		CellLayoutData.setSize(slotValueEditTree, "250px", "200px");
		slotValueEditTree.styleName.set(Text.fromString("treeEditor"));
 
		// Edit tables
		row = 0; col = 0;
		GUILabelComponent.create(editTablesTable, "Collection source: ", row, col);
		GUIElementComponent genderEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.gender);
		GUIElementComponent dateOfBirthEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.dateOfBirth);
		GUIElementComponent isMarriedEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.isMarried);
		GUITableWidget gtw3 = GUITableWidget.create(new String[] { "Person", "Gender", "Date of Birth", "Is Married" }, new GUIComponent[] { genderEditor,
				dateOfBirthEditor, isMarriedEditor });
		gtw3.minRows.set(Integer.valueOf(3));
		GUIElementComponent collectionEditTable = GUIElementComponent.create(editTablesTable, new GUIInputKind(), gtw3, new GUICollectionInput(),
				new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(allPersons.value, GUICollectionInput.get(collectionEditTable).collection);
 
		GUILabelComponent.create(editTablesTable, "Slot value source: ", row, col);
		GUIElementComponent bankNameEditor = GUIElementComponent.createSlotEditor(null, BankAccount.PROPERTIES.bankName);
		GUITableWidget gtw4 = GUITableWidget.create(new String[] { "Bank Account", "Bank Name" }, new GUIComponent[] { bankNameEditor });
		gtw4.minRows.set(Integer.valueOf(3));
		GUIElementComponent slotValueEditTable = GUIElementComponent.create(editTablesTable, new GUIInputKind(), gtw4,
				GUISlotValueInput.create(Person.PROPERTIES.accounts), new TableLayoutData(row++, col + 1));
		GUIComponentBinding.create(findJohnDoe.value, GUISlotValueInput.get(slotValueEditTable).element);
	}
 
	/**
	 * This piece of code describes how will objects of different classes be presented on GUI (icons, name, etc.)
	 */
	private GUIContext createContextAndStyles() {
		GUIContext context = new GUIContext();
		context.supercontext.set(DefaultContextInit.getRoot());
 
		GUIObjectSetting person = GUIObjectSetting.create(context, Person.CLASSIFIER);
		GUITextFeature.createName(person, Person.PROPERTIES.name);
		GUITextFeature.createSeparator(person, ":", true);
		GUITextFeature.createDescription(person, Person.PROPERTIES.age);
		GUIPictureFeature.createSmallIcon(person, "images/icons/person.png");
		GUINavigatorFeature.createSubnodes(person, Person.FQPropertyNames.accounts);
 
		GUIObjectSetting bankAccount = GUIObjectSetting.create(context, BankAccount.CLASSIFIER);
		GUITextFeature.createName(bankAccount, BankAccount.PROPERTIES.number);
		GUITextFeature.createSeparator(bankAccount, "/", true);
		GUITextFeature.createDescription(bankAccount, BankAccount.PROPERTIES.amount);
		GUIPictureFeature.createSmallIcon(bankAccount, "images/icons/bankaccount.png");
 
		GUIObjectSetting department = GUIObjectSetting.create(context, BankDepartment.CLASSIFIER);
		GUITextFeature.createName(department, BankDepartment.PROPERTIES.name);
		GUIPictureFeature.createSmallIcon(department, "images/icons/bankdepartment.png");
		GUINavigatorFeature.createSubnodes(department, BankDepartment.FQPropertyNames.subDepartments);
 
		return context;
	}
}
Print/export