Skip to content

Commit fd09bd2

Browse files
author
Open Lowcode SAS
committed
Close #230
1 parent 1518b78 commit fd09bd2

File tree

2 files changed

+101
-79
lines changed

2 files changed

+101
-79
lines changed

src/org/openlowcode/design/data/DataObjectDefinitionOtherActions.java

Lines changed: 100 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,10 @@ public static void generatePrepareAddLinesActionToFile(
536536
Module module,
537537
HasMultiDimensionalChild hasmultidimensionchild) throws IOException {
538538
String parentclass = StringFormatter.formatForJavaClass(parent.getName());
539-
String childclass = StringFormatter.formatForJavaClass(hasmultidimensionchild.getOriginMultiDimensionChildProperty().getParent().getName());
539+
String childclass = StringFormatter.formatForJavaClass(
540+
hasmultidimensionchild.getOriginMultiDimensionChildProperty().getParent().getName());
540541

541-
542-
sg.wl("package "+module.getPath()+".action.generated;");
542+
sg.wl("package " + module.getPath() + ".action.generated;");
543543
sg.wl("");
544544
sg.wl("import java.util.function.Function;");
545545
sg.wl("");
@@ -549,33 +549,38 @@ public static void generatePrepareAddLinesActionToFile(
549549
sg.wl("import org.openlowcode.server.graphic.SPage;");
550550
sg.wl("import org.openlowcode.server.runtime.SModule;");
551551
sg.wl("");
552-
sg.wl("import "+module.getPath()+".data."+parentclass+";");
553-
sg.wl("import "+module.getPath()+".data."+childclass+";");
554-
sg.wl("import "+module.getPath()+".page.generated.AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Page;");
552+
sg.wl("import " + module.getPath() + ".data." + parentclass + ";");
553+
sg.wl("import " + module.getPath() + ".data." + childclass + ";");
554+
sg.wl("import " + module.getPath() + ".page.generated.AtgAddlinesfor"
555+
+ hasmultidimensionchild.getInstancename().toLowerCase() + "Page;");
555556
sg.wl("");
556557
sg.wl("");
557-
sg.wl("public class AtgPrepareaddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action");
558+
sg.wl("public class AtgPrepareaddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Action");
558559
sg.wl(" extends");
559-
sg.wl(" AbsPrepareaddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action {");
560+
sg.wl(" AbsPrepareaddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Action {");
560561
sg.wl("");
561-
sg.wl(" public AtgPrepareaddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action(SModule parent) {");
562+
sg.wl(" public AtgPrepareaddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
563+
+ "Action(SModule parent) {");
562564
sg.wl(" super(parent);");
563565
sg.wl(" }");
564566
sg.wl("");
565567
sg.wl(" @Override");
566568
sg.wl(" public ActionOutputData executeActionLogic(");
567-
sg.wl(" DataObjectId<"+parentclass+"> activityid,");
569+
sg.wl(" DataObjectId<" + parentclass + "> activityid,");
568570
sg.wl(" Function<TableAlias, QueryFilter> datafilter) {");
569-
sg.wl(" "+parentclass+" activity = "+parentclass+".readone(activityid);");
570-
sg.wl(" "+childclass+"[] children = activity.getallchildrenfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"(null);");
571-
sg.wl(" "+childclass+"[] blanks = new "+childclass+"[10];");
572-
sg.wl(" for (int i=0;i<blanks.length;i++) blanks[i] = new "+childclass+"();");
571+
sg.wl(" " + parentclass + " activity = " + parentclass + ".readone(activityid);");
572+
sg.wl(" " + childclass + "[] children = activity.getallchildrenfor"
573+
+ hasmultidimensionchild.getInstancename().toLowerCase() + "(null);");
574+
sg.wl(" " + childclass + "[] blanks = new " + childclass + "[10];");
575+
sg.wl(" for (int i=0;i<blanks.length;i++) blanks[i] = new " + childclass + "();");
573576
sg.wl(" return new ActionOutputData(activityid, blanks, children, activity.dropIdToString());");
574577
sg.wl(" }");
575578
sg.wl("");
576579
sg.wl(" @Override");
577580
sg.wl(" public SPage choosePage(ActionOutputData logicoutput) {");
578-
sg.wl(" return new AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Page(logicoutput.get"+parentclass+"id_thru(),logicoutput.getNewblanks(), logicoutput.getExistingchildren(),logicoutput.getContext());");
581+
sg.wl(" return new AtgAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
582+
+ "Page(logicoutput.get" + parentclass
583+
+ "id_thru(),logicoutput.getNewblanks(), logicoutput.getExistingchildren(),logicoutput.getContext());");
579584
sg.wl(" }");
580585
sg.wl("");
581586
sg.wl("}");
@@ -590,9 +595,10 @@ public static void generateAddLinesActionToFile(
590595
HasMultiDimensionalChild hasmultidimensionchild) throws IOException {
591596
String parentclass = StringFormatter.formatForJavaClass(parent.getName());
592597
String parentvariable = StringFormatter.formatForAttribute(parent.getName());
593-
String childclass = StringFormatter.formatForJavaClass(hasmultidimensionchild.getOriginMultiDimensionChildProperty().getParent().getName());
594-
595-
sg.wl("package "+module.getPath()+".action.generated;");
598+
String childclass = StringFormatter.formatForJavaClass(
599+
hasmultidimensionchild.getOriginMultiDimensionChildProperty().getParent().getName());
600+
601+
sg.wl("package " + module.getPath() + ".action.generated;");
596602
sg.wl("");
597603
sg.wl("import java.util.function.Function;");
598604
sg.wl("");
@@ -602,32 +608,33 @@ public static void generateAddLinesActionToFile(
602608
sg.wl("import org.openlowcode.server.graphic.SPage;");
603609
sg.wl("import org.openlowcode.server.runtime.SModule;");
604610
sg.wl("");
605-
sg.wl("import "+module.getPath()+".data."+parentclass+";");
606-
sg.wl("import "+module.getPath()+".data."+childclass+";");
611+
sg.wl("import " + module.getPath() + ".data." + parentclass + ";");
612+
sg.wl("import " + module.getPath() + ".data." + childclass + ";");
607613
sg.wl("");
608614
sg.wl("");
609-
sg.wl("public class AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action");
615+
sg.wl("public class AtgAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Action");
610616
sg.wl(" extends");
611-
sg.wl(" AbsAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action {");
617+
sg.wl(" AbsAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Action {");
612618
sg.wl("");
613-
sg.wl(" public AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action(SModule parent) {");
619+
sg.wl(" public AtgAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
620+
+ "Action(SModule parent) {");
614621
sg.wl(" super(parent);");
615622
sg.wl("");
616623
sg.wl(" }");
617624
sg.wl("");
618625
sg.wl(" @Override");
619-
sg.wl(" public DataObjectId<"+parentclass+"> executeActionLogic(");
620-
sg.wl(" DataObjectId<"+parentclass+"> activityid,");
621-
sg.wl(" "+childclass+"[] newblanks,");
626+
sg.wl(" public DataObjectId<" + parentclass + "> executeActionLogic(");
627+
sg.wl(" DataObjectId<" + parentclass + "> activityid,");
628+
sg.wl(" " + childclass + "[] newblanks,");
622629
sg.wl(" Function<TableAlias, QueryFilter> datafilter) {");
623-
sg.wl(" "+parentclass+" activity = "+parentclass+".readone(activityid);");
624-
sg.wl(" activity.addlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"(newblanks);");
630+
sg.wl(" " + parentclass + " activity = " + parentclass + ".readone(activityid);");
631+
sg.wl(" activity.addlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "(newblanks);");
625632
sg.wl(" return activityid;");
626633
sg.wl(" }");
627634
sg.wl("");
628635
sg.wl(" @Override");
629-
sg.wl(" public SPage choosePage(DataObjectId<"+parentclass+"> activityid_thru) {");
630-
sg.wl(" return AtgShow"+parentvariable+"Action.get().executeAndShowPage(activityid_thru);");
636+
sg.wl(" public SPage choosePage(DataObjectId<" + parentclass + "> activityid_thru) {");
637+
sg.wl(" return AtgShow" + parentvariable + "Action.get().executeAndShowPage(activityid_thru);");
631638
sg.wl(" }");
632639
sg.wl("");
633640
sg.wl("}");
@@ -642,10 +649,14 @@ public static void generateAddLinesPageToFile(
642649
HasMultiDimensionalChild hasmultidimensionchild) throws IOException {
643650
String parentclass = StringFormatter.formatForJavaClass(parent.getName());
644651
String parentvariable = StringFormatter.formatForAttribute(parent.getName());
645-
String childclass = StringFormatter.formatForJavaClass(hasmultidimensionchild.getOriginMultiDimensionChildProperty().getParent().getName());
646-
647-
sg.wl("package "+module.getPath()+".page.generated;");
652+
String childclass = StringFormatter.formatForJavaClass(
653+
hasmultidimensionchild.getOriginMultiDimensionChildProperty().getParent().getName());
654+
655+
sg.wl("package " + module.getPath() + ".page.generated;");
656+
sg.wl("");
657+
sg.wl("import java.util.ArrayList;");
648658
sg.wl("");
659+
649660
sg.wl("import org.openlowcode.server.data.DataObjectFieldMarker;");
650661
sg.wl("import org.openlowcode.server.data.properties.DataObjectId;");
651662
sg.wl("import org.openlowcode.server.graphic.SPageNode;");
@@ -656,33 +667,35 @@ public static void generateAddLinesPageToFile(
656667
sg.wl("import org.openlowcode.server.graphic.widget.SObjectIdStorage;");
657668
sg.wl("import org.openlowcode.server.graphic.widget.SPageText;");
658669
sg.wl("");
659-
sg.wl("import "+module.getPath()+".action.generated.AbsAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action;");
660-
sg.wl("import "+module.getPath()+".action.generated.AbsShow"+parentvariable+"Action;");
661-
sg.wl("import "+module.getPath()+".action.generated.AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action;");
662-
sg.wl("import "+module.getPath()+".action.generated.AtgShow"+parentvariable+"Action;");
663-
sg.wl("import "+module.getPath()+".data."+parentclass+";");
664-
sg.wl("import "+module.getPath()+".data."+childclass+";");
665-
sg.wl("import "+module.getPath()+".data."+childclass+"Definition;");
670+
sg.wl("import " + module.getPath() + ".action.generated.AbsAddlinesfor"
671+
+ hasmultidimensionchild.getInstancename().toLowerCase() + "Action;");
672+
sg.wl("import " + module.getPath() + ".action.generated.AbsShow" + parentvariable + "Action;");
673+
sg.wl("import " + module.getPath() + ".action.generated.AtgAddlinesfor"
674+
+ hasmultidimensionchild.getInstancename().toLowerCase() + "Action;");
675+
sg.wl("import " + module.getPath() + ".action.generated.AtgShow" + parentvariable + "Action;");
676+
sg.wl("import " + module.getPath() + ".data." + parentclass + ";");
677+
sg.wl("import " + module.getPath() + ".data." + childclass + ";");
678+
sg.wl("import " + module.getPath() + ".data." + childclass + "Definition;");
666679
sg.wl("");
667680
sg.wl("");
668-
sg.wl("public class AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Page");
681+
sg.wl("public class AtgAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Page");
669682
sg.wl(" extends");
670-
sg.wl(" AbsAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Page {");
683+
sg.wl(" AbsAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Page {");
671684
sg.wl("");
672-
sg.wl(" public AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Page(");
673-
sg.wl(" DataObjectId<"+parentclass+"> "+parentvariable+"id_thru,");
674-
sg.wl(" "+childclass+"[] newblanks,");
675-
sg.wl(" "+childclass+"[] existingchildren,");
685+
sg.wl(" public AtgAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Page(");
686+
sg.wl(" DataObjectId<" + parentclass + "> " + parentvariable + "id_thru,");
687+
sg.wl(" " + childclass + "[] newblanks,");
688+
sg.wl(" " + childclass + "[] existingchildren,");
676689
sg.wl(" String context) {");
677-
sg.wl(" super("+parentvariable+"id_thru, newblanks, existingchildren, context);");
690+
sg.wl(" super(" + parentvariable + "id_thru, newblanks, existingchildren, context);");
678691
sg.wl("");
679692
sg.wl(" }");
680693
sg.wl("");
681694
sg.wl(" @Override");
682695
sg.wl(" public String generateTitle(");
683-
sg.wl(" DataObjectId<"+parentclass+"> "+parentvariable+"id_thru,");
684-
sg.wl(" "+childclass+"[] newblanks,");
685-
sg.wl(" "+childclass+"[] existingchildren,");
696+
sg.wl(" DataObjectId<" + parentclass + "> " + parentvariable + "id_thru,");
697+
sg.wl(" " + childclass + "[] newblanks,");
698+
sg.wl(" " + childclass + "[] existingchildren,");
686699
sg.wl(" String context) {");
687700
sg.wl("");
688701
sg.wl(" return \"Add lines\";");
@@ -694,38 +707,55 @@ public static void generateAddLinesPageToFile(
694707
sg.wl(" mainband.addElement(new SPageText(\"Add lines\", SPageText.TYPE_TITLE, this));");
695708
sg.wl(" mainband.addElement(new SPageText(this.getContext(), SPageText.TYPE_NORMAL, this));");
696709
sg.wl(" ");
697-
sg.wl(" SObjectIdStorage<"+parentclass+"> "+parentvariable+"idstorage = new SObjectIdStorage<"+parentclass+">(\"ACTIVITYIDSTORAGE\",this,this.get"+parentclass+"id_thru());");
698-
sg.wl(" mainband.addElement("+parentvariable+"idstorage);");
699-
sg.wl(" SObjectArray<"+childclass+"> blankarray = new SObjectArray<"+childclass+">(\"BLANKARRAY\", this.getNewblanks(),");
700-
sg.wl(" "+childclass+".getDefinition(), this);");
710+
sg.wl(" SObjectIdStorage<" + parentclass + "> " + parentvariable + "idstorage = new SObjectIdStorage<"
711+
+ parentclass + ">(\"ACTIVITYIDSTORAGE\",this,this.get" + parentclass + "id_thru());");
712+
sg.wl(" mainband.addElement(" + parentvariable + "idstorage);");
713+
sg.wl(" SObjectArray<" + childclass + "> blankarray = new SObjectArray<" + childclass
714+
+ ">(\"BLANKARRAY\", this.getNewblanks(),");
715+
sg.wl(" " + childclass + ".getDefinition(), this);");
701716
sg.wl(" blankarray.setRowsToDisplay(10);");
702717
Field[] payload = hasmultidimensionchild.getOriginMultiDimensionChildProperty().getPayloadValue();
703718
Field firstaxisvalue = hasmultidimensionchild.getOriginMultiDimensionChildProperty().getFirstAxisValue();
704-
for (int i=0;i<payload.length;i++) sg.wl(" blankarray.hideAttribute("+childclass+".get"+StringFormatter.formatForJavaClass(payload[i].getName())+"FieldMarker());");
705-
sg.wl(" blankarray.hideAttribute("+childclass+".get"+StringFormatter.formatForJavaClass(firstaxisvalue.getName())+"FieldMarker());");
706-
if (parent.getPropertyByName("LIFECYCLE")!=null)
707-
sg.wl(" blankarray.hideAttribute("+childclass+".getStateFieldMarker());");
708-
sg.wl(" blankarray.setUpdateByDefault();");
719+
for (int i = 0; i < payload.length; i++)
720+
sg.wl(" blankarray.hideAttribute(" + childclass + ".get"
721+
+ StringFormatter.formatForJavaClass(payload[i].getName()) + "FieldMarker());");
722+
sg.wl(" blankarray.hideAttribute(" + childclass + ".get"
723+
+ StringFormatter.formatForJavaClass(firstaxisvalue.getName()) + "FieldMarker());");
724+
if (parent.getPropertyByName("LIFECYCLE") != null)
725+
sg.wl(" blankarray.hideAttribute(" + childclass + ".getStateFieldMarker());");
709726
sg.wl(" blankarray.setMinFieldPriority(0);");
710727
sg.wl(" mainband.addElement(blankarray);");
711728
sg.wl("");
712-
sg.wl(" AbsAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action.ActionRef addchildrenaction = AtgAddlinesfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"Action.get().getActionRef();");
713-
sg.wl(" addchildrenaction.set"+parentclass+"id("+parentvariable+"idstorage.getObjectIdInput());");
729+
sg.wl(" AbsAddlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
730+
+ "Action.ActionRef addchildrenaction = AtgAddlinesfor"
731+
+ hasmultidimensionchild.getInstancename().toLowerCase() + "Action.get().getActionRef();");
732+
sg.wl(" addchildrenaction.set" + parentclass + "id(" + parentvariable + "idstorage.getObjectIdInput());");
714733
sg.wl(" addchildrenaction.setNewblanks(blankarray.getActiveObjectArray());");
715-
sg.wl(" blankarray.addUpdateAction(addchildrenaction, null, true);");
734+
735+
sg.wl(" ArrayList<DataObjectFieldMarker<" + childclass
736+
+ ">> editionfields = new ArrayList<DataObjectFieldMarker<" + childclass + ">>();");
737+
Field[] secondaryaxis = hasmultidimensionchild.getOriginMultiDimensionChildProperty().getSecondAxisValue();
738+
for (int i = 0; i < secondaryaxis.length; i++)
739+
sg.wl(" editionfields.add(" + childclass + ".get"
740+
+ StringFormatter.formatForJavaClass(secondaryaxis[i].getName()) + "FieldMarker());");
741+
742+
sg.wl(" blankarray.addUpdateAction(addchildrenaction, editionfields, true,false);");
743+
716744
sg.wl("");
717745
sg.wl(" SComponentBand buttonband = new SComponentBand(SComponentBand.DIRECTION_RIGHT,this);");
718746
sg.wl("");
719-
sg.wl(" AbsShow"+parentvariable+"Action.ActionRef backtoparent = AtgShow"+parentvariable+"Action.get().getActionRef();");
720-
sg.wl(" backtoparent.setId("+parentvariable+"idstorage.getObjectIdInput());");
747+
sg.wl(" AbsShow" + parentvariable + "Action.ActionRef backtoparent = AtgShow" + parentvariable
748+
+ "Action.get().getActionRef();");
749+
sg.wl(" backtoparent.setId(" + parentvariable + "idstorage.getObjectIdInput());");
721750
sg.wl("");
722751
sg.wl(" buttonband.addElement(new SActionButton(\"Back\", backtoparent,this));");
723752
sg.wl(" buttonband.addElement(new SActionButton(\"Create new\",addchildrenaction,this));");
724753
sg.wl(" mainband.addElement(buttonband);");
725754
sg.wl(" mainband.addElement(new SPageText(\"Existing Elements below\", SPageText.TYPE_TITLE, this));");
726755
sg.wl("");
727-
728-
hasmultidimensionchild.getOriginMultiDimensionChildProperty().getLinkedToParent().getLinkedFromChildren().writeGrid(sg, "EXISTING", "existing", "existingchildren");
756+
757+
hasmultidimensionchild.getOriginMultiDimensionChildProperty().getLinkedToParent().getLinkedFromChildren()
758+
.writeGrid(sg, "EXISTING", "existing", "existingchildren");
729759

730760
sg.wl(" mainband.addElement(existing);");
731761
sg.wl(" return mainband;");
@@ -759,11 +789,9 @@ public static void generateRepairMultiDimensionChildrenToFile(
759789
sg.wl("import " + path + ".action.generated.AtgShow" + parentvariable + "Action;");
760790
sg.wl("import " + path + ".data." + parentclass + ";");
761791
sg.wl("");
762-
sg.wl("public class AtgRepairlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
763-
+ "Action");
792+
sg.wl("public class AtgRepairlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Action");
764793
sg.wl(" extends");
765-
sg.wl(" AbsRepairlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
766-
+ "Action {");
794+
sg.wl(" AbsRepairlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase() + "Action {");
767795
sg.wl("");
768796
sg.wl(" public AtgRepairlinesfor" + hasmultidimensionchild.getInstancename().toLowerCase()
769797
+ "Action(SModule parent) {");
@@ -776,7 +804,8 @@ public static void generateRepairMultiDimensionChildrenToFile(
776804
sg.wl(" Function<TableAlias, QueryFilter> datafilter) {");
777805
sg.wl(" " + parentclass + " " + parentvariable + " = " + parentclass + ".readone(" + parentvariable
778806
+ "id);");
779-
sg.wl(" " + parentvariable + ".repairfor"+hasmultidimensionchild.getInstancename().toLowerCase()+"(null);");
807+
sg.wl(" " + parentvariable + ".repairfor" + hasmultidimensionchild.getInstancename().toLowerCase()
808+
+ "(null);");
780809
sg.wl(" return new ActionOutputData(" + parentvariable + "id);");
781810
sg.wl(" }");
782811
sg.wl("");

src/org/openlowcode/server/graphic/widget/SObjectArray.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,7 @@ public void addDisplayProfile(DisplayProfile<E> profile) {
154154
this.activeprofiles.add(profile);
155155
}
156156

157-
/**
158-
* sets the table to be in update mode by default
159-
* @since 1.12
160-
*/
161-
public void setUpdateByDefault() {
162-
this.defaultupdatemode=true;
163-
}
164-
157+
165158
/**
166159
* sets a default action that will be triggered in read-only mode when double
167160
* clicking on a line

0 commit comments

Comments
 (0)