Skip to content

Commit 8db425f

Browse files
author
Open Lowcode SAS
committed
Close #109
1 parent 7b8e33d commit 8db425f

File tree

3 files changed

+128
-87
lines changed

3 files changed

+128
-87
lines changed

src/org/openlowcode/client/graphic/widget/CObjectDisplay.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public class CObjectDisplay
9393
private HashMap<String, CPageDataRef> overridenlabels;
9494
private HashMap<String, CPageDataRef> suggestionsforstringfield;
9595
private TitledPane morepane;
96+
private boolean hasbuttonbar;
97+
private CPageNode buttonbar;
9698

9799
/**
98100
* creates an object display from a message from the server
@@ -177,6 +179,13 @@ public CObjectDisplay(MessageReader reader, CPageSignifPath parentpath) throws O
177179
nodeelementrightoftitle = CPageNode.parseNode(reader, parentpath);
178180
reader.returnNextEndStructure("NRT");
179181

182+
}
183+
this.hasbuttonbar = reader.returnNextBooleanField("HBTBAR");
184+
if (this.hasbuttonbar) {
185+
reader.returnNextStartStructure("BBB");
186+
this.buttonbar = CPageNode.parseNode(reader, parentpath);
187+
reader.returnNextEndStructure("BBB");
188+
180189
}
181190
overridenlabels = new HashMap<String, CPageDataRef>();
182191
reader.startStructureArray("OVWLBL");
@@ -567,7 +576,10 @@ public void handle(MouseEvent me) {
567576

568577
contentpane.getChildren().add(titleextendedpane);
569578
}
570-
579+
if (this.hasbuttonbar) {
580+
contentpane.getChildren().add(this.buttonbar.getNode(actionmanager, inputdata,
581+
parentwindow, parenttabpanes));
582+
}
571583
if (this.showcontent) {
572584
contentpane.getChildren().add(fieldtable.getNode(actionmanager, inputdata, parentwindow, parenttabpanes));
573585
if (hasmorefields) {

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

Lines changed: 92 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -755,35 +755,6 @@ public void generateToFile(SourceGenerator sg, Module module) throws IOException
755755

756756
sg.wl(" // Display Object");
757757

758-
// -------------------------------- Process Image Content
759-
760-
for (int i = 0; i < dataobject.propertylist.getSize(); i++) {
761-
Property<?> thisproperty = dataobject.propertylist.get(i);
762-
if (thisproperty instanceof ImageContent) {
763-
ImageContent imagecontent = (ImageContent) thisproperty;
764-
String imagename = StringFormatter.formatForAttribute(imagecontent.getInstancename());
765-
String imageclass = StringFormatter.formatForJavaClass(imagecontent.getInstancename());
766-
767-
sg.wl(" // Display image " + imageclass + "");
768-
sg.wl(" AtgGetfullimagefor" + imagename + "for" + objectvariable + "Action.InlineActionRef "
769-
+ imagename + "fulldisplayaction = AtgGetfullimagefor" + imagename + "for" + objectvariable
770-
+ "Action.get().getInlineActionRef();");
771-
sg.wl(" SObjectIdStorage<Binaryfile> " + imagename
772-
+ "fullidstorage = new SObjectIdStorage<Binaryfile>(\""
773-
+ imagecontent.getInstancename().toUpperCase() + "FULLID\",this,this.get" + imageclass
774-
+ "fullimgid());");
775-
sg.wl(" " + mainobjectlocation + ".addElement(" + imagename + "fullidstorage);");
776-
sg.wl(" " + imagename + "fulldisplayaction.set" + objectclass
777-
+ "id(objectdisplaydefinition.getAttributeInput(" + objectclass + ".getIdMarker()));");
778-
sg.wl(" SImageDisplay " + imagename + "thumbnaildisplay = new SImageDisplay(\""
779-
+ imagecontent.getInstancename().toUpperCase() + "THUMBNAIL\", this,this.get" + imageclass
780-
+ "tbn(), " + imagename + "fulldisplayaction,GetfileAction.get().getFileRef(),\""
781-
+ StringFormatter.formatForJavaClass(imagecontent.getInstancename()) + "\");");
782-
sg.wl(" " + mainobjectlocation + ".addElement(" + imagename + "thumbnaildisplay);");
783-
sg.wl("");
784-
}
785-
}
786-
787758
// -------------------------------- Button band under object ------------
788759

789760
if (objectbuttonband) {
@@ -1035,7 +1006,7 @@ public void generateToFile(SourceGenerator sg, Module module) throws IOException
10351006
sg.wl(" deletebutton.setConfirmationMessage(\"Are you sure you want to delete this " + dataobject.getLabel()
10361007
+ " ?\");");
10371008
sg.wl(" managepopup.addElement(deletebutton);");
1038-
}
1009+
10391010

10401011
if ((dataobject.IsIterated()) || (dataobject.isVersioned())) {
10411012

@@ -1149,6 +1120,96 @@ public void generateToFile(SourceGenerator sg, Module module) throws IOException
11491120
sg.wl(" objectbuttonband.addElement(showplanningbutton);");
11501121

11511122
}
1123+
1124+
for (int i = 0; i < dataobject.propertylist.getSize(); i++) {
1125+
Property<?> thisproperty = dataobject.propertylist.get(i);
1126+
if (thisproperty instanceof ImageContent) {
1127+
ImageContent imagecontent = (ImageContent) thisproperty;
1128+
String imagename = StringFormatter.formatForAttribute(imagecontent.getInstancename());
1129+
1130+
sg.wl("// set image for " + imagename + "");
1131+
sg.wl(" AtgSetimagecontentfor" + imagename + "for" + objectvariable
1132+
+ "Action.ActionRef setimagecontentfor" + imagename + "action = AtgSetimagecontentfor"
1133+
+ imagename + "for" + objectvariable + "Action.get().getActionRef();");
1134+
sg.wl(" SImageChooser imagechooserfor" + imagename + " = new SImageChooser(\""
1135+
+ imagecontent.getInstancename().toUpperCase() + "\", this,160, setimagecontentfor" + imagename
1136+
+ "action,\"Set as " + imagename + "\");");
1137+
sg.wl("setimagecontentfor" + imagename + "action.set" + objectclass
1138+
+ "(objectdisplaydefinition.getAttributeInput(" + objectclass + ".getIdMarker()));");
1139+
sg.wl(" setimagecontentfor" + imagename + "action.setFullimage(imagechooserfor" + imagename
1140+
+ ".getFullImageDataInput());");
1141+
sg.wl(" setimagecontentfor" + imagename + "action.setThumbnail(imagechooserfor" + imagename
1142+
+ ".getThumbnailImageDataInput());");
1143+
sg.wl(" SPopupButton setimagecontentfor" + imagename + "button = new SPopupButton(this, imagechooserfor"
1144+
+ imagename + ", \"set image for " + imagename + "\",\"allows to add an image as " + imagename
1145+
+ " from either clipboard or file\",false,setimagecontentfor" + imagename + "action);");
1146+
sg.wl(" objectbuttonband.addElement(setimagecontentfor" + imagename + "button);");
1147+
1148+
}
1149+
}
1150+
1151+
for (int i = 0; i < dataobject.propertylist.getSize(); i++) {
1152+
Property<?> thisproperty = dataobject.propertylist.get(i);
1153+
if (thisproperty instanceof PrintOut) {
1154+
PrintOut printout = (PrintOut) thisproperty;
1155+
String printoutnamevariable = StringFormatter.formatForAttribute(printout.getInstancename());
1156+
1157+
sg.wl(" // Preview " + printoutnamevariable + "");
1158+
sg.wl(" AtgPreviewprintoutfor" + objectvariable + "for" + printoutnamevariable
1159+
+ "Action.InlineActionRef preview" + printoutnamevariable + " = AtgPreviewprintoutfor"
1160+
+ objectvariable + "for" + printoutnamevariable + "Action.get().getInlineActionRef();");
1161+
sg.wl(" preview" + printoutnamevariable + ".set" + objectclass
1162+
+ "id(objectdisplaydefinition.getAttributeInput(" + objectclass
1163+
+ ".getDefinition().getIdMarker()));");
1164+
sg.wl(" SActionButton " + printoutnamevariable
1165+
+ "preview = new SActionButton(\"Preview Printout\",preview" + printoutnamevariable
1166+
+ ",this);");
1167+
sg.wl(" objectbuttonband.addElement(" + printoutnamevariable + "preview);");
1168+
sg.wl(" SFileDownloader preview" + printoutnamevariable
1169+
+ "downloader = new SFileDownloader(\"PREVIEWDOWNLOAD\", this, preview" + printoutnamevariable
1170+
+ ",AtgPreviewprintoutfor" + objectvariable + "for" + printoutnamevariable
1171+
+ "Action.get().getPreviewRef());");
1172+
sg.wl(" objectbuttonband.addElement(preview" + printoutnamevariable + "downloader);");
1173+
1174+
}
1175+
}
1176+
1177+
1178+
sg.wl(" objectdisplaydefinition.addButtonBarUnderTitle(objectbuttonband);");
1179+
1180+
1181+
}
1182+
1183+
1184+
// -------------------------------- Process Image Content
1185+
1186+
for (int i = 0; i < dataobject.propertylist.getSize(); i++) {
1187+
Property<?> thisproperty = dataobject.propertylist.get(i);
1188+
if (thisproperty instanceof ImageContent) {
1189+
ImageContent imagecontent = (ImageContent) thisproperty;
1190+
String imagename = StringFormatter.formatForAttribute(imagecontent.getInstancename());
1191+
String imageclass = StringFormatter.formatForJavaClass(imagecontent.getInstancename());
1192+
1193+
sg.wl(" // Display image " + imageclass + "");
1194+
sg.wl(" AtgGetfullimagefor" + imagename + "for" + objectvariable + "Action.InlineActionRef "
1195+
+ imagename + "fulldisplayaction = AtgGetfullimagefor" + imagename + "for" + objectvariable
1196+
+ "Action.get().getInlineActionRef();");
1197+
sg.wl(" SObjectIdStorage<Binaryfile> " + imagename
1198+
+ "fullidstorage = new SObjectIdStorage<Binaryfile>(\""
1199+
+ imagecontent.getInstancename().toUpperCase() + "FULLID\",this,this.get" + imageclass
1200+
+ "fullimgid());");
1201+
sg.wl(" " + mainobjectlocation + ".addElement(" + imagename + "fullidstorage);");
1202+
sg.wl(" " + imagename + "fulldisplayaction.set" + objectclass
1203+
+ "id(objectdisplaydefinition.getAttributeInput(" + objectclass + ".getIdMarker()));");
1204+
sg.wl(" SImageDisplay " + imagename + "thumbnaildisplay = new SImageDisplay(\""
1205+
+ imagecontent.getInstancename().toUpperCase() + "THUMBNAIL\", this,this.get" + imageclass
1206+
+ "tbn(), " + imagename + "fulldisplayaction,GetfileAction.get().getFileRef(),\""
1207+
+ StringFormatter.formatForJavaClass(imagecontent.getInstancename()) + "\");");
1208+
sg.wl(" " + mainobjectlocation + ".addElement(" + imagename + "thumbnaildisplay);");
1209+
sg.wl("");
1210+
}
1211+
}
1212+
11521213

11531214
// display all left links as field
11541215

@@ -1319,62 +1380,7 @@ public void generateToFile(SourceGenerator sg, Module module) throws IOException
13191380
}
13201381

13211382
}
1322-
for (int i = 0; i < dataobject.propertylist.getSize(); i++) {
1323-
Property<?> thisproperty = dataobject.propertylist.get(i);
1324-
if (thisproperty instanceof ImageContent) {
1325-
ImageContent imagecontent = (ImageContent) thisproperty;
1326-
String imagename = StringFormatter.formatForAttribute(imagecontent.getInstancename());
1327-
1328-
sg.wl("// set image for " + imagename + "");
1329-
sg.wl(" AtgSetimagecontentfor" + imagename + "for" + objectvariable
1330-
+ "Action.ActionRef setimagecontentfor" + imagename + "action = AtgSetimagecontentfor"
1331-
+ imagename + "for" + objectvariable + "Action.get().getActionRef();");
1332-
sg.wl(" SImageChooser imagechooserfor" + imagename + " = new SImageChooser(\""
1333-
+ imagecontent.getInstancename().toUpperCase() + "\", this,160, setimagecontentfor" + imagename
1334-
+ "action,\"Set as " + imagename + "\");");
1335-
sg.wl("setimagecontentfor" + imagename + "action.set" + objectclass
1336-
+ "(objectdisplaydefinition.getAttributeInput(" + objectclass + ".getIdMarker()));");
1337-
sg.wl(" setimagecontentfor" + imagename + "action.setFullimage(imagechooserfor" + imagename
1338-
+ ".getFullImageDataInput());");
1339-
sg.wl(" setimagecontentfor" + imagename + "action.setThumbnail(imagechooserfor" + imagename
1340-
+ ".getThumbnailImageDataInput());");
1341-
sg.wl(" SPopupButton setimagecontentfor" + imagename + "button = new SPopupButton(this, imagechooserfor"
1342-
+ imagename + ", \"set image for " + imagename + "\",\"allows to add an image as " + imagename
1343-
+ " from either clipboard or file\",false,setimagecontentfor" + imagename + "action);");
1344-
sg.wl(" objectbuttonband.addElement(setimagecontentfor" + imagename + "button);");
1345-
1346-
}
1347-
}
1348-
1349-
for (int i = 0; i < dataobject.propertylist.getSize(); i++) {
1350-
Property<?> thisproperty = dataobject.propertylist.get(i);
1351-
if (thisproperty instanceof PrintOut) {
1352-
PrintOut printout = (PrintOut) thisproperty;
1353-
String printoutnamevariable = StringFormatter.formatForAttribute(printout.getInstancename());
1354-
1355-
sg.wl(" // Preview " + printoutnamevariable + "");
1356-
sg.wl(" AtgPreviewprintoutfor" + objectvariable + "for" + printoutnamevariable
1357-
+ "Action.InlineActionRef preview" + printoutnamevariable + " = AtgPreviewprintoutfor"
1358-
+ objectvariable + "for" + printoutnamevariable + "Action.get().getInlineActionRef();");
1359-
sg.wl(" preview" + printoutnamevariable + ".set" + objectclass
1360-
+ "id(objectdisplaydefinition.getAttributeInput(" + objectclass
1361-
+ ".getDefinition().getIdMarker()));");
1362-
sg.wl(" SActionButton " + printoutnamevariable
1363-
+ "preview = new SActionButton(\"Preview Printout\",preview" + printoutnamevariable
1364-
+ ",this);");
1365-
sg.wl(" objectbuttonband.addElement(" + printoutnamevariable + "preview);");
1366-
sg.wl(" SFileDownloader preview" + printoutnamevariable
1367-
+ "downloader = new SFileDownloader(\"PREVIEWDOWNLOAD\", this, preview" + printoutnamevariable
1368-
+ ",AtgPreviewprintoutfor" + objectvariable + "for" + printoutnamevariable
1369-
+ "Action.get().getPreviewRef());");
1370-
sg.wl(" objectbuttonband.addElement(preview" + printoutnamevariable + "downloader);");
1371-
1372-
}
1373-
}
1374-
1375-
if (objectbuttonband) {
1376-
sg.wl(" " + mainobjectlocation + ".addElement(objectbuttonband);");
1377-
}
1383+
13781384

13791385
// ----------------------------------------------------------------------------------------
13801386
// -- DISPLAY WIDGETS --

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public class SObjectDisplay<E extends DataObject<E>>
6060
private SPageNode noderightoftitle = null;
6161
private boolean hasnoderightoftitle = false;
6262

63+
private SPageNode buttonbar = null;
64+
private boolean hasbuttonbar=false;
65+
6366
private boolean showcontent;
6467
private boolean showtitle;
6568
private int morefieldpriority = 0;
@@ -272,6 +275,16 @@ public void addPageNodeRightOfTitle(SPageNode node) {
272275
this.noderightoftitle = node;
273276
}
274277

278+
/**
279+
*
280+
*
281+
* @param node node to add as button bar under the title
282+
*/
283+
public void addButtonBarUnderTitle(SPageNode node) {
284+
this.hasbuttonbar = true;
285+
this.buttonbar = node;
286+
}
287+
275288
@Override
276289
public String getPathName() {
277290
return this.name;
@@ -308,6 +321,14 @@ public void WritePayloadToCDL(MessageWriter writer, SPageData input, SecurityBuf
308321
writer.endStructure("NRT");
309322

310323
}
324+
325+
writer.addBooleanField("HBTBAR", this.hasbuttonbar);
326+
if (this.hasbuttonbar) {
327+
writer.startStructure("BBB");
328+
this.buttonbar.WriteToCDL(writer, input, buffer);
329+
writer.endStructure("BBB");
330+
}
331+
311332
// ------------------------------ writing overwrite label
312333
writer.startStructure("OVWLBLS");
313334
Iterator<Entry<DataObjectFieldMarker<E>, TextDataElt>> labelsiterator = overridenlabels.entrySet().iterator();
@@ -359,5 +380,7 @@ public void populateDown(SPageSignifPath parentpath, SPageNode[] widgetpathtoroo
359380
this.setSignifPath(new SPageSignifPath(this.getPathName(), this.getPage(), parentpath, widgetpathtoroot));
360381
if (noderightoftitle != null)
361382
noderightoftitle.populateDown(parentpath, widgetpathtoroot);
383+
if (buttonbar!=null)
384+
buttonbar.populateDown(parentpath, widgetpathtoroot);
362385
}
363386
}

0 commit comments

Comments
 (0)