1+ /********************************************************************************
2+ * Copyright (c) 2020 [Open Lowcode SAS](https://openlowcode.com/)
3+ *
4+ * This program and the accompanying materials are made available under the
5+ * terms of the Eclipse Public License 2.0 which is available at
6+ * http://www.eclipse.org/legal/epl-2.0 .
7+ *
8+ * SPDX-License-Identifier: EPL-2.0
9+ ********************************************************************************/
10+
111package org .openlowcode .design .data .properties .basic ;
212
313import java .io .IOException ;
1626import org .openlowcode .design .pages .PageDefinition ;
1727import org .openlowcode .tools .misc .NamedList ;
1828
29+ /**
30+ * The property for an object that is left for a link to master relationship
31+ *
32+ * @author <a href="https://openlowcode.com/" rel="nofollow">Open Lowcode
33+ * SAS</a>
34+ *
35+ * @param <E> current object
36+ * @param <F> link to master object
37+ * @since 1.9
38+ */
1939public class LeftForLinkToMaster <E extends DataObjectDefinition , F extends DataObjectDefinition >
2040 extends
2141 Property <LeftForLinkToMaster <E , F >> {
@@ -111,7 +131,9 @@ public DataObjectDefinition getLinkObjectDefinition() {
111131 public LinkObjectToMaster <E , F > getLinkObjectProperty () {
112132 DataObjectDefinition linkobject = linkdataobject ;
113133 @ SuppressWarnings ("unchecked" )
114- LinkObjectToMaster <E , F > linkobjectproperty = (LinkObjectToMaster <E , F >) linkobject .getPropertyByName ("LINKOBJECTTOMASTER" );
134+ LinkObjectToMaster <
135+ E ,
136+ F > linkobjectproperty = (LinkObjectToMaster <E , F >) linkobject .getPropertyByName ("LINKOBJECTTOMASTER" );
115137 if (linkobjectproperty == null )
116138 throw new RuntimeException ("link object does not have property" );
117139 return linkobjectproperty ;
@@ -318,15 +340,16 @@ public void generateWidgetCode(SourceGenerator sg, Module module, String locatio
318340 .formatForAttribute (parentproperty .getRightObjectForLink ().getName ());
319341 String rightobjectclass = StringFormatter
320342 .formatForJavaClass (parentproperty .getRightObjectForLink ().getName ());
321-
343+
322344 // ---- temporary code.
323345 DisplayLinkAsAttributeFromLeftObject <E , F > attributeasleft = null ;
324346 /*
325- @SuppressWarnings("unchecked")
326- DisplayLinkAsAttributeFromLeftObject<E, F> attributeasleft = (DisplayLinkAsAttributeFromLeftObject<
327- E, F>) parentproperty.getLinkObjectProperty().getBusinessRuleByName("DISPLAYASATTRIBUTEFROMLEFT");
328- */
329-
347+ * @SuppressWarnings("unchecked") DisplayLinkAsAttributeFromLeftObject<E, F>
348+ * attributeasleft = (DisplayLinkAsAttributeFromLeftObject< E, F>)
349+ * parentproperty.getLinkObjectProperty().getBusinessRuleByName(
350+ * "DISPLAYASATTRIBUTEFROMLEFT");
351+ */
352+
330353 if (attributeasleft == null ) {
331354 // -------------------------------------------------------------------------------------------------
332355 // show link as table. This is the classical display
@@ -346,7 +369,7 @@ public void generateWidgetCode(SourceGenerator sg, Module module, String locatio
346369 sg .wl (" this);" );
347370 sg .wl (" left" + linkobjectvariable + "s.addDisplayProfile(" + linkobjectclass + "Definition.get"
348371 + linkobjectclass + "Definition().getDisplayProfileHideleftobjectfields());" );
349-
372+ sg . wl ( " left" + linkobjectvariable + "s.setMinFieldPriority(-900);" );
350373 sg .wl (" left" + linkobjectvariable + "s.setWarningForUnsavedEdition();" );
351374 sg .wl (" AtgMassupdate" + linkobjectvariable + "andshowleftAction.ActionRef updateleft"
352375 + linkobjectvariable + "s = AtgMassupdate" + linkobjectvariable
@@ -366,7 +389,8 @@ public void generateWidgetCode(SourceGenerator sg, Module module, String locatio
366389 + linkobjectvariable + "action = AtgShow" + rightobjectvariable
367390 + "Action.get().getActionRef();" );
368391 sg .wl (" showright" + rightobjectvariable + "for" + linkobjectvariable + "action.setId(left"
369- + linkobjectvariable + "s.getAttributeInput(" + linkobjectclass + ".getRgmsidMarker()));" );
392+ + linkobjectvariable + "s.getAttributeInput(" + linkobjectclass
393+ + ".getLinkobjecttomasterrightidMarker()));" );
370394 sg .wl (" left" + linkobjectvariable + "s.addDefaultAction(showright" + rightobjectvariable + "for"
371395 + linkobjectvariable + "action);" );
372396 sg .wl (" " );
@@ -414,8 +438,8 @@ public void generateWidgetCode(SourceGenerator sg, Module module, String locatio
414438 + "s = new SObjectDisplay<" + linkobjectclass + ">(\" BLANK"
415439 + linkobject .getName ().toUpperCase () + "FORADD\" ," );
416440
417- sg .wl (" this.getLeftforlinktomasterfor" + linkobjectvariable + "blankforadd(), " + linkobjectclass
418- + ".getDefinition(),this, false);" );
441+ sg .wl (" this.getLeftforlinktomasterfor" + linkobjectvariable + "blankforadd(), "
442+ + linkobjectclass + ".getDefinition(),this, false);" );
419443 sg .wl (" blanklinkforaddtoleft" + linkobjectvariable + "s.setHideReadOnly();" );
420444 sg .wl (" " );
421445 sg .wl (" addtoleft" + linkobjectvariable + "s.addElement(blanklinkforaddtoleft" + linkobjectvariable
@@ -462,7 +486,7 @@ public void generateWidgetCode(SourceGenerator sg, Module module, String locatio
462486 + "button);" );
463487 sg .wl (" " + locationname + ".addElement(left" + linkobjectvariable + "buttonbar);" );
464488 sg .wl (" " + locationname + ".addElement(left" + linkobjectvariable + "s);" );
465- }
489+ }
466490
467491 }
468492
0 commit comments