Differences

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

Link to this comparison view

person_tables [2012/04/09 17:48]
dragan.milicev
person_tables [2012/07/09 10:49] (current)
srdjan.lukovic [GUI Code]
Line 22: Line 22:
 import rs.sol.soloist.helpers.init.Initializer; import rs.sol.soloist.helpers.init.Initializer;
 import rs.sol.soloist.helpers.init.InitializerFailedException; import rs.sol.soloist.helpers.init.InitializerFailedException;
-import rs.sol.soloist.server.builtindomains.builtindatatypes.Boolean; 
-import rs.sol.soloist.server.builtindomains.builtindatatypes.Integer; 
-import rs.sol.soloist.server.builtindomains.builtindatatypes.Text; 
 import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent;
 import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent; import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent;
 import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent;
-import rs.sol.soloist.server.guiconfiguration.construction.GUIComponent; 
 import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding;
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUICollectionInput+import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIEdit
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIElementComponent; +import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIInput;
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUIInputKind; +
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISlotEditorKind; +
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUITableWidget;+
 import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent; import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent;
 import rs.sol.soloist.server.guiconfiguration.style.GUIContext; import rs.sol.soloist.server.guiconfiguration.style.GUIContext;
Line 50: Line 43:
  {  {
  GUIApplicationComponent page = new GUIApplicationComponent();  GUIApplicationComponent page = new GUIApplicationComponent();
- page.name.set(Text.fromString("PersonsTable")); + page.setName("PersonsTable"); 
  SoloistServiceServlet.registerApplication(page);  SoloistServiceServlet.registerApplication(page);
  GUIContext context = createContextAndStyles();  GUIContext context = createContextAndStyles();
- page.context.set(context);+ page.setContext(context);
   
  GUIPanelComponent root = GUIPanelComponent.createVertical(page);  GUIPanelComponent root = GUIPanelComponent.createVertical(page);
   
  GUILabelComponent title = GUILabelComponent.create(root, "Persons Table");  GUILabelComponent title = GUILabelComponent.create(root, "Persons Table");
- 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");
   
- GUIFindAllInstancesSAPComponent allPersons = GUIFindAllInstancesSAPComponent.create(root, Person.FQ_TYPE_NAME); // This component fetches all persons+ // This component fetches all persons 
 + GUIFindAllInstancesSAPComponent allPersons = GUIFindAllInstancesSAPComponent.create(root, Person.CLASSIFIER);
   
- GUILabelComponent.create(topPanel, "Editable fields").styleName.set(Text.fromString("subtitle"));+ GUILabelComponent.create(topPanel, "Editable fields").setStyle("subtitle");
  createPersonsTable(topPanel, allPersons, false, false);  createPersonsTable(topPanel, allPersons, false, false);
- GUILabelComponent.create(topPanel, "Readonly fields").styleName.set(Text.fromString("subtitle"));+ GUILabelComponent.create(topPanel, "Readonly fields").setStyle("subtitle");
  createPersonsTable(topPanel, allPersons, true, false);  createPersonsTable(topPanel, allPersons, true, false);
- GUILabelComponent.create(topPanel, "Readonly fields as labels").styleName.set(Text.fromString("subtitle"));+ GUILabelComponent.create(topPanel, "Readonly fields as labels").setStyle("subtitle");
  createPersonsTable(topPanel, allPersons, true, true);  createPersonsTable(topPanel, allPersons, true, true);
  }  }
Line 75: Line 69:
  private void createPersonsTable(GUIPanelComponent root, GUIFindAllInstancesSAPComponent allPersons, boolean readonly, boolean displayAsLabel)  private void createPersonsTable(GUIPanelComponent root, GUIFindAllInstancesSAPComponent allPersons, boolean readonly, boolean displayAsLabel)
  {  {
- // Column components + // column components 
- GUIElementComponent nameEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.name); + GUIEdit nameEditor = GUIEdit.createField(null, Person.PROPERTIES.name); 
- GUISlotEditorKind.get(nameEditor).readOnly.set(Boolean.valueOf(readonly)); + nameEditor.setReadOnly(readonly); 
- GUISlotEditorKind.get(nameEditor).displayAsLabel.set(Boolean.valueOf(displayAsLabel));+ nameEditor.setDisplayAsLabel(displayAsLabel);
   
- GUIElementComponent genderEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.gender); + GUIEdit genderEditor = GUIEdit.createField(null, Person.PROPERTIES.gender); 
- GUISlotEditorKind.get(genderEditor).readOnly.set(Boolean.valueOf(readonly)); + genderEditor.setReadOnly(readonly); 
- GUISlotEditorKind.get(genderEditor).displayAsLabel.set(Boolean.valueOf(displayAsLabel));+ genderEditor.setDisplayAsLabel(displayAsLabel);
   
- GUIElementComponent ageEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.age); + GUIEdit ageEditor = GUIEdit.createField(null, Person.PROPERTIES.age); 
- GUISlotEditorKind.get(ageEditor).readOnly.set(Boolean.valueOf(readonly)); + ageEditor.setReadOnly(readonly); 
- GUISlotEditorKind.get(ageEditor).displayAsLabel.set(Boolean.valueOf(displayAsLabel));+ ageEditor.setDisplayAsLabel(displayAsLabel);
   
- GUIElementComponent dateOfBirthEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.dateOfBirth); + GUIEdit dateOfBirthEditor = GUIEdit.createField(null, Person.PROPERTIES.dateOfBirth); 
- GUISlotEditorKind.get(dateOfBirthEditor).readOnly.set(Boolean.valueOf(readonly)); + dateOfBirthEditor.setReadOnly(readonly); 
- GUISlotEditorKind.get(dateOfBirthEditor).displayAsLabel.set(Boolean.valueOf(displayAsLabel));+ dateOfBirthEditor.setDisplayAsLabel(displayAsLabel);
   
- GUIElementComponent heightEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.height); + GUIEdit heightEditor = GUIEdit.createField(null, Person.PROPERTIES.height); 
- GUISlotEditorKind.get(heightEditor).readOnly.set(Boolean.valueOf(readonly)); + heightEditor.setReadOnly(readonly); 
- GUISlotEditorKind.get(heightEditor).displayAsLabel.set(Boolean.valueOf(displayAsLabel));+ heightEditor.setDisplayAsLabel(displayAsLabel);
   
- GUIElementComponent isMarriedEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.isMarried); + GUIEdit isMarriedEditor = GUIEdit.createField(null, Person.PROPERTIES.isMarried); 
- GUISlotEditorKind.get(isMarriedEditor).readOnly.set(Boolean.valueOf(readonly)); + isMarriedEditor.setReadOnly(readonly); 
- GUISlotEditorKind.get(isMarriedEditor).displayAsLabel.set(Boolean.valueOf(displayAsLabel));+ isMarriedEditor.setDisplayAsLabel(displayAsLabel);
   
- // Column header texts and ordering of column components + GUIInput editableTable GUIInput.createTable(root, "Person", "Name", "Gender", "Age", "Date of Birth", "Height", "Is Married"); 
- GUITableWidget gtw GUITableWidget.create(new String[]{"Person", "Name", "Gender", "Age", "Date of Birth", "Height", "Is Married"},  + editableTable.setColumnComponents(nameEditor, genderEditor, ageEditor, dateOfBirthEditor, heightEditor, isMarriedEditor); 
- new GUIComponent[]{nameEditor, genderEditor, ageEditor, dateOfBirthEditor, heightEditor, isMarriedEditor}); + editableTable.setMinRows(3); // min rows to show if there is no data in the table 
-  + GUIComponentBinding.create(allPersons.opValue()editableTable.ipCollection());
- gtw.minRows.set(Integer.valueOf(3)); // min rows to show if there is no data in the table +
- GUIElementComponent editableTable = GUIElementComponent.create(root, new GUIInputKind(), gtw, new GUICollectionInput()); // the very table +
-  +
- GUIComponentBinding.create(allPersons.valueGUICollectionInput.get(editableTable).collection);+
  }  }
   
Line 113: Line 103:
  {  {
  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);
Print/export