Skip to content

Commit 5b7af65

Browse files
author
Open Lowcode SAS
committed
Close #231
1 parent fd09bd2 commit 5b7af65

File tree

11 files changed

+48
-29
lines changed

11 files changed

+48
-29
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,24 @@ public void setActive(boolean active) {
148148
/**
149149
* get the column representing this field for display in an object array table
150150
*
151-
* @param pageactionmanager page action manager
152-
* @param largedisplay true if large display
153-
* @param preferedrowheight the prefered row height, in number of rows
154-
* @param actionkeyforupdate if this field has a specific action key for update.
155-
* This is is case several actions can be triggered
156-
* from data changed in the object (not fully
157-
* operational)
151+
* @param pageactionmanager page action manager
152+
* @param largedisplay true if large display
153+
* @param preferedrowheight the prefered row height, in number of rows
154+
* @param actionkeyforupdate if this field has a specific action key for
155+
* update. This is is case several actions can be
156+
* triggered from data changed in the object (not
157+
* fully operational)
158+
* @param forcefieldupdatable will force the column as read-write if it has an
159+
* action key for update and is read-only on the
160+
* object definition
158161
* @return the table column
159162
*/
160163
public abstract TableColumn<ObjectTableRow, ?> getTableColumn(
161164
PageActionManager pageactionmanager,
162165
boolean largedisplay,
163166
int preferedrowheight,
164-
String actionkeyforupdate);
165-
167+
String actionkeyforupdate,
168+
boolean forcefieldupdatable);
166169

167170
/**
168171
* @param pageactionmanager action manager

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,12 @@ public TableColumn<ObjectTableRow, CChoiceFieldValue> getTableColumn(
735735
PageActionManager pageactionmanager,
736736
boolean largedisplay,
737737
int rowheight,
738-
String actionkeyforupdate) {
738+
String actionkeyforupdate,boolean forcefieldupdatable) {
739739

740740
TableColumn<
741741
ObjectTableRow,
742742
CChoiceFieldValue> thiscolumn = new TableColumn<ObjectTableRow, CChoiceFieldValue>(this.getLabel());
743-
if ((actionkeyforupdate != null) && (this.isEditable())) {
743+
if (((actionkeyforupdate != null) && (this.isEditable())) || (actionkeyforupdate!=null && forcefieldupdatable)) {
744744
thiscolumn.setEditable(true);
745745
thiscolumn.setOnEditCommit(new TableColumnOnEditCommit(this));
746746
} else {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,12 @@ public int compareTo(LockableDate object) {
423423
PageActionManager pageactionmanager,
424424
boolean largedisplay,
425425
int rowheight,
426-
String actionkeyforupdate) {
426+
String actionkeyforupdate,boolean forcefieldupdatable) {
427427
TableColumn<
428428
ObjectTableRow,
429429
LockableDate> thiscolumn = new TableColumn<ObjectTableRow, LockableDate>(this.getLabel());
430430

431-
if ((actionkeyforupdate != null) && (this.isEditable())) {
431+
if (((actionkeyforupdate != null) && (this.isEditable())) || (actionkeyforupdate!=null && forcefieldupdatable)) {
432432
thiscolumn.setEditable(true);
433433
CDateField thisdatefield = this;
434434
thiscolumn.setOnEditCommit(new EventHandler<CellEditEvent<ObjectTableRow, LockableDate>>() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,12 @@ public TableColumn<ObjectTableRow, LockableBigDecimal> getTableColumn(
451451
PageActionManager pageactionmanager,
452452
boolean largedisplay,
453453
int rowheight,
454-
String actionkeyforupdate) {
454+
String actionkeyforupdate, boolean forcefieldupdatable) {
455455
TableColumn<
456456
ObjectTableRow,
457457
LockableBigDecimal> thiscolumn = new TableColumn<ObjectTableRow, LockableBigDecimal>(this.getLabel());
458458
thiscolumn.setStyle("-fx-alignment: TOP-RIGHT;");
459-
if ((actionkeyforupdate != null) && (this.isEditable())) {
459+
if (((actionkeyforupdate != null) && (this.isEditable())) || (actionkeyforupdate!=null && forcefieldupdatable)) {
460460
thiscolumn.setEditable(true);
461461
CDecimalField thisdecimalfield = this;
462462
thiscolumn.setOnEditCommit(new EventHandler<CellEditEvent<ObjectTableRow, LockableBigDecimal>>() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ public TableColumn<ObjectTableRow, Integer> getTableColumn(
220220
PageActionManager pageactionmanager,
221221
boolean largedisplay,
222222
int preferedrowheight,
223-
String actionkeyforupdate) {
223+
String actionkeyforupdate,boolean forcefieldupdatable) {
224224
TableColumn<ObjectTableRow, Integer> thiscolumn = new TableColumn<ObjectTableRow, Integer>(this.getLabel());
225-
if (actionkeyforupdate != null) {
225+
if (((actionkeyforupdate != null) && (this.isEditable())) || (actionkeyforupdate!=null && forcefieldupdatable)) {
226226
thiscolumn.setEditable(true);
227227
} else {
228228
thiscolumn.setEditable(false);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public MultipleChoiceDataElt<CChoiceFieldValue> getFieldDataElt() {
243243
PageActionManager pageactionmanager,
244244
boolean largedisplay,
245245
int preferedrowheight,
246-
String actionkeyforupdate) {
246+
String actionkeyforupdate,boolean forcefieldupdatable) {
247247
TableColumn<ObjectTableRow, String> thiscolumn = new TableColumn<ObjectTableRow, String>(this.getLabel());
248248
thiscolumn.setEditable(false);
249249
int length = (this.maxcharlength * 7);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public class CObjectArray
136136
private String updatewarningstop;
137137
private boolean updatenote = false;
138138
private int rowstodisplay;
139+
private boolean forcefieldsupdatable;
139140

140141
/**
141142
* launch an update on the table after client finished entering data in thetable
@@ -200,6 +201,7 @@ public void launchupdate(ActionEvent event, MouseEvent mouseevent) {
200201
*/
201202
public CObjectArray(MessageReader reader, CPageSignifPath parentpath) throws OLcRemoteException, IOException {
202203
super(reader, parentpath);
204+
this.forcefieldsupdatable = false;
203205
this.name = reader.returnNextStringField("NAME");
204206
this.allowmultipleselect = reader.returnNextBooleanField("AMS");
205207
this.allowdataclear = reader.returnNextBooleanField("ADC");
@@ -258,6 +260,7 @@ public CObjectArray(MessageReader reader, CPageSignifPath parentpath) throws OLc
258260

259261
reader.returnNextStartStructure("INLUPD");
260262
this.updatemodeactive = reader.returnNextBooleanField("DUM");
263+
this.forcefieldsupdatable = reader.returnNextBooleanField("FFU");
261264
reader.returnNextStartStructure("INLINEACTION");
262265
this.updateinlineaction = new CPageInlineAction(reader);
263266

@@ -286,6 +289,7 @@ public CObjectArray(MessageReader reader, CPageSignifPath parentpath) throws OLc
286289
this.updateactionfields = new ArrayList<String>();
287290
reader.returnNextStartStructure("UPD");
288291
this.updatemodeactive = reader.returnNextBooleanField("DUM");
292+
this.forcefieldsupdatable = reader.returnNextBooleanField("FFU");
289293
reader.returnNextStartStructure("ACTION");
290294
this.updateaction = new CPageAction(reader);
291295
reader.startStructureArray("FIELD");
@@ -621,7 +625,7 @@ public Node getNode(
621625
CObjectArrayColumnModel tablemodel = new CObjectArrayColumnModel(payloadlist, this.updateactionfields,
622626
(this.updateinlineaction != null ? this.updateinlineaction.key()
623627
: (this.updateaction != null ? this.updateaction.key() : null)),
624-
updatemousehandler);
628+
updatemousehandler,this.forcefieldsupdatable);
625629
// generates table with title
626630
logger.fine("Generate model with forced row height = " + forcedrowheight);
627631
this.thistable = tablemodel.generateTableViewModel(actionmanager, this.forcedrowheight);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,11 +831,11 @@ public TableColumn<ObjectTableRow, OrderableString> getTableColumn(
831831
PageActionManager pageactionmanager,
832832
boolean largedisplay,
833833
int rowheight,
834-
String actionkeyforupdate) {
834+
String actionkeyforupdate,boolean forcefieldupdatable) {
835835
TableColumn<
836836
ObjectTableRow,
837837
OrderableString> thiscolumn = new TableColumn<ObjectTableRow, OrderableString>(this.getLabel());
838-
if ((actionkeyforupdate != null) && (this.isEditable())) {
838+
if (((actionkeyforupdate != null) && (this.isEditable())) || (actionkeyforupdate!=null && forcefieldupdatable)) {
839839
thiscolumn.setEditable(true);
840840
CTextField thistextfield = this;
841841
thiscolumn.setOnEditCommit(new EventHandler<CellEditEvent<ObjectTableRow, OrderableString>>() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public TableColumn<ObjectTableRow, TimePeriod> getTableColumn(
232232
PageActionManager pageactionmanager,
233233
boolean largedisplay,
234234
int preferedrowheight,
235-
String actionkeyforupdate) {
235+
String actionkeyforupdate,boolean forcefieldupdatable) {
236236
TableColumn<
237237
ObjectTableRow, TimePeriod> thiscolumn = new TableColumn<ObjectTableRow, TimePeriod>(this.getLabel());
238238
if (actionkeyforupdate != null) {

src/org/openlowcode/client/graphic/widget/table/CObjectArrayColumnModel.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class CObjectArrayColumnModel {
4444
private HashMap<String, String> updateactionfields;
4545
private int finalheightinpixel = 12 + 15;
4646
private UpdateMouseHandler updatemousehandler;
47+
private boolean forcefieldsupdatable;
4748

4849
/**
4950
* create a column model for the given business fields
@@ -60,16 +61,21 @@ public CObjectArrayColumnModel(ArrayList<CBusinessField<?>> arraycolumns) {
6061
/**
6162
* creates a column model
6263
*
63-
* @param arraycolumns a list of busines fields
64-
* @param updateactionfields list of fields that should trigger an unique action
65-
* @param uniqueupdatekey key of the update inline action and action
66-
* @param updatemousehandler mouse handler for update
64+
* @param arraycolumns a list of busines fields
65+
* @param updateactionfields list of fields that should trigger an unique
66+
* action
67+
* @param uniqueupdatekey key of the update inline action and action
68+
* @param updatemousehandler mouse handler for update
69+
* @param forcefieldsupdatable will force all fields with an update action to
70+
* become read-write, even if normally read-only in
71+
* object definition
6772
*/
6873
public CObjectArrayColumnModel(
6974
ArrayList<CBusinessField<?>> arraycolumns,
7075
ArrayList<String> updateactionfields,
7176
String uniqueupdatekey,
72-
UpdateMouseHandler updatemousehandler) {
77+
UpdateMouseHandler updatemousehandler,
78+
boolean forcefieldsupdatable) {
7379
this.arraycolumns = arraycolumns;
7480
this.columnstoshowintooltip = new ArrayList<CBusinessField<?>>();
7581
this.updateactionfields = new HashMap<String, String>();
@@ -79,6 +85,7 @@ public CObjectArrayColumnModel(
7985

8086
}
8187
this.updatemousehandler = updatemousehandler;
88+
this.forcefieldsupdatable = forcefieldsupdatable;
8289
}
8390

8491
/**
@@ -189,7 +196,7 @@ public TableView<ObjectTableRow> generateTableViewModel(PageActionManager action
189196
if (!thisfield.isShowinbottomnotes()) {
190197
String actionkeyforupdate = updateactionfields.get(thisfield.getFieldname());
191198
TableColumn<ObjectTableRow, ?> thiscolumn = thisfield.getTableColumn(actionmanager,
192-
(finalpreferedrowheight > 1 ? true : false), finalpreferedrowheight, actionkeyforupdate);
199+
(finalpreferedrowheight > 1 ? true : false), finalpreferedrowheight, actionkeyforupdate,this.forcefieldsupdatable);
193200
totalwidth += thiscolumn.getMinWidth();
194201
returntable.getColumns().add(thiscolumn);
195202
thiscolumn.widthProperty().addListener(new ChangeListener<Number>() {

0 commit comments

Comments
 (0)