Differences

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

Link to this comparison view

bank_advisers [2012/04/09 17:59]
dragan.milicev
bank_advisers [2012/07/09 10:51] (current)
srdjan.lukovic [GUI Code]
Line 50: Line 50:
 import rs.sol.soloist.server.builtindomains.builtincommands.CmdCreateObjectOfClass; import rs.sol.soloist.server.builtindomains.builtincommands.CmdCreateObjectOfClass;
 import rs.sol.soloist.server.builtindomains.builtincommands.CmdDestroyObject; import rs.sol.soloist.server.builtindomains.builtincommands.CmdDestroyObject;
-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.GUIButtonComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent;
Line 58: Line 56:
 import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent;
 import rs.sol.soloist.server.guiconfiguration.components.PerformImmediately; 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.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.GUIListWidget; +
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUISlotEditorKind; +
-import rs.sol.soloist.server.guiconfiguration.elementcomponents.GUITableWidget; +
-import rs.sol.soloist.server.guiconfiguration.layout.CellLayoutData;+
 import rs.sol.soloist.server.guiconfiguration.layout.VerticalAlignment; import rs.sol.soloist.server.guiconfiguration.layout.VerticalAlignment;
 import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent; import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIFindAllInstancesSAPComponent;
Line 83: Line 75:
  {  {
  GUIApplicationComponent page = new GUIApplicationComponent();  GUIApplicationComponent page = new GUIApplicationComponent();
- page.name.set(Text.fromString("BankAdvisers")); + page.setName("BankAdvisers");
  SoloistServiceServlet.registerApplication(page);  SoloistServiceServlet.registerApplication(page);
  GUIContext context = createContextAndStyles();  GUIContext context = createContextAndStyles();
- page.context.set(context);+ page.setContext(context);
   
  GUIPanelComponent root = GUIPanelComponent.createFlow(page);  GUIPanelComponent root = GUIPanelComponent.createFlow(page);
   
  GUILabelComponent title = GUILabelComponent.create(root, "Bank Advisers");  GUILabelComponent title = GUILabelComponent.create(root, "Bank Advisers");
- 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 allBankAdvisers = GUIFindAllInstancesSAPComponent.create(root, BankAdviser.FQ_TYPE_NAME);+ GUIFindAllInstancesSAPComponent allBankAdvisers = GUIFindAllInstancesSAPComponent.create(root, BankAdviser.CLASSIFIER);
   
  // Column components  // Column components
- GUIElementComponent nameEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.name); + GUIEdit nameEditor = GUIEdit.createField(null, Person.PROPERTIES.name); 
- GUIElementComponent bankNameEditor = GUIElementComponent.createSlotEditor(null, BankAdviser.PROPERTIES.bank); + GUIEdit bankNameEditor = GUIEdit.createField(null, BankAdviser.PROPERTIES.bank); 
- GUIElementComponent genderEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.gender); + GUIEdit genderEditor = GUIEdit.createField(null, Person.PROPERTIES.gender); 
- GUIElementComponent ageEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.age); + GUIEdit ageEditor = GUIEdit.createField(null, Person.PROPERTIES.age); 
- GUIElementComponent isMarriedEditor = GUIElementComponent.createSlotEditor(null, Person.PROPERTIES.isMarried);+ GUIEdit isMarriedEditor = GUIEdit.createField(null, Person.PROPERTIES.isMarried);
   
  // Column header texts and oredering of column components  // Column header texts and oredering of column components
- GUITableWidget gtw GUITableWidget.create(new String[]{"Bank Adviser", "Name", "Bank Name", "Age", "Gender", "Is married"},  + GUIInput editableTable GUIInput.createTable(topPanel, "Bank Adviser", "Name", "Bank Name", "Age", "Gender", "Is married"); 
- new GUIComponent[]{nameEditor, bankNameEditor, ageEditor, genderEditor, isMarriedEditor});+ editableTable.setColumnComponents(nameEditor, bankNameEditor, ageEditor, genderEditor, isMarriedEditor); 
 + editableTable.setMinRows(3); // min rows to show if there is no data in the table
   
- gtw.minRows.set(Integer.valueOf(3)); // min rows to show if there is no data in the table + GUIComponentBinding.create(allBankAdvisers.opValue()editableTable.ipCollection());
- GUIElementComponent editableTable = GUIElementComponent.create(topPanel, new GUIInputKind(), gtw, new GUICollectionInput()); // the very table +
-  +
- GUIComponentBinding.create(allBankAdvisers.valueGUICollectionInput.get(editableTable).collection);+
   
  GUIPanelComponent buttonsPanel = GUIPanelComponent.createHorizontal(topPanel, VerticalAlignment.MIDDLE);  GUIPanelComponent buttonsPanel = GUIPanelComponent.createHorizontal(topPanel, VerticalAlignment.MIDDLE);
- buttonsPanel.styleName.set(Text.fromString("margin3"));+ buttonsPanel.setStyle("margin3");
   
  CmdCreateObjectOfClass createCmd = new CmdCreateObjectOfClass();  CmdCreateObjectOfClass createCmd = new CmdCreateObjectOfClass();
- createCmd.className.set(Text.fromString(BankAdviser.FQ_TYPE_NAME));+ createCmd.setClass(BankAdviser.CLASSIFIER);
  GUIButtonComponent createAdviserButton = GUIButtonComponent.create(buttonsPanel, "Create Bank Adviser", createCmd);  GUIButtonComponent createAdviserButton = GUIButtonComponent.create(buttonsPanel, "Create Bank Adviser", createCmd);
 +
  CmdDestroyObject destroyCmd = new CmdDestroyObject();  CmdDestroyObject destroyCmd = new CmdDestroyObject();
- destroyCmd.type.set(Text.fromString(BankAdviser.FQ_TYPE_NAME));+ destroyCmd.setType(BankAdviser.CLASSIFIER);
  GUIButtonComponent destroyAdviserButton = GUIButtonComponent.create(buttonsPanel, "Delete Bank Adviser", destroyCmd);  GUIButtonComponent destroyAdviserButton = GUIButtonComponent.create(buttonsPanel, "Delete Bank Adviser", destroyCmd);
   
- GUIComponentBinding.create(editableTable.value, destroyAdviserButton, CmdDestroyObject.PROPERTIES.input); + GUIComponentBinding.create(editableTable.opValue(), destroyAdviserButton, CmdDestroyObject.PROPERTIES.input); 
- GUIComponentBinding.create(createAdviserButton.commandExecuted, allBankAdvisers.refresh); // this is to tell SAP to read advisers again + GUIComponentBinding.create(createAdviserButton.opCommandExecuted(), allBankAdvisers.ipRefresh()); // this is to tell SAP to read advisers again 
- GUIComponentBinding.create(destroyAdviserButton.commandExecuted, allBankAdvisers.refresh); // this is to tell SAP to read advisers again+ GUIComponentBinding.create(destroyAdviserButton.opCommandExecuted(), allBankAdvisers.ipRefresh()); // this is to tell SAP to read advisers again
  
- GUILabelComponent.create(topPanel, "Clients").styleName.set(Text.fromString("padding3"));+ GUILabelComponent clientsLabel = GUILabelComponent.create(topPanel, "Clients")
 + clientsLabel.setStyle("padding3"); 
 +  
 + GUIEdit clients = GUIEdit.createList(topPanel, BankAdviser.PROPERTIES.myClients); 
 + clients.setSize("250px", "300px")
 + clients.setStyle("listEditor");
   
- GUICommandComponent allPersons = GUICommandComponent.create(topPanel, new FetchPersonsOnly(), PerformImmediately.NOTHING); // invisible command: fetches all persons, but not bank advisers + // invisible command: fetches all persons, but not bank advisers 
- GUIElementComponent clients GUIElementComponent.create(topPanel, GUISlotEditorKind.create(BankAdviser.PROPERTIES.myClients), new GUIListWidget(), new GUICollectionInput()); + GUICommandComponent allPersons GUICommandComponent.create(root, new FetchPersonsOnly(), PerformImmediately.NOTHING); 
- CellLayoutData.setSize(clients, "250px", "300px"); + GUIComponentBinding.create(allPersons, FetchPersonsOnly.PROPERTIES.fetchedPersons, clients.ipCollection()); 
- clients.styleName.set(Text.fromString("listEditor")); + GUIComponentBinding.create(editableTable.opValue()clients.ipElement()); 
- GUIComponentBinding.create(allPersons, FetchPersonsOnly.PROPERTIES.fetchedPersons, GUICollectionInput.get(clients).collection); + GUIComponentBinding.create(page.opStart(), allPersons.ipClick());
- GUIComponentBinding.create(editableTable.valueGUISlotEditorKind.get(clients).element); +
- GUIComponentBinding.create(page.start, allPersons.click);+
  }  }
   
Line 142: Line 136:
  {  {
  GUIContext context = new GUIContext();  GUIContext context = new GUIContext();
- context.supercontext.set(DefaultContextInit.getRoot());+ DefaultContextInit.getRoot().addContext(context);
   
- // This is how Person objects will look like in the GUI+ // This is how Person objects will look like in the GUI.
  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);
Print/export