Skip to content

Commit 19cb514

Browse files
author
Open Lowcode SAS
committed
Close #211
1 parent b72e5d3 commit 19cb514

2 files changed

Lines changed: 149 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/********************************************************************************
2+
* Copyright (c) 2019-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+
11+
package org.openlowcode.client.graphic.widget;
12+
13+
import java.io.IOException;
14+
15+
import org.openlowcode.client.graphic.CPageData;
16+
import org.openlowcode.client.graphic.CPageNode;
17+
import org.openlowcode.client.graphic.CPageSignifPath;
18+
import org.openlowcode.client.graphic.Callback;
19+
import org.openlowcode.client.runtime.PageActionManager;
20+
import org.openlowcode.tools.messages.MessageReader;
21+
import org.openlowcode.tools.messages.OLcRemoteException;
22+
import org.openlowcode.tools.structure.DataElt;
23+
import org.openlowcode.tools.structure.DataEltType;
24+
25+
import javafx.scene.Node;
26+
import javafx.scene.control.TabPane;
27+
import javafx.scene.paint.Color;
28+
import javafx.scene.shape.Rectangle;
29+
import javafx.stage.Window;
30+
31+
/**
32+
* The width protector ensures a component band will have at least the width
33+
* specified here
34+
*
35+
* @author <a href="https://openlowcode.com/" rel="nofollow">Open Lowcode
36+
* SAS</a>
37+
* @since 1.11
38+
*/
39+
public class CWidthProtector
40+
extends
41+
CPageNode {
42+
43+
private int minwidth;
44+
45+
public CWidthProtector(MessageReader reader, CPageSignifPath parentpath) throws OLcRemoteException, IOException {
46+
super(reader, parentpath);
47+
minwidth = reader.returnNextIntegerField("MNW");
48+
reader.returnNextEndStructure("WDP");
49+
}
50+
51+
@Override
52+
public CPageNode deepcopyWithCallback(Callback callback) {
53+
throw new RuntimeException("Not yet implemented");
54+
55+
}
56+
57+
@Override
58+
public Node getNode(
59+
PageActionManager actionmanager,
60+
CPageData inputdata,
61+
Window parentwindow,
62+
TabPane[] parenttabpanes,
63+
CollapsibleNode nodetocollapsewhenactiontriggered) {
64+
Rectangle rectangle = new Rectangle(minwidth,0,Color.RED);
65+
return rectangle;
66+
}
67+
68+
@Override
69+
public DataElt getDataElt(DataEltType type, String eltname, String objectdataloc) {
70+
71+
return null;
72+
}
73+
74+
@Override
75+
public void forceUpdateData(DataElt dataelt) {
76+
77+
78+
}
79+
80+
@Override
81+
public void mothball() {
82+
83+
}
84+
85+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
11+
package org.openlowcode.server.graphic.widget;
12+
13+
import java.io.IOException;
14+
15+
import org.openlowcode.server.graphic.SDefaultPath;
16+
import org.openlowcode.server.graphic.SPage;
17+
import org.openlowcode.server.graphic.SPageData;
18+
import org.openlowcode.server.graphic.SPageNode;
19+
import org.openlowcode.server.graphic.SPageSignifPath;
20+
import org.openlowcode.server.security.SecurityBuffer;
21+
import org.openlowcode.tools.messages.MessageWriter;
22+
23+
/**
24+
* A widget to ensure a vertical component band will have the minimum width
25+
* specified.
26+
*
27+
* @author <a href="https://openlowcode.com/" rel="nofollow">Open Lowcode
28+
* SAS</a>
29+
* @since 1.11
30+
*/
31+
32+
public class SWidthProtector
33+
extends
34+
SPageNode
35+
implements
36+
SDefaultPath {
37+
private int minwidth;
38+
public SWidthProtector(int minwidth,SPage parentpage) {
39+
super(parentpage);
40+
this.minwidth = minwidth;
41+
}
42+
@Override
43+
public String getPathName() {
44+
return "WDP";
45+
}
46+
@Override
47+
public void populateDown(SPageSignifPath parentpath, SPageNode[] widgetpathtoroot) {
48+
49+
}
50+
@Override
51+
public void WritePayloadToCDL(MessageWriter writer, SPageData input, SecurityBuffer buffer) throws IOException {
52+
writer.addIntegerField("MNW", minwidth);
53+
54+
}
55+
@Override
56+
public String getWidgetCode() {
57+
return "WDP";
58+
}
59+
@Override
60+
public boolean hideComponent(SPageData input, SecurityBuffer buffer) {
61+
return false;
62+
}
63+
64+
}

0 commit comments

Comments
 (0)