IDEMPIERE-6113 : Date Range boxes on Info Window are too small (#2320)
* IDEMPIERE-6113 : Date Range boxes on Info Window are too small * Update InfoWindow.java Update class based on the ideas from Zuhri and Heng Sin * - Fix issue getting the number of columns used on a row * - no need for extra column as the parameter grid has already a size of 95% * - getRowSize must also exclude DateRangeButton on Order Info * - increase size as suggested by Zuhri --------- Co-authored-by: Carlos Ruiz <carg67@gmail.com> Co-authored-by: hengsin <hengsin@gmail.com>
This commit is contained in:
parent
ac5f84f48d
commit
67948cbad2
|
@ -164,7 +164,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
/**
|
/**
|
||||||
* generated serial id
|
* generated serial id
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4004251745919433247L;
|
private static final long serialVersionUID = 615852605072547785L;
|
||||||
|
|
||||||
private static final String ON_QUERY_AFTER_CHANGE = "onQueryAfterChange";
|
private static final String ON_QUERY_AFTER_CHANGE = "onQueryAfterChange";
|
||||||
|
|
||||||
|
@ -1797,13 +1797,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
Columns columns = new Columns();
|
Columns columns = new Columns();
|
||||||
parameterGrid.appendChild(columns);
|
parameterGrid.appendChild(columns);
|
||||||
noOfParameterColumn = getNoOfParameterColumns();
|
noOfParameterColumn = getNoOfParameterColumns();
|
||||||
for(int i = 0; i < noOfParameterColumn; i++)
|
String labelWidth = ( 100 / ( 3 * ( getNoOfParameterColumns() / 2 ) ) ) + "%";
|
||||||
columns.appendChild(new Column());
|
String fieldWidth = ( 100 * 2 / ( 3 * ( getNoOfParameterColumns() / 2 ) ) ) + "%";
|
||||||
|
for(int i = 0; i < noOfParameterColumn; i++) {
|
||||||
Column column = new Column();
|
Column column = new Column();
|
||||||
ZKUpdateUtil.setWidth(column, "100px");
|
if (i%2 == 0)
|
||||||
column.setAlign("right");
|
column.setWidth(labelWidth);
|
||||||
|
else
|
||||||
|
column.setWidth(fieldWidth);
|
||||||
columns.appendChild(column);
|
columns.appendChild(column);
|
||||||
|
}
|
||||||
|
|
||||||
if (parameterGrid.getRows() != null)
|
if (parameterGrid.getRows() != null)
|
||||||
parameterGrid.getRows().detach();
|
parameterGrid.getRows().detach();
|
||||||
|
@ -1844,9 +1847,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
|
|
||||||
if (checkAND == null) {
|
if (checkAND == null) {
|
||||||
if (parameterGrid.getRows() != null && parameterGrid.getRows().getFirstChild() != null) {
|
if (parameterGrid.getRows() != null && parameterGrid.getRows().getFirstChild() != null) {
|
||||||
Row row = (Row) parameterGrid.getRows().getFirstChild();
|
Row row = (Row) parameterGrid.getRows().getLastChild();
|
||||||
int col = row.getChildren().size();
|
int col = getRowSize(row);
|
||||||
while (col < 6) {
|
if (col == getNoOfParameterColumns()) {
|
||||||
|
row = new Row();
|
||||||
|
parameterGrid.getRows().appendChild(row);
|
||||||
|
col = 0;
|
||||||
|
}
|
||||||
|
while (col < getNoOfParameterColumns()-1) {
|
||||||
row.appendChild(new Space());
|
row.appendChild(new Space());
|
||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
|
@ -1896,6 +1904,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get number of children from the row except Menupopup
|
||||||
|
* @param row
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getRowSize(Row row) {
|
||||||
|
int cnt = 0;
|
||||||
|
for (Component comp : row.getChildren()) {
|
||||||
|
if (! (comp instanceof Menupopup || comp instanceof DateRangeButton) )
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* evaluate display logic for input parameters
|
* evaluate display logic for input parameters
|
||||||
*/
|
*/
|
||||||
|
@ -1950,6 +1972,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
editor.dynamicDisplay();
|
editor.dynamicDisplay();
|
||||||
editor.addValueChangeListener(this);
|
editor.addValueChangeListener(this);
|
||||||
editor.fillHorizontal();
|
editor.fillHorizontal();
|
||||||
|
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "100%");
|
||||||
if (editor instanceof WTableDirEditor)
|
if (editor instanceof WTableDirEditor)
|
||||||
{
|
{
|
||||||
((WTableDirEditor) editor).setRetainSelectedValueAfterRefresh(false);
|
((WTableDirEditor) editor).setRetainSelectedValueAfterRefresh(false);
|
||||||
|
@ -1960,6 +1983,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
editor2.dynamicDisplay();
|
editor2.dynamicDisplay();
|
||||||
editor2.addValueChangeListener(this);
|
editor2.addValueChangeListener(this);
|
||||||
editor2.fillHorizontal();
|
editor2.fillHorizontal();
|
||||||
|
if (DisplayType.isDate(mField.getDisplayType())) {
|
||||||
|
// give space for the Date Range button
|
||||||
|
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "44%");
|
||||||
|
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor2.getComponent(), "44%");
|
||||||
|
} else {
|
||||||
|
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "50%");
|
||||||
|
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor2.getComponent(), "50%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Label label = editor.getLabel();
|
Label label = editor.getLabel();
|
||||||
|
@ -2034,17 +2065,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel = (Row) parameterGrid.getRows().getLastChild();
|
panel = (Row) parameterGrid.getRows().getLastChild();
|
||||||
if (panel.getChildren().size() == getNoOfParameterColumns())
|
if (getRowSize(panel) == getNoOfParameterColumns())
|
||||||
{
|
{
|
||||||
if (parameterGrid.getRows().getChildren().size() == 1)
|
|
||||||
{
|
|
||||||
createAndCheckbox();
|
|
||||||
panel.appendChild(checkAND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
panel.appendChild(new Space());
|
|
||||||
}
|
|
||||||
panel = new Row();
|
panel = new Row();
|
||||||
parameterGrid.getRows().appendChild(panel);
|
parameterGrid.getRows().appendChild(panel);
|
||||||
}
|
}
|
||||||
|
@ -2067,14 +2089,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
outerParent.setStyle("display: flex;");
|
outerParent.setStyle("display: flex;");
|
||||||
outerParent.appendChild(fieldEditor);
|
outerParent.appendChild(fieldEditor);
|
||||||
if(fieldEditor2 != null) {
|
if(fieldEditor2 != null) {
|
||||||
Label dash = new Label("-");
|
outerParent.setStyle("display: flex; flex-wrap: wrap;");
|
||||||
dash.setStyle("padding-left:3px;padding-right:3px;display:flex;align-items:center;");
|
|
||||||
outerParent.appendChild(dash);
|
|
||||||
outerParent.appendChild(fieldEditor2);
|
outerParent.appendChild(fieldEditor2);
|
||||||
if(editor.getGridField() != null && DisplayType.isDate(editor.getGridField().getDisplayType())) {
|
if(editor.getGridField() != null && DisplayType.isDate(editor.getGridField().getDisplayType())) {
|
||||||
DateRangeButton drb = (new DateRangeButton(editor, editor2));
|
DateRangeButton drb = (new DateRangeButton(editor, editor2));
|
||||||
outerParent.appendChild(drb);
|
outerParent.appendChild(drb);
|
||||||
drb.setDateButtonVisible(false);
|
|
||||||
}
|
}
|
||||||
if (fieldEditor instanceof InputElement && fieldEditor2 instanceof InputElement) {
|
if (fieldEditor instanceof InputElement && fieldEditor2 instanceof InputElement) {
|
||||||
((InputElement)fieldEditor).setPlaceholder(Msg.getMsg(Env.getCtx(), "From"));
|
((InputElement)fieldEditor).setPlaceholder(Msg.getMsg(Env.getCtx(), "From"));
|
||||||
|
|
Loading…
Reference in New Issue