Hi, We generally create a model package for most of our projects where business logic is maintained. This also includes the current state of the application with code that has no UI logic in it. For most apps we see the model as something global that we don't need to pass around to each object. We use a singleton to manage access to that model logic which is pretty convenient.
On Tuesday, December 22, 2020 at 5:26:32 AM UTC+2 [email protected] wrote: > Hi, > > Forgive my audacity, but this time my question is about logic. > > I have two forms (classes) that interact with each other. The main one has > a set of containers that in each item has a status label (starts pending) > and a "multibutton" component that triggers the second form. > Depending on what you do in the second form the status of the item in the > first form should change (for example to completed). > > In the main form create a public method that is in charge of changing the > status of the item. > > > When I fire the second form, I include in the constructor the object that > represents the first form and in this way I can execute the public method > as I please. > > *public class mainForm extends Form {* > > private container cnItem = new Container(); > > public mainForm() { > > MultiButton mbMyButton; > mbMyButton.addActionListener ((e) -> { > setItemSelect(cn); > new secondForm (this, md) .show (); > } > } > > *public void changeStatus () {* > * changeItemStatus(getItemSelect());* > * }* > > private Container getItemSelect() { > return cnItem; > > > private void setItemSelect(Container cn) { > cnItem = cn; > } > > } > > *public class secondForm extends Form {* > > public secondForm (MainForm mf, ModelDato md) { > if (md.condition) { > mf.changeStatus (); > } > } > > This works for me, but I have always thought that there must be a more > orderly way. > > I thank you if you can point me to a better form of logic. > > Thanks. > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/8f93b5d5-3cd5-4717-b79c-69a51a3524c2n%40googlegroups.com.
