Differences

This shows you the differences between two versions of the page.

Link to this comparison view

association_editor [2012/03/30 17:50]
srdjan.lukovic
association_editor [2012/07/09 10:50] (current)
srdjan.lukovic [GUI Code]
Line 1: Line 1:
-====== Association Editor ====== +====== Selection List ====== 
-This sample demonstrates distinctive feature, dynamically linking objects. + 
 +**Selection List** is a [[SOLoist Sample Applications|SOLoist sample application]] that shows how persistent selections of a subset of objects linked over an association can be implemented by means of another (subsetting) association and the appropriate configuration of the //Element Component//. 
 + 
 +The intention is to enable selection of a subset of //Bank Advisers// that are linked to a particular object of //Person// by checkboxes. 
 + 
 +The particular object of //Person// whose //Bank Advisers// are shown in the list is fetched via a Service Access Point component. It provides the fetched object to its output pin that is wired to the input pin of the list box. 
 + 
 +The list box is configured to render all objects linked to the slot //myBankAdvisers//, but to edit the (subsetting) slot //successfulAdvisers//. 
 + 
 +This way, instead of using Boolean attributes as flags, a subsetting association is used to store the selection. The selection is inherently persistent.
  
 ==== Live example ==== ==== Live example ====
Line 6: Line 15:
 [[http://soloistdemo.org/SampleApplications/associationeditor.html]]\\ [[http://soloistdemo.org/SampleApplications/associationeditor.html]]\\
 [[http://soloistdemo.org/SampleApplications/oql?q=SELECT+p%2C+p.name%2C+p.gender%2C+p.age%2C+p.dateOfBirth%2C+p.height%2C+p.isMarried%2C+p.photo%2C+p.rootFolder%0D%0AFROM+Person+p&f=html | OQL Query: Persons]] [[http://soloistdemo.org/SampleApplications/oql?q=SELECT+p%2C+p.name%2C+p.gender%2C+p.age%2C+p.dateOfBirth%2C+p.height%2C+p.isMarried%2C+p.photo%2C+p.rootFolder%0D%0AFROM+Person+p&f=html | OQL Query: Persons]]
 +|{{screen:associationeditor.png?250}}|
  
 ===== UML Model ===== ===== UML Model =====
Line 28: Line 38:
 import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent;
 import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding;
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIElementComponent; +import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIEdit;
-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.layout.CellLayoutData;+
 import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData; import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData;
 import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindSingleInstanceSAPComponent; import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindSingleInstanceSAPComponent;
Line 50: Line 56:
  {  {
  GUIApplicationComponent page = new GUIApplicationComponent();  GUIApplicationComponent page = new GUIApplicationComponent();
- page.name.set(Text.fromString("AssociationEditor")); + page.setName("AssociationEditor"); 
  SoloistServiceServlet.registerApplication(page);  SoloistServiceServlet.registerApplication(page);
- page.context.set(createContextAndStyles());+ page.setContext(createContextAndStyles());
   
  GUIPanelComponent root = GUIPanelComponent.createFlow(page);  GUIPanelComponent root = GUIPanelComponent.createFlow(page);
   
  GUILabelComponent title = GUILabelComponent.create(root, "Association Editor");  GUILabelComponent title = GUILabelComponent.create(root, "Association Editor");
- title.styleName.set(Text.fromString("titleStyle"));+ title.setStyle("titleStyle");
   
  GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root);  GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root);
- topPanel.styleName.set(Text.fromString("topPanel"));+ topPanel.setStyle("topPanel");
  GUIPanelComponent table = GUIPanelComponent.createTable(topPanel); // panel with table layout  GUIPanelComponent table = GUIPanelComponent.createTable(topPanel); // panel with table layout
   
Line 66: Line 72:
  Person.FQ_TYPE_NAME,   Person.FQ_TYPE_NAME, 
  Person.FQPropertyNames.desc,   Person.FQPropertyNames.desc, 
- (ClassifierInstanceDescriptor)ElementDescriptor.create(Text.fromString(ObjectSpaceInit.JANNE_ROE_IDENTIFIER)),  + (ClassifierInstanceDescriptor)ElementDescriptor.create(Text.fromString(ObjectSpaceInit.JANNE_ROE_IDENTIFIER))); 
- false);+  
 + GUIEdit editList = GUIEdit.createList(tablePerson.PROPERTIES.successfulAdvisers, Person.PROPERTIES.myBankAdvisers); 
 + editList.setLayoutData(TableLayoutData.create(0, 0)); 
 + GUIComponentBinding.create(findJanneRoe.opValue(), editList.ipElement()); 
 + GUIComponentBinding.create(findJanneRoe.opValue(), editList.ipSlotValueElement());
   
- GUIElementComponent editList = GUIElementComponent.create(table, GUISlotEditorKind.create(Person.PROPERTIES.successfulAdvisers), new GUIListWidget(), GUISlotValueInput.create(Person.PROPERTIES.myBankAdvisers), new TableLayoutData(0, 0)); + editList.setSize("250px", "200px"); 
- GUIComponentBinding.create(findJanneRoe.value, GUISlotEditorKind.get(editList).element); + editList.setStyle("listEditor");
- GUIComponentBinding.create(findJanneRoe.value, GUISlotValueInput.get(editList).element); +
- CellLayoutData.setSize(editList, "250px", "200px"); +
- editList.styleName.set(Text.fromString("listEditor"));+
  }  }
  
  private GUIContext createContextAndStyles() {  private GUIContext createContextAndStyles() {
  GUIContext context = new GUIContext();  GUIContext context = new GUIContext();
- context.supercontext.set(DefaultContextInit.getRoot());+ DefaultContextInit.getRoot().addContext(context);
   
  GUIObjectSetting person = GUIObjectSetting.create(context, Person.CLASSIFIER);  GUIObjectSetting person = GUIObjectSetting.create(context, Person.CLASSIFIER);
  GUITextFeature.createName(person, Person.PROPERTIES.name);  GUITextFeature.createName(person, Person.PROPERTIES.name);
- GUITextFeature.createSeparator(person, ":", true);+ GUITextFeature.createFixedSeparator(person, ":");
  GUITextFeature.createDescription(person, Person.PROPERTIES.age);  GUITextFeature.createDescription(person, Person.PROPERTIES.age);
  GUIPictureFeature.createSmallIcon(person, "images/icons/person.png");  GUIPictureFeature.createSmallIcon(person, "images/icons/person.png");
Print/export